Read MRZ

by Andrey Lapshin


Tools

free



Read MRZ is an application, that recognizes two-line Machine Readable Zone (MRZ) using your devices camera.Just place the MRZ lines in the view of the camera so, that it would appear inside the black and white dashed guiding rectangle in the application window.White T-shaped search markers show the area, where the application detects presence of MRZ lines. You may correct the position of the MRZ lines with respect to the guiding rectangle so, that the search markers would line up with them and turn green.The guiding rectangle turns green when the application has found the lines and tries to recognize characters in them.If the application successfully recognizes all characters and finds MRZ structure in the presented lines, then the recognized MRZ lines will appear in the corresponding field in the application window.If you want to pause the recognition process at any time, or start it over, just press the "Play/Pause" button.If you are a developer, who wants to use the recognition result in your application, just launch the Read MRZ application from your application via startActivityForResult() with implicit intent "com.readmrz.conditionalIntents.uniqueActions.READ_MRZ" and, when the recognition is complete, press the "Return result" button in the Read MRZ applications interface. Note that the "Return result" button only appears in the applications interface if the application was launched with the implicit intent by another application.You can obtain the result of the recognition in your application in the onActivityResult() callback via calling the resulting intents getStringArrayExtra() method with the name of the extra data "MRZ lines". The result will be an array of two strings.If the "Return result" button is pressed before a successful recognition is performed, then the "resultCode" in onActivityResult() callback is set to "RESULT_CANCELED" and no resulting intent is supplied.See the code snippet below for detailes on how to use this feature.val READ_MRZ_APP_REQUEST_CODE = 145fun startReadMRZAppForResult() { val intent = Intent("com.readmrz.conditionalIntents.uniqueActions.READ_MRZ") startActivityForResult(intent, READ_MRZ_APP_REQUEST_CODE)}override fun onActivityResult(requestCode: Int, resultCode: Int, resultingIntent: Intent?) { super.onActivityResult(requestCode, resultCode, resultingIntent) if ((requestCode == READ_MRZ_APP_REQUEST_CODE) && (resultCode == RESULT_OK)) { resultingIntent?.getStringArrayExtra("MRZ lines")?.also { val mrzUpperLine = it[0] val mrzLowerLine = it[1] } }}