evermeer / PassportScanner

Scan the MRZ code of a passport and extract the firstname, lastname, passport number, nationality, date of birth, expiration date and personal numer.
BSD 3-Clause "New" or "Revised" License
457 stars 101 forks source link

scanning the image instead of video #1

Closed RyanKim01 closed 8 years ago

RyanKim01 commented 8 years ago

Hi I was wondering if it is possible to take a photo of mrz code to decode it instead of taking video of it. If I'm taking a video, it is consistently changing the value I'm getting back.

Thank you

evermeer commented 8 years ago

As you can see in the demo app, the moment a scan is valid, it stops scanning. It's this way because more than 80% of the scans of 1 frame will give you an invalid result. The MRZ code has a couple of checksums to test if a scan is valid. Only when the checksums are valid the scan will return.

PassportScanner does have an accuracy property. By default it's set to 1 which means it should only return if there is a 100% match. You could set it to something like 0.6 to let it return much earlier. Of course your scan won't be good.

If you want to make your own version that would only scan one image, then you don't have to change a lot of code. See line 157 of the PassPortScanner controller. Just load your image in the snapshot variable. also remove all references to self.videoCamera and remove the self.StartScan(self) at line 223

RyanKim01 commented 8 years ago

@evermeer , thank you for the reply! I will take a look into it!