Extracting text from ID cards

Contents
[ ]

An identity card (commonly abbreviated as ID) is a small plastic or paper card that is used to verify a person’s identity. This can be an identity card, work permit, residence permit, passport card or other identity document. Manually re-typing text from ID cards, especially in batch mode, is time consuming and commonly leads to errors.

Aspose.OCR for Python via .NET offers a special recognition algorithm that extracts text from scanned or photographed ID cards, which can then be automatically saved to the database or automatically verified. To extract text from an ID card, use recognize_id_card() method of AsposeOcr class.

This method allows you to customize recognition accuracy, performance, and other settings.

The method takes OcrInput object and returns a RecognitionResult object containing the identity data.

# Instantiate Aspose.OCR API
api = AsposeOcr()
# Add image to the recognition batch
input = OcrInput(InputType.SINGLE_IMAGE)
input.add("ID1.png")
input.add("ID2.png")
# Set recognition language
recognitionSettings = IDCardRecognitionSettings()
recognitionSettings.Language = Aspose.OCR.Language.Latin;
# Recognize ID cards
results = api.recognize_id_card(input, recognitionSettings)
# Print recognition result
for result in results:
    print(result.recognition_text)