Passport recognition settings

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

These settings are specifically tailored for processing scanned or photographed passports.

Setting Type Default value Description
allowed_symbols string All characters of the selected language The whitelist of characters Aspose.OCR engine will look for.
ignored_symbols string none A blacklist of characters that are ignored during recognition.
language Language Language.NONE Specify a language for recognition.
automatic_color_inversion 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.
country Country Country.UNIVERSAL Extract key passport details (such as a number, name, date of birth, and so on) for the specific country in addition to the entire passport text.
See Supported countries section below.

Supported countries

A list of countries for retrieving specific details (such as a number, name, date of birth, and so on) from passport images:

Value Country
Country.UNIVERSAL Do not parse passport details (only recognize passport text).
Country.MADAGASCAR Parse Malagasy passports.

Applicable to

Example

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

# Instantiate Aspose.OCR API
api = AsposeOcr()
# Add images to the recognition batch
input = OcrInput(InputType.SINGLE_IMAGE)
input.add("passport1.png")
input.add("passport2.png")
# Customize recognition settings
recognitionSettings = PassportRecognitionSettings()
recognitionSettings.language = Language.LATIN
# Recognize passports
result = api.recognize_passport(input, recognitionSettings)
# Print recognition result
print(result[0].recognition_text)
input("Press Enter to continue...")