Recognize single line

If an image contains a single line of text, it can be recognized in the fastest possible mode, without automated corrections, areas detection, and other resource-consuming steps. To extract text from such images, use Aspose.OCR.AsposeOcr.RecognizeLines method or enable RecognizeSingleLine property in recognition settings.

This method takes OcrInput object and optional recognition settings.

Recognition results are returned as a list of Aspose.OCR.RecognitionResult objects, that allow you to perform advanced manipulations with recognition results: automatically correct spelling, get image regions and save results in various formats.

Example

The following code example shows how to extract text from a single-line image:

Aspose.OCR.AsposeOcr recognitionEngine = new Aspose.OCR.AsposeOcr();
// Add a single-line image to OcrInput object
Aspose.OCR.OcrInput input = new Aspose.OCR.OcrInput(Aspose.OCR.InputType.SingleImage);
input.Add("source.png");
// Set recognition language
Aspose.OCR.RecognitionSettings recognitionSettings = new Aspose.OCR.RecognitionSettings();
recognitionSettings.Language = Aspose.OCR.Language.Ukr;
// Recognize image
List<Aspose.OCR.RecognitionResult> results = recognitionEngine.RecognizeLines(input, recognitionSettings);
foreach(Aspose.OCR.RecognitionResult result in results)
{
	Console.WriteLine(result.RecognitionText);
}

Performance impact

This method is about 7 times faster than normal OCR and is highly recommended for batch processing large numbers of very simple images.

Drawbacks

This method only works for images which contain a single line of text! Using it on multi-line images will lead to incorrect recognition results.