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.
Aspose.OCR for JavaScript via C++ offers several document areas detection models, allowing you to choose the one that works best for your specific content.
You can manually override the default document areas detection function if you are unhappy with the results or get unwanted artifacts. Document structure analysis model is specified in an optional detect_areas_mode
parameter of recognition settings.
// Prepare images
var source = Module.WasmAsposeOCRInput();
source.url = filename;
var content = new Module.WasmAsposeOCRInputs();
content.push_back(source);
// Recognize photos of curved book pages
var settings = Module.WasmAsposeOCRRecognitionSettings();
settings.detect_areas_mode = Module.DetectAreasMode.CURVED_TEXT;
// Recognize image
var result = Module.AsposeOCRRecognize(content, settings);
Aspose.OCR for JavaScript via C++ supports the following document structure analysis models:
Value | Numeric value | Description | Use cases |
---|---|---|---|
Module.DetectAreasMode.NONE |
0 | Do not analyze document structure. Never disable automatic document areas detection when working with multi-paragraph and multi-column documents, tables, or photos. This can significantly reduce recognition accuracy. | Simple images containing a few lines of text without illustrations or formatting. Applications requiring maximum recognition speed Web applications |
Module.DetectAreasMode.DOCUMENT |
1 | Detect large blocks of text, such as paragraphs and columns. Optimal for multi-column documents with illustrations. See Module.DetectAreasMode.DOCUMENT for additional details. |
Contracts Books Articles Newspapers High-quality scans |
Module.DetectAreasMode.PHOTO |
2 | Finds small text blocks inside complex images. See Module.DetectAreasMode.PHOTO for additional details. |
Driver’s licenses Social security cards Government and work IDs Visas Photos Screenshots Advertisements |
Module.DetectAreasMode.COMBINE |
3 | The combination of Module.DetectAreasMode.DOCUMENT and Module.DetectAreasMode.PHOTO. See Module.DetectAreasMode.COMBINE for additional details. |
Posters Billboards Datasheets Random photos Batch recognition |
Module.DetectAreasMode.TABLE |
4 | Detects cells in tabular structures. See Module.DetectAreasMode.TABLE for additional details. |
Tables Invoices |
Module.DetectAreasMode.CURVED_TEXT |
5 | Auto-straightens curved lines and finds text blocks inside the resulting image. See Module.DetectAreasMode.CURVED_TEXT for additional details. |
Photos of books, magazine articles, and other curved pages. |