Read Passport
This code example demonstrates how to use the IronTesseract OCR engine to extract and process passport information from an image.
The IronTesseract OCR engine is instantiated. An OcrInput
object is created to load the image containing the passport ("passport.jpg") using the LoadImage
method. The ReadPassport
method is used to process the image and extract passport information, returning an OcrPassportResult
object that contains details like the given names, surname, country, passport number, date of birth, and date of expiry. The extracted passport information is then outputted to the console:
- The given names are accessed through
result.PassportInfo.GivenNames
. - The country is retrieved using
result.PassportInfo.Country
. - The passport number is available via
result.PassportInfo.PassportNumber
. - The surname is accessed with
result.PassportInfo.Surname
. - The date of birth is printed using
result.PassportInfo.DateOfBirth
. - The expiry date is outputted with
result.PassportInfo.DateOfExpiry
.
Discover how to automate passport data extraction with IronOCR in C# – Learn More!