Document areas detection

A scanned image or photograph of a text document may contain a large number of blocks of various content - text paragraphs, tables, illustrations, formulas, and the like. Detecting, ordering, and classifying areas of interest on a page is the cornerstone of successful and accurate OCR. This process is called document areas detection.

Document structure analysis and recognition

Aspose.OCR offers several document areas detection algorithms, allowing you to choose the one that works best for your specific content.

Area detection modes

You can manually override the default document areas detection method if you are unhappy with the results or get unwanted artifacts.

Document structure analysis algorithm is specified using setDetectAreasMode method of recognition settings.

// Create instance of OCR API
AsposeOCR api = new AsposeOCR();
// Enable automatic document areas detection
RecognitionSettings recognitionSettings = new RecognitionSettings();
recognitionSettings.setDetectAreasMode(DetectAreasMode.UNIVERSAL);
// Prepare batch
OcrInput images = new OcrInput(InputType.SingleImage);
images.add("image.png");
// Recognize images
ArrayList<RecognitionResult> results = api.Recognize(images, recognitionSettings);
System.out.println("Recognition result:\n" + results[0].recognitionText + "\n\n");

Aspose.OCR for Java supports the following document structure analysis methods provided in DetectAreasMode enumeration:

Name Description Use cases
DetectAreasMode.UNIVERSAL Finds small text blocks inside complex images.
See DetectAreasMode.UNIVERSAL for additional details.
Driver’s licenses
Social security cards
Government and work IDs
Visas
Photos
Screenshots
Advertisements
Street photos
DetectAreasMode.MULTICOLUMN Detects large blocks of text formatted in columns. Optimal for multi-column documents with illustrations.
See DetectAreasMode.MULTICOLUMN for additional details.
Contracts
Books
Articles
Newspapers
High-quality scans
DetectAreasMode.TABLE Detects cells in tabular structures.
See DetectAreasMode.TABLE for additional details.
Tables
Invoices
DetectAreasMode.CURVED_TEXT Auto-straightens curved lines and finds text blocks inside the resulting image.
See DetectAreasMode.CURVED_TEXT for additional details.
Photos of books, magazine articles, and other curved pages.
DetectAreasMode.NONE Prioritizes speed and reduces resource consumption by omitting support for complex layouts. Simple images containing a few lines of text without illustrations or formatting.
Applications requiring maximum recognition speed
Web applications