閱讀 Passport

此程式碼範例展示如何使用IronTesseract的OCR引擎從圖像中提取並處理護照資訊。

已實例化IronTesseract的OCR引擎。 建立一個LoadImage方法載入包含護照的圖像("passport.jpg")。 OcrPassportResult物件,其中包含給定名、姓氏、國家、護照號碼、出生日期和到期日期等詳細資訊。 然後將提取的護照資訊輸出到控制台:

  • 給定名通過result.PassportInfo.GivenNames存取。
  • 國家使用result.PassportInfo.Country檢索。
  • 護照號碼通過result.PassportInfo.PassportNumber獲得。
  • 姓氏使用result.PassportInfo.Surname存取。
  • 出生日期使用result.PassportInfo.DateOfBirth列印。
  • 到期日期通過result.PassportInfo.DateOfExpiry輸出。
  • 性別通過result.PassportInfo.Gender存取。
  • 文件型別通過result.PassportInfo.DocumentType檢索。
  • 國籍通過result.PassportInfo.Nationality獲得。
  • 國籍程式碼使用result.PassportInfo.NationalityCode存取。
  • 發行國程式碼使用result.PassportInfo.IssuingCountryCode檢索。
  • 個人號碼通過result.PassportInfo.PersonalNumber獲得。
  • 發行日期通過result.PassportInfo.DateOfIssue存取。

學習使用IronOCR提取護照資訊

準備開始了嗎?
Nuget 下載 6,136,090 | 版本: 2026.7 剛剛發布
Still Scrolling Icon

還在滾動?

想要快速證明? PM > Install-Package IronOcr
執行範例 觀看您的圖像轉變為可搜尋文字。