Extracting lines with coordinates

Contents
[ ]

Aspose.OCR returns coordinates of each extracted line in recognition results. This can be useful for highlighting detected lines when previewing an image.

The lines are returned as a list of LinesResult objects with the following fields:

Field Type Description
line Rectangle Line bounding box
textInLine String Extracted text
AsposeOCR api = new AsposeOCR();
// Customize recognition
RecognitionSettings recognitionSettings = new RecognitionSettings();
recognitionSettings.setLanguage(Language.Ukr);
// Extract text from image
RecognitionResult result = api.RecognizePage("source.png", recognitionSettings);
// Output results line by line
result.recognitionLinesResult.forEach((line) -> {
	System.out.println(line.line + ": " + line.textInLine);
});

Live demo

Recognized image

Extracted line
Optical character recognition or optical character reader (OCR) is the
electronic or mechanical conversion of images of typed, handwritten or
printed text into machine-encoded text. whether from a scanned document
a photo of a document, a scene-photo (for example the text on signs and
billboards in a landscape photo) or from subtitle text superimposed on an
image (for example: from a television broadcast).