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 offers several document areas detection algorithms, allowing you to choose the one that works best for your specific content.
Automatic areas detection
Document areas detection uses a neural network, which requires additional time and resources on the computer running the application. You can disable it (set
DetectAreasMode property to
false) when extracting single-line texts, or working with very simple documents without formatting and pictures. This can improve the performance of your application, especially when integrating OCR functionality into web sites and public APIs with minimal impact on the quality of recognition results.
Aspose.OCR.AsposeOcr recognitionEngine = new Aspose.OCR.AsposeOcr(); // Enable automatic document areas detection Aspose.OCR.RecognitionSettings recognitionSettings = new Aspose.OCR.RecognitionSettings(); recognitionSettings.DetectAreas = true; // Recognize image Aspose.OCR.RecognitionResult result = recognitionEngine.RecognizeImage("source.png", recognitionSettings); Console.WriteLine(result.RecognitionText);
Area detection modes
You can manually override the default document areas detection method if you are unhappy with the results or get unwanted artifacts.
Aspose.OCR.AsposeOcr recognitionEngine = new Aspose.OCR.AsposeOcr(); Aspose.OCR.RecognitionSettings recognitionSettings = new Aspose.OCR.RecognitionSettings(); recognitionSettings.DetectAreasMode = Aspose.OCR.DetectAreasMode.DOCUMENT; // Recognize image Aspose.OCR.RecognitionResult result = recognitionEngine.RecognizeImage("source.png", recognitionSettings); Console.WriteLine(result.RecognitionText);
Aspose.OCR for .NET supports the following document structure analysis methods provided in [
||0||Do not analyze document structure. Similar to disabling
||Simple images containing a few lines of text without illustrations or formatting.
Applications requiring maximum recognition speed
||1||Detect large blocks of text, such as paragraphs and columns. Optimal for multi-column documents with illustrations.
See DetectAreasMode.DOCUMENT for additional details.
||2||Finds small text blocks inside complex images.
See DetectAreasMode.PHOTO for additional details.
Social security cards
Government and work IDs
||3||The combination of DetectAreasMode.DOCUMENT and DetectAreasMode.PHOTO.
See DetectAreasMode.COMBINE for additional details.
||4||Detects cells in tabular structures.
See DetectAreasMode.TABLE for additional details.
||5||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.|