alimertozdemir / epassportnfcreader Goto Github PK
View Code? Open in Web Editor NEWID Card and E-Passport Reader NFC Android Application - Sample Project with MLKit
ID Card and E-Passport Reader NFC Android Application - Sample Project with MLKit
hi , how can we updated CameraSource class to camera2 coz Camera.CameraInfo.CAMERA_FACING_BACK is deprecated
Hello maintainers,
Is there any license that would apply to this repo? or is it purposely left unlicensed?
Thank you!
Hi i grabbed your project an ran it on my Samsung S8 device and i get an exception when i try to do the NFC conact part on the app using my british passport.
the MRZ scanning seems to work but not the NFC
Full stacktrace below
2021-01-13 16:30:23.885 25172-28874/com.alimert.passportreader W/MainActivity: net.sf.scuba.smartcards.CardServiceException: File not found, CAPDU = 00A4020C02011D, RAPDU = 6A82 (SW = 0x6A82: FILE NOT FOUND)
at org.jmrtd.protocol.ReadBinaryAPDUSender.checkStatusWordAfterFileOperation(ReadBinaryAPDUSender.java:218)
at org.jmrtd.protocol.ReadBinaryAPDUSender.sendSelectFile(ReadBinaryAPDUSender.java:79)
at org.jmrtd.DefaultFileSystem.sendSelectFile(DefaultFileSystem.java:321)
at org.jmrtd.DefaultFileSystem.getFileInfo(DefaultFileSystem.java:272)
at org.jmrtd.DefaultFileSystem.getSelectedPath(DefaultFileSystem.java:129)
at net.sf.scuba.smartcards.CardFileInputStream.<init>(CardFileInputStream.java:60)
at org.jmrtd.PassportService.getInputStream(PassportService.java:595)
at com.alimert.passportreader.ui.MainActivity$ReadTask.doInBackground(MainActivity.java:250)
at com.alimert.passportreader.ui.MainActivity$ReadTask.doInBackground(MainActivity.java:223)
at android.os.AsyncTask$3.call(AsyncTask.java:378)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:289)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)```
I have few units of sony z3 and it appears the ML kit OCR used in this project is not working on a Sony Z3(text/mrz recognition is delayed and even waiting patiently does not complete), but the ML kit implementation used at other similar project (which branched from tananev project too) at https://github.com/jllarraz/AndroidPassportReader seems to work on the same phone with same conditions given (memory, camera etc.)
Is it the drawing on the screen or the different Google ML implementation ?
Hello,
I would like to save the frame the mrz has been taken from.
I've tried to convert the ByteBuffer to a bitmap, but that fails.
Is there a good way to save the frame as a bitmap?
I would really appreciate the help.
Thanks in advance.
We are using this method for commercial purpose:
-is it possible to use it for free?
-doesn't this method block the NFC chip of the passport?
-And any important notes to avoid blocking the chip while testing?
We hope to hear from you soon.
Hello. Why intent data(action) was null. came null. should be android.nfc.action.TECH_DISCOVERED but not it
Hi there!
There is a problem with the project while I click on any bottom to start scan I just get this error:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.alimert.passportreader, PID: 4257
java.lang.RuntimeException: Fail to connect to camera service
at android.hardware.Camera.(Camera.java:519)
at android.hardware.Camera.open(Camera.java:364)
at com.alimert.passportreader.mlkit.camera.CameraSource.createCamera(CameraSource.java:259)
at com.alimert.passportreader.mlkit.camera.CameraSource.start(CameraSource.java:172)
at com.alimert.passportreader.mlkit.camera.CameraSourcePreview.startIfReady(CameraSourcePreview.java:74)
at com.alimert.passportreader.mlkit.camera.CameraSourcePreview.access$200(CameraSourcePreview.java:18)
at com.alimert.passportreader.mlkit.camera.CameraSourcePreview$SurfaceCallback.surfaceCreated(CameraSourcePreview.java:97)
at android.view.SurfaceView.updateWindow(SurfaceView.java:656)
at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:172)
at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:1013)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2506)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1515)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7091)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:927)
at android.view.Choreographer.doCallbacks(Choreographer.java:702)
at android.view.Choreographer.doFrame(Choreographer.java:638)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:913)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6682)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
Can you tell me how to fix this please?
Google mlkit-text-recognition library cannot distinguish 0 from 0. Do you have a solution to this?
Hi , i'm developing React native app to read passport via NFC and write code for Android Native module to read passport and send back data to RN. , I'm able to get Data of DG1 but not getting data of Face image (DG2) , countering
Error parsing DG2: Unexpected exception
i put the logs to check whether BAC is success or not but in BAC auth i'm not getting any issue it means it is success , able to get MRZ from DG1 the only issue is DG2. , below is code .
Can somebody help ?
@alimertozdemir i hope you'll reply asap.
`try {
isoDep.timeout = 50000
val cardService = CardService.getInstance(isoDep)
cardService.open()
val service = PassportService(
cardService,
PassportService.NORMAL_MAX_TRANCEIVE_LENGTH,
PassportService.DEFAULT_MAX_BLOCKSIZE,
false,
false
)
service.open()
val bacKey = BACKey("DocNumberxxxx", "DOBxxx", "DateofExpiry")
service.sendSelectApplet(false)
// Perform BAC
try {
service.doBAC(bacKey)
Log.d(TAG, "BAC was successful")
} catch (e: Exception) {
Log.e(TAG, "BAC failed: ${e.message}")
return e
}
// Reading DG1
val dg1In = service.getInputStream(PassportService.EF_DG1)
dg1File = DG1File(dg1In)
val dg1Data = dg1File.mrzInfo.toString()
Log.d(TAG, "DG1 Data: $dg1Data")
// Reading DG2
try {
val dg2In: CardFileInputStream = service.getInputStream(PassportService.EF_DG2)
val dg2Length = dg2In.length
Log.d(TAG, "DG2 InputStream Length: $dg2Length bytes")
val buffer = ByteArray(dg2Length.toInt())
val bytesRead = dg2In.read(buffer)
Log.d(TAG, "DG2 Bytes Read: $bytesRead bytes")
if (bytesRead > 0) {
// Close the stream and reopen it to reset the read position
dg2In.close()
val dg2InputStream = service.getInputStream(PassportService.EF_DG2)
try {
val dg2File = DG2File(dg2InputStream)
Log.d(TAG, "DG2 Data read successfully")
val faceInfos = dg2File.faceInfos
val allFaceImageInfos: MutableList<FaceImageInfo> = ArrayList()
for (faceInfo in faceInfos) {
allFaceImageInfos.addAll(faceInfo.faceImageInfos)
}
if (allFaceImageInfos.isNotEmpty()) {
val faceImageInfo = allFaceImageInfos.iterator().next()
// Process faceImageInfo as needed
Log.d(TAG, "Face Image Info: ${faceImageInfo}")
}
} catch (e: IOException) {
Log.e(TAG, "Error parsing DG2: ${e.message}")
return e
}
} else {
Log.e(TAG, "DG2 InputStream is empty")
}
} catch (e: IOException) {
Log.e(TAG, "Error reading DG2: ${e.message}")
return e
}
} catch (e: Exception) {
return e
}
return null`
LOGS :
BAC was successful
DG2 Bytes Read: 10368 bytes
Error during reading: Unexpected exception
java.io.IOException: Unexpected exception
// in below line i'm not able to parse data of DG2 , but in stream it is showing bytes.
val dg2File = DG2File(dg2InputStream)
Note : Passport is not corrupted as i'm getting image data in IOS native module with same passport , only android has issue for now
....
Hi, I am new on Nfc and I wonder that is this possiable to read personel info from an ID Card/Passport with just NFC without MRZ? I have tried this but had got some different things.
I'd like to know what are the supported countries for this SDK
Hi! Can we use this nfc reader on national id cards like can I test it with my Turkish id? Because I had some issues and failed getting the results for both scanner and reader
I can get the basic details for the ID and PP, but cant get the additional data on the chip. These are becoming more common with ID or Passport chips where additional info is stored.
It would be great if you can add Additional Details like in the other example (also based on tananev jmrtd)
The passport line 2 regex expects only a numeric character for the second last character of the MRZ. This is incorrect according to the spec (and my passport), which states "Check digit over digits 29โ42 (may be < if all characters are <)". So the regex should be updated from
public static final String PASSPORT_TD_3_LINE_2_REGEX = "([A-Z0-9<]{9})([0-9]{1})([A-Z]{3})([0-9]{6})([0-9]{1})([M|F|X|<]{1})([0-9]{6})([0-9]{1})([A-Z0-9<]{14})([0-9]{1})([0-9]{1})";
to
public static final String PASSPORT_TD_3_LINE_2_REGEX = "([A-Z0-9<]{9})([0-9]{1})([A-Z]{3})([0-9]{6})([0-9]{1})([M|F|X|<]{1})([0-9]{6})([0-9]{1})([A-Z0-9<]{14})([0-9<]{1})([0-9]{1})";
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.