GithubHelp home page GithubHelp logo

evermeer / passportscanner Goto Github PK

View Code? Open in Web Editor NEW
457.0 457.0 107.0 115.8 MB

Scan the MRZ code of a passport and extract the firstname, lastname, passport number, nationality, date of birth, expiration date and personal numer.

License: BSD 3-Clause "New" or "Revised" License

Ruby 10.59% Swift 89.07% Objective-C 0.34%
mrz ocr passport scanner

passportscanner's People

Contributors

evermeer avatar olcayertas avatar punto2018 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

passportscanner's Issues

Camera freeze in white screen

The issue can be reproduced as follow:

  • start the ocr by pressing "scan" in the demo
  • the camera view show "some frame" for a while
  • than it "fade" in white nothing can be done to acquire the MRZ

Tested on iPhone 6S and iOS 12.

img_0061trim

could not build the project

i downloaded the project and tried to build but facing some difficulties. i am using Xcode 10. here is the screenshot of the error.

screen shot 2018-10-08 at 2 00 02 pm

DOB Format

How are you differentiating if a person is born in 20th century or 21st century.
DOB format in MRZ is YYMMdd...how are you calculating year as YYYY?

Add support to scan the MRZ of an ID card

As reported by @jrodriguezq there is no support for the MRZ for an ID card. I will add this as an enhanecment later.

Original question:

The last commit fixes the issue that I had with the camera, now it looks like this:
img_3139

The OCR it's working, but I'm not able to correctly read the MRZ. As you can see, the image appears to be clear enough.
The usual case of the mrz captured it's something like this:

INCHL1D41230409D26<<<<<<<<<<<<
9002063M2002064CHL17409866<2<6
CORTES<CONTRERAS<<SERGIO<JAV ll 12

This appears to be almost correct, but some numbers and blank characters usually stand in the way and I'm not able to scan the MRZ.
Is there any configuration that I'm missing?

Again, many thanks for the library.

scanning the image instead of video

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

iOS 10 compability

Since the release of iOS 10, PassportScanner no longer builds correctly.
Is there any know solution for this?

EXC_BAD_ACCESS error at ImageConsumer.addSource

Hi,

I am always hitting that error on EVGPUImage2, ImageConsumer.addSource and I've found not much help on this matter.

This happens when I click on the SCAN button in the demo project.

I am running the demo on ios 10.2 on a iPhone6+.
screen shot 2017-01-05 at 5 55 11 pm

After scanning for some seconds with a Scan quality insufficient : 0.0, I get a "GPUImageFramebuffer unlock" Exception.

2016-03-21 17:50:02.556 PassportScanner[9842:4849034] *** Assertion failure in -[GPUImageFramebuffer unlock], /Users/frlobo/Downloads/PassportScanner-master-2/Pods/GPUImage/framework/Source/GPUImageFramebuffer.m:269
2016-03-21 17:50:02.558 PassportScanner[9842:4849034] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Tried to overrelease a framebuffer, did you forget to call -useNextFrameForImageCapture before using -imageFromCurrentFramebuffer?'
*** First throw call stack:
(0x18382d900 0x182e9bf80 0x18382d7d0 0x1841a099c 0x100197c80 0x100197e2c 0x184ac447c 0x184ac3510 0x18370d664 0x184ac3210 0x18370d664 0x18851cc24 0x182eb5ae8 0x18371142c 0x18411741c 0x1841d6728 0x101b65bb0 0x101b6b658 0x1837e4bb0 0x1837e2a18 0x183711680 0x184c20088 0x188588d90 0x1001005e4 0x1832b28b8)
libc++abi.dylib: terminating with uncaught exception of type NSException

CGImageCreate: invalid image

The library works fine, but looking the console while the demo is running the following log is shown repeatedly.

PassportScanner[7819:1822032] [Unknown process name] CGImageCreate: invalid image alphaInfo: kCGImageAlphaNone. It should be kCGImageAlphaNoneSkipLast

I've searched but the constant kCGImageAlphaNone is never used. Also it is not clear what line of code generate this warning.

Any idea on how to debug it?
Thanks!

Feature request: Disable camera filters in the preview

Hi everybody,
Currently the library show a manipulated video in the camera preview view.
The image is black and white, several filters have been applied in order to facilitate the acquisition with the ocr. For some uses this is not acceptable, I'm trying to figure out if it is possible to restore the "standard camera preview" disabling all filters, re applying them in post processing when the frame is passed to the recognition engine.

