Extracting lines with coordinates

Contents
[ ]

Aspose.OCR for Java 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 RecognitionResult.LinesResult objects with the following fields:

Field Type Description
line Rectangle Line bounding box
textInLine String Extracted text
AsposeOcr api = new AsposeOcr();
OcrInput images = new OcrInput(InputType.SingleImage);
images.Add("source.png");
ArrayList<RecognitionResult.LinesResult> results = api.Recognize(images);
// Output recognized lines
result[0].recognitionLinesResult.forEach((line) -> {
	System.out.println(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).