Finding line bounding boxes
Contents
[
Hide
]
Aspose.OCR allows you to automatically find the coordinates of image regions containing text lines. This can be useful for highlighting detected lines when previewing an image or extracting individual blocks of text.
To get bounding boxes of all lines of the image, use getTextAreas
method of AsposeOCR
class. Specify AreasType.LINES
as the areaType parameter of the method.
Line detection works differently depending on the isDetectAreas
parameter of the method:
detectAreas | Behavior |
---|---|
true |
The OCR engine tries to break the content into paragraphs and then extracts lines from the found paragraphs. Best suited for multi-column texts - adjacent lines in different columns will be treated as separate lines rather than a single line. |
false |
The OCR engine ignores the columns and combines adjacent lines from different columns into a single line. This can be useful when concatenating text from table rows. |
This method works for images in the following formats: GIF, PNG, JPEG, BMP, WBMP.
Coordinates of each line (top-left corner, width and height) are returned as a list of Rectangle
objects.