MRZ_Passport_Reader_From_Image
MRZ_Passport_Reader_From_Image copied to clipboard
The of this study are to detect and recognize MRZ ID from one-shot passport images with Tesseract
MRZ_Passport_Reader_From_Image
The of this study are to detect and recognize MRZ ID from one-shot passport images. It includes our own model to segment mrz area. Then, we are using Tesseract OCR to recognize text.
Setup Tesseract
- Setup Tesseract into Tesseract-OCR directory - You should download tesseract-ocr-w64-setup-v5.0.0-alpha.20210811 version
- Then , Copy all files which are at ./tesseract_trained to ./Tesseract-OCR/tessdata .These files are trained models.
- Finally , run this command
pip install -r ./requirements.txt
to install necessary libraries
Now, You are ready
from mrz_reader import mrz_reader
mrz_reader=mrz_reader()
mrz_reader.load()
#If you want detect face
mrz_reader.facedetect=True
#Before tesseract , check skewness
mrz_reader.skewness=False
#Before tesseract , delete shadows
mrz_reader.delete_shadows=True
#Before tesseract , clear background
mrz_reader.clear_background=True
mrz_dl,face=mrz_reader.predict("./example.jpg")
Example Result
![](https://github.com/SerdarHelli/MRZ_Passport_Reader_From_Image/blob/main/example.jpg)
After you give this image to the models , you will take this result P<GBRUNITED<KINGDOM<FIVE<<JODIE<PIPPA<<<<<<<1071857032GBR8501178F1601312<<<<<<<<<<<<<<02 as a string. This study is a basic solution . Your image which you give should be clear, and it should cover whole area.