Closed muklah closed 4 years ago
Hi @muklah I forgot to add Android Runtime Permission for camera usage on API23 and above. I have push permission fix to master branch. Please pull the latest version of master branch. Could you please confirm it is working fine after getting latest code? Thank you.
Hi @alimertozdemir, well the error of the camera is gone now but there is another problem, when I scan passport it always says invalid mrz:
D/MIDemoApp:CameraSource: Process an image D/MIDemoApp:CameraSource: Process an image D/Camera: app passed NULL surface D/com.alimert.passportreader.mlkit.text.TextRecognitionProcessor: MRZ DATA is not valid D/com.alimert.passportreader.mlkit.text.TextRecognitionProcessor: MRZ DATA is not valid D/com.alimert.passportreader.mlkit.text.TextRecognitionProcessor: MRZ DATA is not valid D/com.alimert.passportreader.mlkit.text.TextRecognitionProcessor: MRZ DATA is not valid D/SemPersonaManager: isNFCAllowed D/ViewRootImpl@c6893e9[MainActivity]: Relayout returned: oldFrame=[0,0][1440,2560] newFrame=[0,0][1440,2560] result=0x7 surface={isValid=true 488536130048} surfaceGenerationChanged=true D/ViewRootImpl@c6893e9[MainActivity]: mHardwareRenderer.initialize() mSurface={isValid=true 488536130048} hwInitialized=true D/mali_winsys: EGLint new_window_surface(egl_winsys_display, void, EGLSurface, EGLConfig, egl_winsys_surface*, egl_color_buffer_format, EGLBoolean) returns 0x3000, [1440x2560]-format:1 D/ViewRootImpl@c6893e9[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 1 mHardwareRenderer.initializeIfNeeded()#2 mSurface={isValid=true 488536130048} V/InputMethodManager: Starting input: tba=android.view.inputmethod.EditorInfo@e9e084d nm : com.alimert.passportreader ic=null I/InputMethodManager: [IMM] startInputInner - mService.startInputOrWindowGainedFocus D/InputTransport: Input channel constructed: fd=79 Input channel destroyed: fd=86 D/SurfaceView: Relayout returned: oldFrame=[0,-192][2560,1728] newFrame=[0,-192][2560,1728] result=0x5 surface={Surface(name=null)/@0x568ff30 isValid=false 0} D/ViewRootImpl@e118e39[CaptureActivity]: mHardwareRenderer.destroy()#1 D/ViewRootImpl@e118e39[CaptureActivity]: Relayout returned: oldFrame=[0,0][2560,1440] newFrame=[0,0][2560,1440] result=0x5 surface={isValid=false 0} surfaceGenerationChanged=true MSG_WINDOW_FOCUS_CHANGED 0 D/Graph: removeVertex() : insertDummyVertex, because there is no ancestor. D/ViewRootImpl@e118e39[CaptureActivity]: mHardwareRenderer.destroy()#4 dispatchDetachedFromWindow D/InputTransport: Input channel destroyed: fd=72
did you check it recently if it works fine while scanning? help me with this please And sure I will confirm it's working!
Are you sure that scanned passport has one the ICAO's MRZ format? https://en.wikipedia.org/wiki/Machine-readable_passport If so, could you provide your passport MRZ Data with changing personal data (like name, surname, birthdate, expireDate to i.e. John Doe, 01.01.1980, etc..)? It is important, please do not send your/someone's any personal info.
Yeah I'm sure, here is the MRZ:
P<IRLOSULLIVAN<<LAURENA<<<<<<<<<<<<<<<<<<<<<< NX50042152IRL9105049F2409154<<<<<<<<<<<<<<<6
I got a passport image from a tutorial and it works with other apps so if you would like me to send this image then I will to try it by yourself
P<IRLOSULLIVAN<<LAURENA<<<<<<<<<<<<<<<<<<<<<< NX50042152IRL9105049F2409154<<<<<<<<<<<<<<<6
https://www.consilium.europa.eu/prado/en/IRL-AD-05001/image-264971.html
With above MRZ data and image from url, it works fine.
I think you have to wait moderate time to complete scan. MLKit scans all text without knowing text format. While text detection has finished, it checks it is correct MRZData with jmrtd library. Could you please add log to TextRecognitionProcessor.java line 152 -> isMrzValid method in order to notify read MRZ text. Or you can send sample image of passport (with sample data), then I can check on my own.
This is exactly the same image that I use to check the app and it's not working with me I add log on method and I get this:
D/com.alimert.passportreader.mlkit.text.TextRecognitionProcessor: isMrzValid: P<IRLOSULLIVAN<<LAUREN<<<<<<<<<<<<<<<<<<<<<K XN500421<62IRL880504<F2309154<<<<<<<<<<<<<<<
Sorry I know that I get a lot of your time
Nop. I think the problem is MLKit text recognition API. Image processing depends on your device camera quality, camera and object distance and sunlight. Could you please follow these steps below, I hope it helps.
I am sorry, i don't know your device specific info (like camera type, processors, rams etc.), so I couldn't help much more. But the problem is text detection on MLKit. I have no solution about Google MLKit text recognition, but please wait for scanning text until validation succeed.
Thanks man I will try these steps and I hope the problem will be fixed
In regards to the premature timeout issue discussed in this thread perhaps increasing timeout will help, some documents appear to take longer with some phones NFC. It was also discussed in similar projects (tananev etc.) For instance, set timeout of 5000 in ReadTask;
private ReadTask(IsoDep isoDep, BACKeySpec bacKey) {
//Increase timeout
isoDep.setTimeout(5000);
this.isoDep = isoDep;
this.bacKey = bacKey;
}
Hi @akeilox, Thank you very much for your contribution. However the problem above was related for text recognition on camera for getting MRZ data. Your solution is fine about reading too much data (takes some time) from passport on nfc.
Hi there! There is a problem with the project while I click on any bottom to start scan I just get this error:
Can you tell me how to fix this please?