konstantint / PassportEye

Extraction of machine-readable zone information from passports, visas and id-cards via OCR
MIT License
374 stars 109 forks source link

Not able to Scan mrz #40

Closed satispande closed 4 years ago

satispande commented 4 years ago

Hi, 1

For the above attached sample the scan fails. can you please let me know what can i do to get information if user upload's this kind of image or if the rotation is different. Any hint would be appreciated.

AnkBurov commented 4 years ago

Well, you could modify the segmentation algorithm by adding Hough transformation to detect lines and also use a trained for MRZ Tesseract model. For example a recognition result of the photo above:

check_composite = {str} '8'
check_date_of_birth = {str} '4'
check_expiration_date = {str} '1'
check_number = {str} '4'
check_personal_number = {NoneType} None
country = {str} 'IND'
date_of_birth = {str} '590923'
expiration_date = {str} '211010'
mrz_type = {str} 'TD3'
names = {str} 'SITA MAHA LAKSHMI'
nationality = {str} 'IND'
number = {str} 'J8369854'
personal_number = {NoneType} None
sex = {str} 'F'
surname = {str} 'RAMADUGULA'
type = {str} 'P'
valid = {bool} True
valid_check_digits = {list} <class 'list'>: [True, True, True, True, True]
valid_composite = {bool} True
valid_date_of_birth = {bool} True
valid_expiration_date = {bool} True
valid_line_lengths = {list} <class 'list'>: [True, True]
valid_misc = {list} <class 'list'>: [True]
valid_number = {bool} True
valid_personal_number = {bool} True
valid_score = {int} 100

or if the rotation is different

Some EXIF blocks contain information about the image rotation. Or you could just rotate images manually and send to recognition 4 rotated copies of each image.

hunaidkhan2000 commented 4 years ago

@AnkBurov how can i use pretrained MRZ data which i found on [(https://github.com/Shreeshrii/tessdata_ocrb)]. I need to compile it with tesseract or i can use it directly with passporteye?