Common recognition settings

Aspose.OCR for .NET allows for very flexible customization of recognition accuracy, performance, and other settings by configuring the properties of the RecognitionSettings object.

These universal settings are applicable when extracting text from single-page and multi-page images, scanned PDFs, DjVu files, folders, archives and other content.

Setting Type Default value Description
AllowedSymbols string All characters of the selected language The whitelist of characters Aspose.OCR engine will look for.
DetectAreasMode Aspose.OCR.DetectAreasMode auto Manually override the default document areas detection method.
IgnoredSymbols string none A blacklist of characters that are ignored during recognition.
Language Aspose.OCR.Language Aspose.OCR.Language.None Specify a language for recognition.
LinesFiltration boolean false Set to true to recognize text in tables.
Set to false to improve performance by ignoring table structures and treating tables as plain text.
RecognitionAreas List<Aspose.Drawing.Rectangle> entire image List of areas of the image from which to extract text.
RecognizeSingleLine boolean false Recognize a single-line image. Disables automatic document region detection.
Improves the recognition performance of simple images.
ThreadsCount integer auto The number of CPU threads used for recognition.
UpscaleSmallFont boolean false Improve small font recognition and detection of dense lines.
AutomaticColorInversion boolean true Improve recognition accuracy of white text on a dark/black background. If you are not optimizing every aspect of recognition (for example, for online applications or entry-level devices), leave this setting set to true.
This setting is only applicable when using one of the following document area detection modes:

Applicable to

Example

The following code example shows how to fine-tune recognition:

Aspose.OCR.AsposeOcr recognitionEngine = new Aspose.OCR.AsposeOcr();
// Add images to OcrInput object
Aspose.OCR.OcrInput input = new Aspose.OCR.OcrInput(Aspose.OCR.InputType.SingleImage);
input.Add("source1.png");
input.Add("source2.jpg");
// Customize recognition settings
Aspose.OCR.RecognitionSettings recognitionSettings = new Aspose.OCR.RecognitionSettings();
recognitionSettings.Language = Aspose.OCR.Language.Ukr;
recognitionSettings.DetectAreasMode = Aspose.OCR.DetectAreasMode.TABLE;
// Recognize image
List<Aspose.OCR.RecognitionResult> results = recognitionEngine.Recognize(input, recognitionSettings);
foreach(Aspose.OCR.RecognitionResult result in results)
{
	Console.WriteLine(result.RecognitionText);
}