Receipt recognition settings
Contents
[
Hide
]
Aspose.OCR for Java allows for very flexible customization of recognition accuracy, performance, and other settings by configuring the properties of the ReceiptRecognitionSettings
object.
These settings are applicable when extracting text from scanned receipts in JPEG, PNG, TIFF, BMP, and GIF formats.
Method | Parameter | Default state | Description |
---|---|---|---|
setAllowedCharacters |
Case-sensitive string of characters or one of the predefined character sets:
|
All characters from the selected recognition language. | The whitelist of characters Aspose.OCR engine will look for. |
setAutoSkew |
|
Enabled | Automatically correct image tilt (deskew) before proceeding to recognition. |
setIgnoredCharacters |
Case-sensitive string of characters | All characters are recognized | A blacklist of characters that are ignored during recognition. |
setLanguage |
Recognition language | Extended Latin characters, including diacritics | Specify a language for recognition. |
setPreprocessingFilters |
Image preprocessing filter | None | Apply image processing filters that enhance an image before it is sent to the OCR engine. |
setThreadsCount |
Number of threads, int |
Automatic | The number of CPU threads used for recognition. |
setUpscaleSmallFont |
|
Disabled | Improve small font recognition and detection of dense lines. |
Applicable to
Example
The following code example shows how to fine-tune receipt recognition:
// Create instance of OCR API
AsposeOCR api = new AsposeOCR();
// Specify recognition settings
ReceiptRecognitionSettings recognitionSettings = new ReceiptRecognitionSettings();
recognitionSettings.setLanguage(Language.Fra);
recognitionSettings.setThreadsCount(2);
// Extract text from receipt
RecognitionResult result = api.RecognizeReceipt("receipt.png", recognitionSettings);
System.out.println("Recognition result:\n" + result.recognitionText + "\n\n");