Any suggestion in where to start?
Thanks!

Open just white view

Hi! When I try to call my VC, which inherit PassportScannerController, it opens, but open just white screen view with nothing. Also before run I disabled bitcode in all targets, frameworks too. Why it can be?
Thanks!

Reduce Tesseract delay?

Hi Edwin!

I've been making tests with this scanner and I noticed every time Tesseract is called to analyze the processed capture (according to the code is every 0.2 secs) cause a delay in the camera view and the view get freeze constantly. I guess Tesseract take time to read the eng.traineddata and that is the cause of the delay.

Is there some way to reduce that delay and get a camera view with no freezing?

Tesseract crashed: Failed loading language 'eng'

Hi! When I try to use PassportScanner he crashes with that error:

Please make sure the TESSDATA_PREFIX environment variable is set to the parent directory of your "tessdata" directory.
Failed loading language 'eng'
Tesseract couldn't load any languages!
fatal error: unexpectedly found nil while unwrapping an Optional value

How can I fix that? Thanks!

Xamarin iOS

Can we bind this scanner to Xamarin iOS, as it is being developed in swift

Issue cropping the image

Hi Edwin, first of all, thank you for your awesome framework. I've modified your interface with the camera as you can see in this image:

44b1affc-27de-460b-966c-babcd51ac82b

My problem now is in these lines when cropping is made:
// Specify the crop region that will be used for the OCR
crop.cropSizeInPixels = Size(width: 500, height: 1250)
crop.locationOfCropInPixels = Position(350, 60, nil)
crop.overriddenOutputRotation = .rotateClockwise

I need to modify the size and the location to fit the cropping for the new visible area, but I don't understand how works this methods, the documentation of GPUImage show very few information about it. If you can help me with an example I would thank you.

When scanning a real passport, it has a hard time to scan the MRZ

Not sure why. I have both a Canadian and US passport. The Canadian did scan on the first try. I got one shot at the US but subsequent attempts failed. I just get this warning in the console:

Scan quality insufficient : 0.0
2020-12-21 12:03:57.630215-0500 PassportScanner[1519:784903] [Unknown process name] CGImageCreate: invalid image alphaInfo: kCGImageAlphaNone. It should be kCGImageAlphaNoneSkipLast
- Start recognize
Scan result : bylaw 1w xf I  L

I have ideal light, the code appears clearly on the iPhone 11 that I'm using.

Cocoapod error

Hi Edwin. I'm getting "Unable to find a specification for EVGPUImage2" error message after pod install, could you please help me?

My pod version is 1.2.0.beta.3

How to validate 3-lines MRZ?

Hello @evermeer, awesome work!

I met the challenge - how to validate second line of triple-lined MRZ.
I saw the wikipedia but there is no exhaustive info about how to do that.
And other question... in your MRZ.swift i saw that you extract passportNumber like two leading letters and other is numbers.. where you found this format? I want the same explanation for document number for triple-lined MRZ's.

Thanks in advance!

Possible memory leak or normal behavior

I've just noticed that after each scan the memory allocated is getting 8-10Mb bigger (after about 10 scans memory usage exceeds 100 Mb ). Is it OK, or maybe an issue of Debug Navigator? It seems that when the PassportScannerController dismisses, it has not been fully deallocated. Tesseract cash clean up doesn't help.

Crash while scanning

Hi, I encountered the following error:

2015-12-31 13:47:49.125 PassportScanner[3038:1427113] *** Assertion failure in -[GPUImageFramebuffer unlock], /Users/francis/Downloads/PassportScanner-master/Pods/GPUImage/framework/Source/GPUImageFramebuffer.m:269
2015-12-31 13:47:49.130 PassportScanner[3038:1427113] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Tried to overrelease a framebuffer, did you forget to call -useNextFrameForImageCapture before using -imageFromCurrentFramebuffer?'

Apart from that this is fantastic! Thanks for your work.

Camera Scanning is not clear

I am developing Passport Scanner app by referring PassportScanner program
(https://github.com/evermeer/PassportScanner).
I am testing above code on iPod 5th Gen. But I am facing problem in that, the problem is “camera to scan the MRZ code of a passport”, once it is launched is not coming clear and Pink dots are coming.
How to get clear camera scanning, Do I have to change any camera parameter?
Please help me to improve camera scanning.

passportscanner

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.