├── .gitignore ├── AWS.md ├── CMakeLists.txt ├── CONTAINER.md ├── Dependencies.md ├── LICENSE ├── PerAppLicense.md ├── README.md ├── SDK_TechnicalGuide_v2.0.pdf ├── VCpp_config.jpg ├── VCsharp_config.jpg ├── assets ├── fonts │ └── OcrB Regular.ttf ├── images │ ├── Czech_passport_2005_MRZ_orient1_1300x1002.jpg │ ├── Czech_passport_2005_MRZ_orient2_1300x1002.jpg │ ├── Czech_passport_2005_MRZ_orient3_1300x1002.jpg │ ├── Czech_passport_2005_MRZ_orient4_1300x1002.jpg │ ├── Czech_passport_2005_MRZ_orient5_1300x1002.jpg │ ├── Czech_passport_2005_MRZ_orient6_1300x1002.jpg │ ├── Czech_passport_2005_MRZ_orient7_1300x1002.jpg │ ├── Czech_passport_2005_MRZ_orient8_1300x1002.jpg │ ├── Passport-Australia_1280x720.jpg │ ├── Passport-Australia_1280x720_rotate+90.jpg │ ├── Passport-Australia_1280x720_rotate-90.jpg │ └── Passport-France_1200x864.jpg ├── models │ ├── mrz.classifier.params.json.doubango │ ├── mrz.classifier.strong.model.flat │ ├── mrz.classifier.strong.pca.json │ └── mrz.traineddata └── samples │ ├── mrva.txt │ ├── mrvb.txt │ ├── td1.txt │ ├── td2.txt │ └── td3.txt ├── binaries ├── README.md ├── android │ ├── README.md │ └── jniLibs │ │ ├── README.md │ │ ├── arm64-v8a │ │ └── libultimateMRZ_SDK.so │ │ ├── armeabi-v7a │ │ └── libultimateMRZ_SDK.so │ │ ├── x86 │ │ └── libultimateMRZ_SDK.so │ │ └── x86_64 │ │ └── libultimateMRZ_SDK.so ├── ios │ ├── README.md │ └── ultimate_mrz-sdk.framework │ │ ├── Headers │ │ └── ultimateMRZ-SDK-API-PUBLIC.h │ │ ├── Info.plist │ │ └── ultimate_mrz-sdk ├── linux │ ├── README.md │ └── x86_64 │ │ ├── benchmark │ │ ├── libultimate_mrz-sdk.so │ │ ├── parser │ │ ├── python_setup.sh │ │ ├── recognizer │ │ ├── runtimeKey │ │ └── validation ├── osx │ └── .gitkeep ├── raspbian │ ├── README.md │ └── armv7l │ │ ├── benchmark │ │ ├── libultimate_mrz-sdk.so │ │ ├── parser │ │ ├── python_setup.sh │ │ ├── recognizer │ │ ├── runtimeKey │ │ └── validation └── windows │ ├── README.md │ └── x86_64 │ ├── benchmark.bat │ ├── benchmark.exe │ ├── parser.bat │ ├── parser.exe │ ├── python_setup.bat │ ├── recognizer.bat │ ├── recognizer.exe │ ├── runtimeKey.bat │ ├── runtimeKey.exe │ ├── runtimeKey_AndroidApp.bat │ ├── ultimateMRZ-SDK.dll │ ├── ultimateMRZ-SDK.lib │ ├── validation.bat │ └── validation.exe ├── c++ ├── README.md └── ultimateMRZ-SDK-API-PUBLIC.h ├── csharp ├── ULTMRZ_SDK_IMAGE_TYPE.cs ├── UltMrzSdkEngine.cs ├── UltMrzSdkResult.cs ├── ultimateMrzSdk.cs └── ultimateMrzSdkPINVOKE.cs ├── java ├── android │ └── org │ │ └── doubango │ │ └── ultimateMrz │ │ └── Sdk │ │ ├── ULTMRZ_SDK_IMAGE_TYPE.java │ │ ├── UltMrzSdkEngine.java │ │ ├── UltMrzSdkResult.java │ │ ├── ultimateMrzSdk.java │ │ ├── ultimateMrzSdkConstants.java │ │ └── ultimateMrzSdkJNI.java └── org │ └── doubango │ └── ultimateMrz │ └── Sdk │ ├── ULTMRZ_SDK_IMAGE_TYPE.java │ ├── UltMrzSdkEngine.java │ ├── UltMrzSdkResult.java │ ├── ultimateMrzSdk.java │ ├── ultimateMrzSdkConstants.java │ └── ultimateMrzSdkJNI.java ├── objc └── objc.i ├── perl ├── perl.i └── ultimateMrzSdk.pm ├── python ├── README.md ├── setup.py ├── ultimateMRZ-SDK-API-PUBLIC-SWIG_python.cxx └── ultimateMrzSdk.py ├── ruby └── ruby.i └── samples ├── CMakeLists.txt ├── README.md ├── android ├── .gitignore ├── .idea │ ├── .name │ ├── codeStyles │ │ └── Project.xml │ ├── compiler.xml │ ├── gradle.xml │ ├── misc.xml │ └── runConfigurations.xml ├── README.md ├── benchmark │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── org │ │ │ └── doubango │ │ │ └── ultimateMrz │ │ │ └── benchmark │ │ │ └── MrzBenchmarkActivity.java │ │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ └── ic_launcher_background.xml │ │ ├── layout │ │ └── activity_main.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml ├── build.gradle ├── common │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── doubango │ │ │ └── ultimateMrz │ │ │ └── common │ │ │ ├── MrzActivity.java │ │ │ ├── MrzAutoFitTextureView.java │ │ │ ├── MrzBackgroundTask.java │ │ │ ├── MrzCameraFragment.java │ │ │ ├── MrzGLSurfaceView.java │ │ │ ├── MrzImage.java │ │ │ ├── MrzLicenseActivator.java │ │ │ ├── MrzUtils.java │ │ │ └── MrzZoneView.java │ │ └── res │ │ ├── drawable-hdpi │ │ ├── ic_action_info.png │ │ ├── ic_launcher.png │ │ ├── ic_launcher_round.png │ │ └── tile.9.png │ │ ├── drawable-mdpi │ │ ├── ic_action_info.png │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── drawable-xhdpi │ │ ├── ic_action_info.png │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── drawable-xxhdpi │ │ ├── ic_action_info.png │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── layout-land │ │ └── fragment_camera.xml │ │ ├── layout │ │ ├── activity_main.xml │ │ └── fragment_camera.xml │ │ ├── values-sw600dp │ │ ├── template-dimens.xml │ │ └── template-styles.xml │ │ ├── values-v11 │ │ └── template-styles.xml │ │ ├── values-v21 │ │ ├── base-colors.xml │ │ └── base-template-styles.xml │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ ├── styles.xml │ │ ├── template-dimens.xml │ │ └── template-styles.xml ├── gradle.properties ├── sdk │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ └── res │ │ └── values │ │ └── strings.xml ├── settings.gradle └── videorecognizer │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── org │ │ └── doubango │ │ └── ultimateMrz │ │ └── videorecognizer │ │ └── MrzVideoRecognizerActivity.java │ └── res │ └── values │ └── base-strings.xml ├── c++ ├── CMakeLists.txt ├── README.md ├── android_utils.h ├── benchmark │ ├── CMakeLists.txt │ ├── README.md │ ├── benchmark.sln │ ├── benchmark.vcxproj │ ├── benchmark.vcxproj.filters │ └── main.cxx ├── mrz_parser.h ├── mrz_utils.h ├── parser │ ├── CMakeLists.txt │ ├── README.md │ ├── main.cxx │ ├── parser.sln │ ├── parser.vcxproj │ └── parser.vcxproj.filters ├── recognizer │ ├── CMakeLists.txt │ ├── README.md │ ├── main.cxx │ ├── recognizer.sln │ ├── recognizer.vcxproj │ └── recognizer.vcxproj.filters ├── runtimeKey │ ├── CMakeLists.txt │ ├── README.md │ ├── main.cxx │ ├── runtimeKey.sln │ ├── runtimeKey.vcxproj │ └── runtimeKey.vcxproj.filters ├── stb_image.h └── validation │ ├── CMakeLists.txt │ ├── README.md │ ├── main.cxx │ ├── validation.vcxproj │ └── validation.vcxproj.filters ├── csharp ├── README.md └── recognizer │ ├── App.config │ ├── Program.cs │ ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ └── Resources.resx │ ├── README.md │ ├── Resources │ └── RecognizerProjectDir.txt │ ├── recognizer.csproj │ └── recognizer.sln ├── ios ├── .gitignore ├── Benchmark │ ├── Benchmark.xcodeproj │ │ ├── project.pbxproj │ │ └── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── Benchmark │ │ ├── AppDelegate.h │ │ ├── AppDelegate.mm │ │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ │ ├── Info.plist │ │ ├── ViewController.h │ │ ├── ViewController.mm │ │ └── main.m ├── README.md └── VideoRecognizer │ ├── VideoRecognizer.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── VideoRecognizer │ ├── AppDelegate.h │ ├── AppDelegate.mm │ ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ ├── ViewController.h │ ├── ViewController.mm │ └── main.m ├── java ├── README.md └── recognizer │ ├── README.md │ ├── Recognizer.bat │ ├── Recognizer.code-workspace │ ├── Recognizer.java │ └── sources.txt └── python ├── README.md └── recognizer ├── README.md ├── recognizer.py ├── run_linux_x64.sh ├── run_rpi_armv7l.sh └── run_windows_x64.bat /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | *.user 3 | *.suo 4 | *.opensdf 5 | *.sdf 6 | *.xcuserdatad 7 | *.DS_Store 8 | /ipch 9 | /x64 10 | *.idb 11 | /Debug 12 | Debug_dynamic 13 | Debug_static 14 | Release 15 | Release_dynamic 16 | Release_static 17 | Debug_sdk 18 | Release_sdk 19 | *.orig 20 | *.tlog 21 | Debug 22 | *.gray 23 | *.yuv 24 | *.rgb 25 | *.ipch 26 | *.opendb 27 | *.db 28 | *.o 29 | *.iws 30 | .idea/tasks.xml 31 | .idea/vcs.xml 32 | .idea/workspace.xml 33 | workspace.xml 34 | local.properties 35 | .gradle 36 | gradle 37 | gradlew 38 | gradlew.bat 39 | build 40 | gen 41 | out 42 | .externalNativeBuild 43 | My Amplifier XE Results* 44 | My Advisor Results* 45 | *.rbg 46 | /.vs/config 47 | /vs_android/.vs 48 | /docs/*.odt# 49 | /vs_android/.workspace 50 | 51 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0) 2 | 3 | add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/samples) -------------------------------------------------------------------------------- /CONTAINER.md: -------------------------------------------------------------------------------- 1 | - [The issue](#container-issue) 2 | - [The solution](#container-solution) 3 | - [Pull your image (optional)](#container-solution-pull) 4 | - [Run a container](#container-solution-run) 5 | - [Setup (inside the container)](#container-solution-setup) 6 | 7 |
8 | 9 | This document explains how to run a licensed version of the SDK inside a container. You can ignore it if you're using the trial version. 10 | 11 | As explained at [https://www.doubango.org/pricing.html](https://www.doubango.org/pricing.html) our licensing model is per device/machine. 12 | Each machine is uniquely identified using the hardware information (CPU model, motherboard, architecture, hard drive serial number...). The hardware information doesn't change even if the OS is (up/down)-graded or reinstalled. We don't use network information like the MAC address to make sure the SDK can work without [NIC](https://en.wikipedia.org/wiki/Network_interface_controller). 13 | 14 | [The machine's unique identifier](https://www.doubango.org/SDKs/LicenseManager/docs/Jargon.html#runtime-key) is built from the hardware information and generated as base64 encrypted key using the [runtimeKey](samples/c++/runtimeKey/) application. You don't need to build the application by yourself, use the pre-built [binaries](binaries). 15 | Once you have the [runtime key](https://www.doubango.org/SDKs/LicenseManager/docs/Jargon.html#runtime-key) you can generate the [token (license)](https://www.doubango.org/SDKs/LicenseManager/docs/Jargon.html#token) using the [activation](https://www.doubango.org/SDKs/LicenseManager/docs/Activation_use_cases.html) function. More information about the process at [https://www.doubango.org/SDKs/LicenseManager/docs/](https://www.doubango.org/SDKs/LicenseManager/docs/). 16 | 17 | This document is about using [docker](https://www.docker.com/) containers on Ubuntu 18. Please [contact us](https://www.doubango.org/#contact) for any other scenario. 18 | 19 | 20 | # The issue # 21 | The problem with a container or any virtual machine is that you don't have access to the devices (hard drive, usb...) attached to the host machine. 22 | It's possible to run a container as super user using `--privileged` option in order to have complet access to the host but we are avoiding it for obvious reasons. 23 | 24 | 25 | # The solution # 26 | A container can have access to the CPU information used by our license manager but not to the information related to the hard drive or motherboard. The solution is to give a container the rights to have access to the missing information. 27 | **We only provide read only access for security reasons and we highly recommend running the container as non root user.** 28 | 29 | We consider you already have [docker](https://www.docker.com/) correctly installed. If not, we recommend the guide at https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-18-04. 30 | 31 | 32 | ## Pull your image (optional) ## 33 | Only required if you don't already have your own image. In our case we are using `ubuntu` image. 34 | 35 | ``` 36 | docker pull ubuntu 37 | ``` 38 | To check that the image is correctly downloaded: `docker images`. 39 | 40 | 41 | ## Run a container ## 42 | To run a container using the previously downloaded image (`ubuntu`) you'll need some additional parameters. 43 | The command: 44 | ``` 45 | docker run -v /run/udev:/run/udev:ro -v /dev:/dev:ro -it ubuntu 46 | ``` 47 | - `-v /run/udev:/run/udev:ro`: The format is "name of the volume to mount:the destination:the access rights". In this case we need `ro` (read-only) access rights. More info at https://docs.docker.com/storage/volumes/ 48 | - `-v /dev:/dev:ro`: See above 49 | 50 | In short, we want to allow the [udev](https://en.wikipedia.org/wiki/Udev) tool running inside a container to get access to the hardware information on the host. [udev](https://en.wikipedia.org/wiki/Udev) runs on userspace and doesn't require root access. The SDK will run `udevadm info --query=property --name=...` to retrieve hardware information. You can run the same command inside the container to check if the SDK will succeed. 51 | 52 | 53 | ## Setup (inside the container) ## 54 | - Update: 55 | ``` 56 | apt update 57 | ``` 58 | - Install [udev](https://en.wikipedia.org/wiki/Udev): 59 | ``` 60 | apt install udev 61 | ``` 62 | 63 | That's it, now you're ready to run the [runtimeKey](samples/c++/runtimeKey/) application to generate the [runtime key](https://www.doubango.org/SDKs/LicenseManager/docs/Jargon.html#runtime-key) for [activation](https://www.doubango.org/SDKs/LicenseManager/docs/Activation_use_cases.html). 64 | -------------------------------------------------------------------------------- /Dependencies.md: -------------------------------------------------------------------------------- 1 | 2 | # Dependencies # 3 | **The SDK is developed in C++11** and you'll need **glibc 2.27+** on *Linux* and **[Microsoft Visual C++ 2015 Redistributable(x64) - 14.0.24123](https://www.microsoft.com/en-us/download/details.aspx?id=52685)** (any later version is ok) on *Windows*. **You most likely already have these dependencies on you machine** as almost every program require it. 4 | 5 | 6 | 7 | ## Debugging missing dependencies ## 8 | To check if all dependencies are present: 9 | - **Windows x86_64:** Use [Dependency Walker](https://www.dependencywalker.com/) on [binaries/windows/x86_64/ultimateMRZ-SDK.dll](../../../binaries/windows/x86_64/ultimateMRZ-SDK.dll). 10 | - **Linux x86_64:** Use `ldd ` on [binaries/linux/x86_64/libultimate_mrz-sdk.so](../../../binaries/linux/x86_64/libultimate_mrz-sdk.so). 11 | 12 | ## Known issues ## 13 | On Windows you may have `The code execution cannot proceed because MSVCP140.dll was not found. Reinstalling the program may fix the problem.` message if **[Microsoft Visual C++ 2015 Redistributable(x64) - 14.0.24123](https://www.microsoft.com/en-us/download/details.aspx?id=52685)** is missing. 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2011-2019 Doubango Telecom 2 | 3 | For non commercial use only. 4 | 5 | Please contact us at https://www.doubango.org/#contact for commercial version. -------------------------------------------------------------------------------- /PerAppLicense.md: -------------------------------------------------------------------------------- 1 | - [Android](#android) 2 | - [License format](#android-license-format) 3 | - [The application identifier](#android-license-format-appid) 4 | - [List of installers](#android-license-format-installers) 5 | - [Signing certificate's fingerprint (SHA256)](#android-license-format-fingerprint) 6 | - [License generation](#android-license-generation) 7 | - [License deployment](#android-license-deployment) 8 | - [iOS](#ios) 9 | 10 |
11 | 12 | Starting version **v2.10.0** we have added support for application-wide licenses. This kind of license is attached to an application identifier rather than a device. 13 | This is suitable for applications distributed via Google Play or any other store with no limitation on the number of devices. 14 | 15 | 16 | # Android # 17 | Everything related to the license is done in C++ to make it harder to decompile. 18 | 19 | 20 | ## License format ## 21 | The license is a base64 encrypted string containing 3 elements: 22 | - The application identifier 23 | - The list of allowed installers (stores) 24 | - The signing certificate's fingerprint 25 | 26 | At runtime we'll check that: 27 | - the application identifier matches the one in the license string `check #1` 28 | - the application was signed using the same signature stored in the license string `check #2` 29 | - the application was installed from a store listed in the license string (Google Play, Amazon, Huawei...) `check #3` 30 | 31 | The above checks means you'll not be able to test a license while developing your app unless the app is deployed and installed from a store. You'll be able to pass `check #1` and `check #2` but not `check #3` if the license is correctly configured. We offer (free) #3 device-based licenses to help you test your app. 32 | 33 | 34 | ### The application identifier (SHA256) ### 35 | The application identifier is in your `build.gradle` at `android {` -> `defaultConfig {` -> `applicationId "<< your appid here >>"`. **The license will no longer work if you change this identifier**. This identifier must remain the same for the application's lifetime. 36 | Example -> https://github.com/DoubangoTelecom/ultimateMRZ-SDK/blob/68c998b3d8ed4f5e0a71fdac3bc04f3f79352224/samples/android/videorecognizer/build.gradle#L8. 37 | 38 | 39 | ### List of installers ### 40 | The license will only work with applications installed from a registered store. By default, we support **Google Play, Amazon and Huawei** stores. New stores can be added on request. 41 | 42 | 43 | ### Signing certificate's fingerprint ### 44 | An application must be signed before deploying it on a store. The signing keys must remain the same for the application's lifetime. By default these keys are [valid for at least 25 years](https://developer.android.com/studio/publish/app-signing#:~:text=Your%20key%20should%20be%20valid,about%20yourself%20for%20your%20certificate.). 45 | 46 | Please note that the dev (debug) keys used to sign an application are not valid for the app stores. On Windows, the dev keystore is at `C:\Users\<>\.android\debug.keystore`. Please do not use that keystore for license generation. 47 | 48 | We'll need the certificate's fingerprint (**SHA256**) to generate your license. The fingerprint could be generated using the following command: `keytool -list -v -keystore -alias -storepass -keypass `. Example: `keytool -list -v -keystore "C:\Projects\AndroidKeystore\android_keystore.jks" -alias myalias -storepass mypass1 -keypass mypass2`. 49 | 50 | For information on how to retrive the certificate's fingerprint: https://help.short.io/en/articles/4171170-where-to-find-android-app-package-name-and-sha256-fingerprint-certificate 51 | 52 | 53 | ## License generation ## 54 | In order to generate a license for your application we'll need 2 elements: 55 | - The application identifier 56 | - The certificate's fingerprint (SHA-256) 57 | 58 | 59 | ## License deployment ## 60 | The license is a base64 encrypted string. It could be stored in a file and loaded at runtime or hard-coded. JSON configuration entry [license_token_data](https://www.doubango.org/SDKs/mrz/docs/Configuration_options.html#license-token-data) is used to pass the license to the MRZ engine in order to unlock the SDK. 61 | 62 | 63 | # iOS # 64 | Coming soon... 65 | -------------------------------------------------------------------------------- /SDK_TechnicalGuide_v2.0.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/SDK_TechnicalGuide_v2.0.pdf -------------------------------------------------------------------------------- /VCpp_config.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/VCpp_config.jpg -------------------------------------------------------------------------------- /VCsharp_config.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/VCsharp_config.jpg -------------------------------------------------------------------------------- /assets/fonts/OcrB Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/assets/fonts/OcrB Regular.ttf -------------------------------------------------------------------------------- /assets/images/Czech_passport_2005_MRZ_orient1_1300x1002.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/assets/images/Czech_passport_2005_MRZ_orient1_1300x1002.jpg -------------------------------------------------------------------------------- /assets/images/Czech_passport_2005_MRZ_orient2_1300x1002.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/assets/images/Czech_passport_2005_MRZ_orient2_1300x1002.jpg -------------------------------------------------------------------------------- /assets/images/Czech_passport_2005_MRZ_orient3_1300x1002.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/assets/images/Czech_passport_2005_MRZ_orient3_1300x1002.jpg -------------------------------------------------------------------------------- /assets/images/Czech_passport_2005_MRZ_orient4_1300x1002.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/assets/images/Czech_passport_2005_MRZ_orient4_1300x1002.jpg -------------------------------------------------------------------------------- /assets/images/Czech_passport_2005_MRZ_orient5_1300x1002.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/assets/images/Czech_passport_2005_MRZ_orient5_1300x1002.jpg -------------------------------------------------------------------------------- /assets/images/Czech_passport_2005_MRZ_orient6_1300x1002.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/assets/images/Czech_passport_2005_MRZ_orient6_1300x1002.jpg -------------------------------------------------------------------------------- /assets/images/Czech_passport_2005_MRZ_orient7_1300x1002.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/assets/images/Czech_passport_2005_MRZ_orient7_1300x1002.jpg -------------------------------------------------------------------------------- /assets/images/Czech_passport_2005_MRZ_orient8_1300x1002.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/assets/images/Czech_passport_2005_MRZ_orient8_1300x1002.jpg -------------------------------------------------------------------------------- /assets/images/Passport-Australia_1280x720.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/assets/images/Passport-Australia_1280x720.jpg -------------------------------------------------------------------------------- /assets/images/Passport-Australia_1280x720_rotate+90.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/assets/images/Passport-Australia_1280x720_rotate+90.jpg -------------------------------------------------------------------------------- /assets/images/Passport-Australia_1280x720_rotate-90.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/assets/images/Passport-Australia_1280x720_rotate-90.jpg -------------------------------------------------------------------------------- /assets/images/Passport-France_1200x864.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/assets/images/Passport-France_1200x864.jpg -------------------------------------------------------------------------------- /assets/models/mrz.classifier.params.json.doubango: -------------------------------------------------------------------------------- 1 | ultimateMRZ-----dhF(+#oo`zVp`~W+)-)B ,/) bdjo~WdfQI*6+) dcc.)0 9 ((nMFfv{]KL^{Vhl|dbpbhc( 3!F{MWtOB(piqdll"3,; 1$La 8#nm_'se|tgck/:),]vei#;/1{:ea%bat%LZU'! !i5wkkn"sa)'l}## #/!.d!9>>';i^ccahfirdphbbRal~raf&Czh&M6Qpu#$ --mF6<50gj~lh`on|Zkx}ecgl (2%]k ,n*%(%.elodo <;?ZBh~mabYpxxh.-1 nZb|"'bhHmh(ic_gcdhbpqcJNN2_X) ##)%U# $`NZ^bek=)+ohx"!4!><*BhXOLA,W]dTlf^ztudbk#?%pVTc&+2GJ 2 |  heU~`eo':j\LFfeKAKg_mvylue`coBFHCa 3 | MciIhk"gu|Vkce!@RK@"4<'$"zifkl|W* MWB[NE*99' x  -------------------------------------------------------------------------------- /assets/models/mrz.classifier.strong.model.flat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/assets/models/mrz.classifier.strong.model.flat -------------------------------------------------------------------------------- /assets/models/mrz.traineddata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/assets/models/mrz.traineddata -------------------------------------------------------------------------------- /assets/samples/mrva.txt: -------------------------------------------------------------------------------- 1 | V= 0 && swigValues[swigValue].swigValue == swigValue) 31 | return swigValues[swigValue]; 32 | for (ULTMRZ_SDK_IMAGE_TYPE swigEnum : swigValues) 33 | if (swigEnum.swigValue == swigValue) 34 | return swigEnum; 35 | throw new IllegalArgumentException("No enum " + ULTMRZ_SDK_IMAGE_TYPE.class + " with value " + swigValue); 36 | } 37 | 38 | @SuppressWarnings("unused") 39 | private ULTMRZ_SDK_IMAGE_TYPE() { 40 | this.swigValue = SwigNext.next++; 41 | } 42 | 43 | @SuppressWarnings("unused") 44 | private ULTMRZ_SDK_IMAGE_TYPE(int swigValue) { 45 | this.swigValue = swigValue; 46 | SwigNext.next = swigValue+1; 47 | } 48 | 49 | @SuppressWarnings("unused") 50 | private ULTMRZ_SDK_IMAGE_TYPE(ULTMRZ_SDK_IMAGE_TYPE swigEnum) { 51 | this.swigValue = swigEnum.swigValue; 52 | SwigNext.next = this.swigValue+1; 53 | } 54 | 55 | private final int swigValue; 56 | 57 | private static class SwigNext { 58 | private static int next = 0; 59 | } 60 | } 61 | 62 | -------------------------------------------------------------------------------- /java/android/org/doubango/ultimateMrz/Sdk/UltMrzSdkResult.java: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------------- 2 | * This file was automatically generated by SWIG (http://www.swig.org). 3 | * Version 2.0.9 4 | * 5 | * Do not make changes to this file unless you know what you are doing--modify 6 | * the SWIG interface file instead. 7 | * ----------------------------------------------------------------------------- */ 8 | 9 | package org.doubango.ultimateMrz.Sdk; 10 | 11 | public class UltMrzSdkResult { 12 | private long swigCPtr; 13 | protected boolean swigCMemOwn; 14 | 15 | protected UltMrzSdkResult(long cPtr, boolean cMemoryOwn) { 16 | swigCMemOwn = cMemoryOwn; 17 | swigCPtr = cPtr; 18 | } 19 | 20 | protected static long getCPtr(UltMrzSdkResult obj) { 21 | return (obj == null) ? 0 : obj.swigCPtr; 22 | } 23 | 24 | protected void finalize() { 25 | delete(); 26 | } 27 | 28 | public synchronized void delete() { 29 | if (swigCPtr != 0) { 30 | if (swigCMemOwn) { 31 | swigCMemOwn = false; 32 | ultimateMrzSdkJNI.delete_UltMrzSdkResult(swigCPtr); 33 | } 34 | swigCPtr = 0; 35 | } 36 | } 37 | 38 | public UltMrzSdkResult() { 39 | this(ultimateMrzSdkJNI.new_UltMrzSdkResult__SWIG_0(), true); 40 | } 41 | 42 | public UltMrzSdkResult(int code, String phrase, String json, long numZones) { 43 | this(ultimateMrzSdkJNI.new_UltMrzSdkResult__SWIG_1(code, phrase, json, numZones), true); 44 | } 45 | 46 | public UltMrzSdkResult(int code, String phrase, String json) { 47 | this(ultimateMrzSdkJNI.new_UltMrzSdkResult__SWIG_2(code, phrase, json), true); 48 | } 49 | 50 | public UltMrzSdkResult(UltMrzSdkResult other) { 51 | this(ultimateMrzSdkJNI.new_UltMrzSdkResult__SWIG_3(UltMrzSdkResult.getCPtr(other), other), true); 52 | } 53 | 54 | public int code() { 55 | return ultimateMrzSdkJNI.UltMrzSdkResult_code(swigCPtr, this); 56 | } 57 | 58 | public String phrase() { 59 | return ultimateMrzSdkJNI.UltMrzSdkResult_phrase(swigCPtr, this); 60 | } 61 | 62 | public String json() { 63 | return ultimateMrzSdkJNI.UltMrzSdkResult_json(swigCPtr, this); 64 | } 65 | 66 | public long numZones() { 67 | return ultimateMrzSdkJNI.UltMrzSdkResult_numZones(swigCPtr, this); 68 | } 69 | 70 | public boolean isOK() { 71 | return ultimateMrzSdkJNI.UltMrzSdkResult_isOK(swigCPtr, this); 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /java/android/org/doubango/ultimateMrz/Sdk/ultimateMrzSdk.java: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------------- 2 | * This file was automatically generated by SWIG (http://www.swig.org). 3 | * Version 2.0.9 4 | * 5 | * Do not make changes to this file unless you know what you are doing--modify 6 | * the SWIG interface file instead. 7 | * ----------------------------------------------------------------------------- */ 8 | 9 | package org.doubango.ultimateMrz.Sdk; 10 | 11 | public class ultimateMrzSdk implements ultimateMrzSdkConstants { 12 | } 13 | -------------------------------------------------------------------------------- /java/android/org/doubango/ultimateMrz/Sdk/ultimateMrzSdkConstants.java: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------------- 2 | * This file was automatically generated by SWIG (http://www.swig.org). 3 | * Version 2.0.9 4 | * 5 | * Do not make changes to this file unless you know what you are doing--modify 6 | * the SWIG interface file instead. 7 | * ----------------------------------------------------------------------------- */ 8 | 9 | package org.doubango.ultimateMrz.Sdk; 10 | 11 | public interface ultimateMrzSdkConstants { 12 | public final static int ULTMRZ_SDK_VERSION_MAJOR = 2; 13 | public final static int ULTMRZ_SDK_VERSION_MINOR = 9; 14 | public final static int ULTMRZ_SDK_VERSION_MICRO = 0; 15 | } 16 | -------------------------------------------------------------------------------- /java/android/org/doubango/ultimateMrz/Sdk/ultimateMrzSdkJNI.java: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------------- 2 | * This file was automatically generated by SWIG (http://www.swig.org). 3 | * Version 2.0.9 4 | * 5 | * Do not make changes to this file unless you know what you are doing--modify 6 | * the SWIG interface file instead. 7 | * ----------------------------------------------------------------------------- */ 8 | 9 | package org.doubango.ultimateMrz.Sdk; 10 | 11 | public class ultimateMrzSdkJNI { 12 | 13 | static { 14 | System.loadLibrary("ultimateMRZ_SDK"); 15 | } 16 | 17 | public final static native long new_UltMrzSdkResult__SWIG_0(); 18 | public final static native long new_UltMrzSdkResult__SWIG_1(int jarg1, String jarg2, String jarg3, long jarg4); 19 | public final static native long new_UltMrzSdkResult__SWIG_2(int jarg1, String jarg2, String jarg3); 20 | public final static native long new_UltMrzSdkResult__SWIG_3(long jarg1, UltMrzSdkResult jarg1_); 21 | public final static native void delete_UltMrzSdkResult(long jarg1); 22 | public final static native int UltMrzSdkResult_code(long jarg1, UltMrzSdkResult jarg1_); 23 | public final static native String UltMrzSdkResult_phrase(long jarg1, UltMrzSdkResult jarg1_); 24 | public final static native String UltMrzSdkResult_json(long jarg1, UltMrzSdkResult jarg1_); 25 | public final static native long UltMrzSdkResult_numZones(long jarg1, UltMrzSdkResult jarg1_); 26 | public final static native boolean UltMrzSdkResult_isOK(long jarg1, UltMrzSdkResult jarg1_); 27 | public final static native long UltMrzSdkEngine_init__SWIG_0(Object jarg1, String jarg2); 28 | public final static native long UltMrzSdkEngine_init__SWIG_1(Object jarg1); 29 | public final static native long UltMrzSdkEngine_deInit(); 30 | public final static native long UltMrzSdkEngine_process__SWIG_0(int jarg1, java.nio.ByteBuffer jarg2, long jarg3, long jarg4, long jarg5, int jarg6); 31 | public final static native long UltMrzSdkEngine_process__SWIG_1(int jarg1, java.nio.ByteBuffer jarg2, long jarg3, long jarg4, long jarg5); 32 | public final static native long UltMrzSdkEngine_process__SWIG_2(int jarg1, java.nio.ByteBuffer jarg2, long jarg3, long jarg4); 33 | public final static native long UltMrzSdkEngine_process__SWIG_3(int jarg1, java.nio.ByteBuffer jarg2, java.nio.ByteBuffer jarg3, java.nio.ByteBuffer jarg4, long jarg5, long jarg6, long jarg7, long jarg8, long jarg9, long jarg10, int jarg11); 34 | public final static native long UltMrzSdkEngine_process__SWIG_4(int jarg1, java.nio.ByteBuffer jarg2, java.nio.ByteBuffer jarg3, java.nio.ByteBuffer jarg4, long jarg5, long jarg6, long jarg7, long jarg8, long jarg9, long jarg10); 35 | public final static native long UltMrzSdkEngine_process__SWIG_5(int jarg1, java.nio.ByteBuffer jarg2, java.nio.ByteBuffer jarg3, java.nio.ByteBuffer jarg4, long jarg5, long jarg6, long jarg7, long jarg8, long jarg9); 36 | public final static native int UltMrzSdkEngine_exifOrientation(java.nio.ByteBuffer jarg1, long jarg2); 37 | public final static native long UltMrzSdkEngine_requestRuntimeLicenseKey__SWIG_0(boolean jarg1); 38 | public final static native long UltMrzSdkEngine_requestRuntimeLicenseKey__SWIG_1(); 39 | public final static native void delete_UltMrzSdkEngine(long jarg1); 40 | } 41 | -------------------------------------------------------------------------------- /java/org/doubango/ultimateMrz/Sdk/ULTMRZ_SDK_IMAGE_TYPE.java: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------------- 2 | * This file was automatically generated by SWIG (http://www.swig.org). 3 | * Version 2.0.9 4 | * 5 | * Do not make changes to this file unless you know what you are doing--modify 6 | * the SWIG interface file instead. 7 | * ----------------------------------------------------------------------------- */ 8 | 9 | package org.doubango.ultimateMrz.Sdk; 10 | 11 | public enum ULTMRZ_SDK_IMAGE_TYPE { 12 | ULTMRZ_SDK_IMAGE_TYPE_RGB24, 13 | ULTMRZ_SDK_IMAGE_TYPE_RGBA32, 14 | ULTMRZ_SDK_IMAGE_TYPE_BGRA32, 15 | ULTMRZ_SDK_IMAGE_TYPE_NV12, 16 | ULTMRZ_SDK_IMAGE_TYPE_NV21, 17 | ULTMRZ_SDK_IMAGE_TYPE_YUV420P, 18 | ULTMRZ_SDK_IMAGE_TYPE_YVU420P, 19 | ULTMRZ_SDK_IMAGE_TYPE_YUV422P, 20 | ULTMRZ_SDK_IMAGE_TYPE_YUV444P, 21 | ULTMRZ_SDK_IMAGE_TYPE_Y, 22 | ULTMRZ_SDK_IMAGE_TYPE_BGR24; 23 | 24 | public final int swigValue() { 25 | return swigValue; 26 | } 27 | 28 | public static ULTMRZ_SDK_IMAGE_TYPE swigToEnum(int swigValue) { 29 | ULTMRZ_SDK_IMAGE_TYPE[] swigValues = ULTMRZ_SDK_IMAGE_TYPE.class.getEnumConstants(); 30 | if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue) 31 | return swigValues[swigValue]; 32 | for (ULTMRZ_SDK_IMAGE_TYPE swigEnum : swigValues) 33 | if (swigEnum.swigValue == swigValue) 34 | return swigEnum; 35 | throw new IllegalArgumentException("No enum " + ULTMRZ_SDK_IMAGE_TYPE.class + " with value " + swigValue); 36 | } 37 | 38 | @SuppressWarnings("unused") 39 | private ULTMRZ_SDK_IMAGE_TYPE() { 40 | this.swigValue = SwigNext.next++; 41 | } 42 | 43 | @SuppressWarnings("unused") 44 | private ULTMRZ_SDK_IMAGE_TYPE(int swigValue) { 45 | this.swigValue = swigValue; 46 | SwigNext.next = swigValue+1; 47 | } 48 | 49 | @SuppressWarnings("unused") 50 | private ULTMRZ_SDK_IMAGE_TYPE(ULTMRZ_SDK_IMAGE_TYPE swigEnum) { 51 | this.swigValue = swigEnum.swigValue; 52 | SwigNext.next = this.swigValue+1; 53 | } 54 | 55 | private final int swigValue; 56 | 57 | private static class SwigNext { 58 | private static int next = 0; 59 | } 60 | } 61 | 62 | -------------------------------------------------------------------------------- /java/org/doubango/ultimateMrz/Sdk/UltMrzSdkEngine.java: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------------- 2 | * This file was automatically generated by SWIG (http://www.swig.org). 3 | * Version 2.0.9 4 | * 5 | * Do not make changes to this file unless you know what you are doing--modify 6 | * the SWIG interface file instead. 7 | * ----------------------------------------------------------------------------- */ 8 | 9 | package org.doubango.ultimateMrz.Sdk; 10 | 11 | public class UltMrzSdkEngine { 12 | private long swigCPtr; 13 | protected boolean swigCMemOwn; 14 | 15 | protected UltMrzSdkEngine(long cPtr, boolean cMemoryOwn) { 16 | swigCMemOwn = cMemoryOwn; 17 | swigCPtr = cPtr; 18 | } 19 | 20 | protected static long getCPtr(UltMrzSdkEngine obj) { 21 | return (obj == null) ? 0 : obj.swigCPtr; 22 | } 23 | 24 | protected void finalize() { 25 | delete(); 26 | } 27 | 28 | public synchronized void delete() { 29 | if (swigCPtr != 0) { 30 | if (swigCMemOwn) { 31 | swigCMemOwn = false; 32 | ultimateMrzSdkJNI.delete_UltMrzSdkEngine(swigCPtr); 33 | } 34 | swigCPtr = 0; 35 | } 36 | } 37 | 38 | public static UltMrzSdkResult init(String jsonConfig) { 39 | return new UltMrzSdkResult(ultimateMrzSdkJNI.UltMrzSdkEngine_init__SWIG_0(jsonConfig), true); 40 | } 41 | 42 | public static UltMrzSdkResult init() { 43 | return new UltMrzSdkResult(ultimateMrzSdkJNI.UltMrzSdkEngine_init__SWIG_1(), true); 44 | } 45 | 46 | public static UltMrzSdkResult deInit() { 47 | return new UltMrzSdkResult(ultimateMrzSdkJNI.UltMrzSdkEngine_deInit(), true); 48 | } 49 | 50 | public static UltMrzSdkResult process(ULTMRZ_SDK_IMAGE_TYPE imageType, java.nio.ByteBuffer imageData, long imageWidthInSamples, long imageHeightInSamples, long imageStrideInSamples, int imageExifOrientation) { 51 | return new UltMrzSdkResult(ultimateMrzSdkJNI.UltMrzSdkEngine_process__SWIG_0(imageType.swigValue(), imageData, imageWidthInSamples, imageHeightInSamples, imageStrideInSamples, imageExifOrientation), true); 52 | } 53 | 54 | public static UltMrzSdkResult process(ULTMRZ_SDK_IMAGE_TYPE imageType, java.nio.ByteBuffer imageData, long imageWidthInSamples, long imageHeightInSamples, long imageStrideInSamples) { 55 | return new UltMrzSdkResult(ultimateMrzSdkJNI.UltMrzSdkEngine_process__SWIG_1(imageType.swigValue(), imageData, imageWidthInSamples, imageHeightInSamples, imageStrideInSamples), true); 56 | } 57 | 58 | public static UltMrzSdkResult process(ULTMRZ_SDK_IMAGE_TYPE imageType, java.nio.ByteBuffer imageData, long imageWidthInSamples, long imageHeightInSamples) { 59 | return new UltMrzSdkResult(ultimateMrzSdkJNI.UltMrzSdkEngine_process__SWIG_2(imageType.swigValue(), imageData, imageWidthInSamples, imageHeightInSamples), true); 60 | } 61 | 62 | public static UltMrzSdkResult process(ULTMRZ_SDK_IMAGE_TYPE imageType, java.nio.ByteBuffer yPtr, java.nio.ByteBuffer uPtr, java.nio.ByteBuffer vPtr, long widthInSamples, long heightInSamples, long yStrideInBytes, long uStrideInBytes, long vStrideInBytes, long uvPixelStrideInBytes, int exifOrientation) { 63 | return new UltMrzSdkResult(ultimateMrzSdkJNI.UltMrzSdkEngine_process__SWIG_3(imageType.swigValue(), yPtr, uPtr, vPtr, widthInSamples, heightInSamples, yStrideInBytes, uStrideInBytes, vStrideInBytes, uvPixelStrideInBytes, exifOrientation), true); 64 | } 65 | 66 | public static UltMrzSdkResult process(ULTMRZ_SDK_IMAGE_TYPE imageType, java.nio.ByteBuffer yPtr, java.nio.ByteBuffer uPtr, java.nio.ByteBuffer vPtr, long widthInSamples, long heightInSamples, long yStrideInBytes, long uStrideInBytes, long vStrideInBytes, long uvPixelStrideInBytes) { 67 | return new UltMrzSdkResult(ultimateMrzSdkJNI.UltMrzSdkEngine_process__SWIG_4(imageType.swigValue(), yPtr, uPtr, vPtr, widthInSamples, heightInSamples, yStrideInBytes, uStrideInBytes, vStrideInBytes, uvPixelStrideInBytes), true); 68 | } 69 | 70 | public static UltMrzSdkResult process(ULTMRZ_SDK_IMAGE_TYPE imageType, java.nio.ByteBuffer yPtr, java.nio.ByteBuffer uPtr, java.nio.ByteBuffer vPtr, long widthInSamples, long heightInSamples, long yStrideInBytes, long uStrideInBytes, long vStrideInBytes) { 71 | return new UltMrzSdkResult(ultimateMrzSdkJNI.UltMrzSdkEngine_process__SWIG_5(imageType.swigValue(), yPtr, uPtr, vPtr, widthInSamples, heightInSamples, yStrideInBytes, uStrideInBytes, vStrideInBytes), true); 72 | } 73 | 74 | public static int exifOrientation(java.nio.ByteBuffer jpegMetaDataPtr, long jpegMetaDataSize) { 75 | return ultimateMrzSdkJNI.UltMrzSdkEngine_exifOrientation(jpegMetaDataPtr, jpegMetaDataSize); 76 | } 77 | 78 | public static UltMrzSdkResult requestRuntimeLicenseKey(boolean rawInsteadOfJSON) { 79 | return new UltMrzSdkResult(ultimateMrzSdkJNI.UltMrzSdkEngine_requestRuntimeLicenseKey__SWIG_0(rawInsteadOfJSON), true); 80 | } 81 | 82 | public static UltMrzSdkResult requestRuntimeLicenseKey() { 83 | return new UltMrzSdkResult(ultimateMrzSdkJNI.UltMrzSdkEngine_requestRuntimeLicenseKey__SWIG_1(), true); 84 | } 85 | 86 | } 87 | -------------------------------------------------------------------------------- /java/org/doubango/ultimateMrz/Sdk/UltMrzSdkResult.java: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------------- 2 | * This file was automatically generated by SWIG (http://www.swig.org). 3 | * Version 2.0.9 4 | * 5 | * Do not make changes to this file unless you know what you are doing--modify 6 | * the SWIG interface file instead. 7 | * ----------------------------------------------------------------------------- */ 8 | 9 | package org.doubango.ultimateMrz.Sdk; 10 | 11 | public class UltMrzSdkResult { 12 | private long swigCPtr; 13 | protected boolean swigCMemOwn; 14 | 15 | protected UltMrzSdkResult(long cPtr, boolean cMemoryOwn) { 16 | swigCMemOwn = cMemoryOwn; 17 | swigCPtr = cPtr; 18 | } 19 | 20 | protected static long getCPtr(UltMrzSdkResult obj) { 21 | return (obj == null) ? 0 : obj.swigCPtr; 22 | } 23 | 24 | protected void finalize() { 25 | delete(); 26 | } 27 | 28 | public synchronized void delete() { 29 | if (swigCPtr != 0) { 30 | if (swigCMemOwn) { 31 | swigCMemOwn = false; 32 | ultimateMrzSdkJNI.delete_UltMrzSdkResult(swigCPtr); 33 | } 34 | swigCPtr = 0; 35 | } 36 | } 37 | 38 | public UltMrzSdkResult() { 39 | this(ultimateMrzSdkJNI.new_UltMrzSdkResult__SWIG_0(), true); 40 | } 41 | 42 | public UltMrzSdkResult(int code, String phrase, String json, long numZones) { 43 | this(ultimateMrzSdkJNI.new_UltMrzSdkResult__SWIG_1(code, phrase, json, numZones), true); 44 | } 45 | 46 | public UltMrzSdkResult(int code, String phrase, String json) { 47 | this(ultimateMrzSdkJNI.new_UltMrzSdkResult__SWIG_2(code, phrase, json), true); 48 | } 49 | 50 | public UltMrzSdkResult(UltMrzSdkResult other) { 51 | this(ultimateMrzSdkJNI.new_UltMrzSdkResult__SWIG_3(UltMrzSdkResult.getCPtr(other), other), true); 52 | } 53 | 54 | public int code() { 55 | return ultimateMrzSdkJNI.UltMrzSdkResult_code(swigCPtr, this); 56 | } 57 | 58 | public String phrase() { 59 | return ultimateMrzSdkJNI.UltMrzSdkResult_phrase(swigCPtr, this); 60 | } 61 | 62 | public String json() { 63 | return ultimateMrzSdkJNI.UltMrzSdkResult_json(swigCPtr, this); 64 | } 65 | 66 | public long numZones() { 67 | return ultimateMrzSdkJNI.UltMrzSdkResult_numZones(swigCPtr, this); 68 | } 69 | 70 | public boolean isOK() { 71 | return ultimateMrzSdkJNI.UltMrzSdkResult_isOK(swigCPtr, this); 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /java/org/doubango/ultimateMrz/Sdk/ultimateMrzSdk.java: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------------- 2 | * This file was automatically generated by SWIG (http://www.swig.org). 3 | * Version 2.0.9 4 | * 5 | * Do not make changes to this file unless you know what you are doing--modify 6 | * the SWIG interface file instead. 7 | * ----------------------------------------------------------------------------- */ 8 | 9 | package org.doubango.ultimateMrz.Sdk; 10 | 11 | public class ultimateMrzSdk implements ultimateMrzSdkConstants { 12 | } 13 | -------------------------------------------------------------------------------- /java/org/doubango/ultimateMrz/Sdk/ultimateMrzSdkConstants.java: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------------- 2 | * This file was automatically generated by SWIG (http://www.swig.org). 3 | * Version 2.0.9 4 | * 5 | * Do not make changes to this file unless you know what you are doing--modify 6 | * the SWIG interface file instead. 7 | * ----------------------------------------------------------------------------- */ 8 | 9 | package org.doubango.ultimateMrz.Sdk; 10 | 11 | public interface ultimateMrzSdkConstants { 12 | public final static int ULTMRZ_SDK_VERSION_MAJOR = 2; 13 | public final static int ULTMRZ_SDK_VERSION_MINOR = 9; 14 | public final static int ULTMRZ_SDK_VERSION_MICRO = 0; 15 | } 16 | -------------------------------------------------------------------------------- /java/org/doubango/ultimateMrz/Sdk/ultimateMrzSdkJNI.java: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------------- 2 | * This file was automatically generated by SWIG (http://www.swig.org). 3 | * Version 2.0.9 4 | * 5 | * Do not make changes to this file unless you know what you are doing--modify 6 | * the SWIG interface file instead. 7 | * ----------------------------------------------------------------------------- */ 8 | 9 | package org.doubango.ultimateMrz.Sdk; 10 | 11 | public class ultimateMrzSdkJNI { 12 | public final static native long new_UltMrzSdkResult__SWIG_0(); 13 | public final static native long new_UltMrzSdkResult__SWIG_1(int jarg1, String jarg2, String jarg3, long jarg4); 14 | public final static native long new_UltMrzSdkResult__SWIG_2(int jarg1, String jarg2, String jarg3); 15 | public final static native long new_UltMrzSdkResult__SWIG_3(long jarg1, UltMrzSdkResult jarg1_); 16 | public final static native void delete_UltMrzSdkResult(long jarg1); 17 | public final static native int UltMrzSdkResult_code(long jarg1, UltMrzSdkResult jarg1_); 18 | public final static native String UltMrzSdkResult_phrase(long jarg1, UltMrzSdkResult jarg1_); 19 | public final static native String UltMrzSdkResult_json(long jarg1, UltMrzSdkResult jarg1_); 20 | public final static native long UltMrzSdkResult_numZones(long jarg1, UltMrzSdkResult jarg1_); 21 | public final static native boolean UltMrzSdkResult_isOK(long jarg1, UltMrzSdkResult jarg1_); 22 | public final static native long UltMrzSdkEngine_init__SWIG_0(String jarg1); 23 | public final static native long UltMrzSdkEngine_init__SWIG_1(); 24 | public final static native long UltMrzSdkEngine_deInit(); 25 | public final static native long UltMrzSdkEngine_process__SWIG_0(int jarg1, java.nio.ByteBuffer jarg2, long jarg3, long jarg4, long jarg5, int jarg6); 26 | public final static native long UltMrzSdkEngine_process__SWIG_1(int jarg1, java.nio.ByteBuffer jarg2, long jarg3, long jarg4, long jarg5); 27 | public final static native long UltMrzSdkEngine_process__SWIG_2(int jarg1, java.nio.ByteBuffer jarg2, long jarg3, long jarg4); 28 | public final static native long UltMrzSdkEngine_process__SWIG_3(int jarg1, java.nio.ByteBuffer jarg2, java.nio.ByteBuffer jarg3, java.nio.ByteBuffer jarg4, long jarg5, long jarg6, long jarg7, long jarg8, long jarg9, long jarg10, int jarg11); 29 | public final static native long UltMrzSdkEngine_process__SWIG_4(int jarg1, java.nio.ByteBuffer jarg2, java.nio.ByteBuffer jarg3, java.nio.ByteBuffer jarg4, long jarg5, long jarg6, long jarg7, long jarg8, long jarg9, long jarg10); 30 | public final static native long UltMrzSdkEngine_process__SWIG_5(int jarg1, java.nio.ByteBuffer jarg2, java.nio.ByteBuffer jarg3, java.nio.ByteBuffer jarg4, long jarg5, long jarg6, long jarg7, long jarg8, long jarg9); 31 | public final static native int UltMrzSdkEngine_exifOrientation(java.nio.ByteBuffer jarg1, long jarg2); 32 | public final static native long UltMrzSdkEngine_requestRuntimeLicenseKey__SWIG_0(boolean jarg1); 33 | public final static native long UltMrzSdkEngine_requestRuntimeLicenseKey__SWIG_1(); 34 | public final static native void delete_UltMrzSdkEngine(long jarg1); 35 | } 36 | -------------------------------------------------------------------------------- /objc/objc.i: -------------------------------------------------------------------------------- 1 | /* File : objc.i */ 2 | 3 | /* http://www.swig.org/Doc1.3/Library.html#Library_carrays 4 | * 8.3.2 Passing binary data */ 5 | %apply (char *STRING, int LENGTH) { (const void* buffer, int len) }; 6 | 7 | %include ../swig.i -------------------------------------------------------------------------------- /perl/perl.i: -------------------------------------------------------------------------------- 1 | /* File : perl.i */ 2 | 3 | /* http://www.swig.org/Doc1.3/Library.html#Library_carrays 4 | * 8.3.2 Passing binary data */ 5 | %apply (char *STRING, int LENGTH) { (const void* buffer, int len) }; 6 | 7 | %include ../swig.i 8 | -------------------------------------------------------------------------------- /perl/ultimateMrzSdk.pm: -------------------------------------------------------------------------------- 1 | # This file was automatically generated by SWIG (http://www.swig.org). 2 | # Version 2.0.9 3 | # 4 | # Do not make changes to this file unless you know what you are doing--modify 5 | # the SWIG interface file instead. 6 | 7 | package ultimateMrzSdk; 8 | use base qw(Exporter); 9 | use base qw(DynaLoader); 10 | package ultimateMrzSdkc; 11 | bootstrap ultimateMrzSdk; 12 | package ultimateMrzSdk; 13 | @EXPORT = qw(); 14 | 15 | # ---------- BASE METHODS ------------- 16 | 17 | package ultimateMrzSdk; 18 | 19 | sub TIEHASH { 20 | my ($classname,$obj) = @_; 21 | return bless $obj, $classname; 22 | } 23 | 24 | sub CLEAR { } 25 | 26 | sub FIRSTKEY { } 27 | 28 | sub NEXTKEY { } 29 | 30 | sub FETCH { 31 | my ($self,$field) = @_; 32 | my $member_func = "swig_${field}_get"; 33 | $self->$member_func(); 34 | } 35 | 36 | sub STORE { 37 | my ($self,$field,$newval) = @_; 38 | my $member_func = "swig_${field}_set"; 39 | $self->$member_func($newval); 40 | } 41 | 42 | sub this { 43 | my $ptr = shift; 44 | return tied(%$ptr); 45 | } 46 | 47 | 48 | # ------- FUNCTION WRAPPERS -------- 49 | 50 | package ultimateMrzSdk; 51 | 52 | 53 | ############# Class : ultimateMrzSdk::UltMrzSdkResult ############## 54 | 55 | package ultimateMrzSdk::UltMrzSdkResult; 56 | use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS); 57 | @ISA = qw( ultimateMrzSdk ); 58 | %OWNER = (); 59 | %ITERATORS = (); 60 | sub new { 61 | my $pkg = shift; 62 | my $self = ultimateMrzSdkc::new_UltMrzSdkResult(@_); 63 | bless $self, $pkg if defined($self); 64 | } 65 | 66 | sub DESTROY { 67 | return unless $_[0]->isa('HASH'); 68 | my $self = tied(%{$_[0]}); 69 | return unless defined $self; 70 | delete $ITERATORS{$self}; 71 | if (exists $OWNER{$self}) { 72 | ultimateMrzSdkc::delete_UltMrzSdkResult($self); 73 | delete $OWNER{$self}; 74 | } 75 | } 76 | 77 | *code = *ultimateMrzSdkc::UltMrzSdkResult_code; 78 | *phrase = *ultimateMrzSdkc::UltMrzSdkResult_phrase; 79 | *json = *ultimateMrzSdkc::UltMrzSdkResult_json; 80 | *numZones = *ultimateMrzSdkc::UltMrzSdkResult_numZones; 81 | *isOK = *ultimateMrzSdkc::UltMrzSdkResult_isOK; 82 | sub DISOWN { 83 | my $self = shift; 84 | my $ptr = tied(%$self); 85 | delete $OWNER{$ptr}; 86 | } 87 | 88 | sub ACQUIRE { 89 | my $self = shift; 90 | my $ptr = tied(%$self); 91 | $OWNER{$ptr} = 1; 92 | } 93 | 94 | 95 | ############# Class : ultimateMrzSdk::UltMrzSdkEngine ############## 96 | 97 | package ultimateMrzSdk::UltMrzSdkEngine; 98 | use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS); 99 | @ISA = qw( ultimateMrzSdk ); 100 | %OWNER = (); 101 | %ITERATORS = (); 102 | *init = *ultimateMrzSdkc::UltMrzSdkEngine_init; 103 | *deInit = *ultimateMrzSdkc::UltMrzSdkEngine_deInit; 104 | *process = *ultimateMrzSdkc::UltMrzSdkEngine_process; 105 | *requestRuntimeLicenseKey = *ultimateMrzSdkc::UltMrzSdkEngine_requestRuntimeLicenseKey; 106 | sub DESTROY { 107 | return unless $_[0]->isa('HASH'); 108 | my $self = tied(%{$_[0]}); 109 | return unless defined $self; 110 | delete $ITERATORS{$self}; 111 | if (exists $OWNER{$self}) { 112 | ultimateMrzSdkc::delete_UltMrzSdkEngine($self); 113 | delete $OWNER{$self}; 114 | } 115 | } 116 | 117 | sub DISOWN { 118 | my $self = shift; 119 | my $ptr = tied(%$self); 120 | delete $OWNER{$ptr}; 121 | } 122 | 123 | sub ACQUIRE { 124 | my $self = shift; 125 | my $ptr = tied(%$self); 126 | $OWNER{$ptr} = 1; 127 | } 128 | 129 | 130 | # ------- VARIABLE STUBS -------- 131 | 132 | package ultimateMrzSdk; 133 | 134 | *ULTMRZ_SDK_VERSION_MAJOR = *ultimateMrzSdkc::ULTMRZ_SDK_VERSION_MAJOR; 135 | *ULTMRZ_SDK_VERSION_MINOR = *ultimateMrzSdkc::ULTMRZ_SDK_VERSION_MINOR; 136 | *ULTMRZ_SDK_VERSION_MICRO = *ultimateMrzSdkc::ULTMRZ_SDK_VERSION_MICRO; 137 | *ULTMRZ_SDK_IMAGE_TYPE_RGB24 = *ultimateMrzSdkc::ULTMRZ_SDK_IMAGE_TYPE_RGB24; 138 | *ULTMRZ_SDK_IMAGE_TYPE_RGBA32 = *ultimateMrzSdkc::ULTMRZ_SDK_IMAGE_TYPE_RGBA32; 139 | *ULTMRZ_SDK_IMAGE_TYPE_BGRA32 = *ultimateMrzSdkc::ULTMRZ_SDK_IMAGE_TYPE_BGRA32; 140 | *ULTMRZ_SDK_IMAGE_TYPE_NV12 = *ultimateMrzSdkc::ULTMRZ_SDK_IMAGE_TYPE_NV12; 141 | *ULTMRZ_SDK_IMAGE_TYPE_NV21 = *ultimateMrzSdkc::ULTMRZ_SDK_IMAGE_TYPE_NV21; 142 | *ULTMRZ_SDK_IMAGE_TYPE_YUV420P = *ultimateMrzSdkc::ULTMRZ_SDK_IMAGE_TYPE_YUV420P; 143 | *ULTMRZ_SDK_IMAGE_TYPE_YVU420P = *ultimateMrzSdkc::ULTMRZ_SDK_IMAGE_TYPE_YVU420P; 144 | *ULTMRZ_SDK_IMAGE_TYPE_YUV422P = *ultimateMrzSdkc::ULTMRZ_SDK_IMAGE_TYPE_YUV422P; 145 | *ULTMRZ_SDK_IMAGE_TYPE_YUV444P = *ultimateMrzSdkc::ULTMRZ_SDK_IMAGE_TYPE_YUV444P; 146 | *ULTMRZ_SDK_IMAGE_TYPE_Y = *ultimateMrzSdkc::ULTMRZ_SDK_IMAGE_TYPE_Y; 147 | *ULTMRZ_SDK_IMAGE_TYPE_BGR24 = *ultimateMrzSdkc::ULTMRZ_SDK_IMAGE_TYPE_BGR24; 148 | 1; 149 | -------------------------------------------------------------------------------- /python/README.md: -------------------------------------------------------------------------------- 1 | This SDK is developped using C++11 and comes with Python wrappers generated using SWIG. 2 | 3 | There is no Python extension in the repository. Generating pre-built extension will force us to choose a specific Python version which means you'll be bound to this decision. 4 | To avoid being bound to a specific Python version we let the extension build task up to you. Building the extension is very easy and doesn't require any specific skill. 5 | 6 | # C++ Compiler # 7 | You'll need a C++ compiler. 8 | 9 | On Windows we recommend Visual Studio 2015 Community or later. 10 | 11 | On Linux we recommend recent GCC/G++ version with support for C++11. 12 | 13 | # Building # 14 | You'll need Python, all versions are supported but ***we highly recommend 3.0 or later***. You'll also need **Cython** and **python-dev** packages. Other packages may be required but you can easily install them using **pip tool**. 15 | 16 | On Windows we recommend using Anaconda. 17 | 18 | Before building the extension you have to navigate to the folder containing the [binaries](../binaries): 19 | ``` 20 | cd ultimateMRZ-SDK/binaries/<>/<> 21 | ``` 22 | For example: 23 | - On Windows x86_64: [binaries/windows/x86_64](../binaries/windows/x86_64) 24 | - On Linux x86_64: [binaries/linux/x86_64](../binaries/linux/x86_64) 25 | - On Raspbian arm32 : [binaries/raspbian/armv7l](../binaries/raspbian/armv7l) 26 | - ... you got the idea 27 | 28 | From the the binaries folder (`ultimateMRZ-SDK/binaries/<>/<>`), call the [setup.py](setup.py) script: 29 | ``` 30 | python ../../../python/setup.py build_ext --inplace -v 31 | ``` 32 | If you have multiple python versions installed, then you may use a virtual env, a full path to the executable... Also, you may use `python3` instead of `python` to make sure you're using version 3. The python version used to build the extension should be the same to use in order to run the samples. 33 | 34 | This will build and install the extension in the current folder. The extension is named **_ultimateMrzSdk.pyd** on Windows and **_ultimateMrzSdk.so** on Linux. 35 | 36 | Now you're ready to run Python scripts using the extension. We highly recommend checking the recognizer sample: [ultimateMRZ-SDK/samples/python/recognizer](../samples/python/recognizer) 37 | 38 | # Know issues # 39 | If you get `TypeError: super() takes at least 1 argument (0 given)` error message, then make sure you're using Python 3. We tested the code on version **3.6.9** (Windows 8), **3.6.8** (Ubuntu 18) and **3.7.3** (Raspbian Buster). Run `python --version` to print your Python version. You may use `python3` instead of `python` to make sure you're using version 3. 40 | -------------------------------------------------------------------------------- /python/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | """ 4 | pyton_setup.py file for SWIG ultimateMrzSdk 5 | You must run this file from 'binaries/os/arch' (e.g. 'binaries/windows/x86_64') folder. 6 | """ 7 | 8 | from distutils.core import setup, Extension 9 | from distutils import sysconfig 10 | from Cython.Distutils import build_ext 11 | from sys import platform 12 | import os 13 | 14 | # Shared library name 15 | print("Your platform: %s" % platform) 16 | LIBNAME = 'ultimate_mrz-sdk' 17 | if platform.startswith('win'): 18 | LIBNAME = 'ultimateMRZ-SDK' 19 | 20 | # Do not add suffix (e.g. 'cp36-win_amd64') 21 | class NoSuffixBuilder(build_ext): 22 | def get_ext_filename(self, ext_name): 23 | filename = super().get_ext_filename(ext_name) 24 | suffix = sysconfig.get_config_var('EXT_SUFFIX') 25 | ext = os.path.splitext(filename)[1] 26 | return filename.replace(suffix, "") + ext 27 | 28 | ultimateMrzSdk_module = Extension('_ultimateMrzSdk', 29 | sources=[os.path.abspath('../../../python/ultimateMRZ-SDK-API-PUBLIC-SWIG_python.cxx')], 30 | include_dirs=['../../../c++'], 31 | language='c++11', 32 | library_dirs=['.'], 33 | libraries=[LIBNAME] 34 | ) 35 | 36 | setup (name = 'ultimateMrzSdk', 37 | version = '2.4', 38 | author = "Doubango AI", 39 | description = """ultimateMrzSdk for python""", 40 | ext_modules = [ultimateMrzSdk_module], 41 | py_modules = ["ultimateMrzSdk"], 42 | cmdclass={"build_ext": NoSuffixBuilder}, 43 | ) -------------------------------------------------------------------------------- /ruby/ruby.i: -------------------------------------------------------------------------------- 1 | /* File : ruby.i */ 2 | 3 | /* http://www.swig.org/Doc1.3/Library.html#Library_carrays 4 | * 8.3.2 Passing binary data */ 5 | %apply (char *STRING, int LENGTH) { (const void* buffer, int len) }; 6 | 7 | %include ../swig.i 8 | -------------------------------------------------------------------------------- /samples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0) 2 | 3 | add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/c++) -------------------------------------------------------------------------------- /samples/README.md: -------------------------------------------------------------------------------- 1 | - [android](android) folder contains GUI applications for Android 5.0+ (Java) 2 | - [c++](c++) folder contains command-line sample applications for Windows, Raspberry Pi and Linux. These samples can also be used for Android or iOS but we recommend using the one in [android](android) and [iOS](iOS) folders. 3 | - [csharp](csharp) folder contains command-line Visual Studio sample applications configured for Win64 but work on any platform supporting C-Sharp 4 | - [iOS](iOS) folder contains GUI applications for iOS 8.0+ 5 | - [java](java) folder contains command-line sample applications for all supported platforms 6 | - [python](python) folder contains command-line sample applications for all supported platforms 7 | 8 | -------------------------------------------------------------------------------- /samples/android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | -------------------------------------------------------------------------------- /samples/android/.idea/.name: -------------------------------------------------------------------------------- 1 | ultimateMrz -------------------------------------------------------------------------------- /samples/android/.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | xmlns:android 14 | 15 | ^$ 16 | 17 | 18 | 19 |
20 |
21 | 22 | 23 | 24 | xmlns:.* 25 | 26 | ^$ 27 | 28 | 29 | BY_NAME 30 | 31 |
32 |
33 | 34 | 35 | 36 | .*:id 37 | 38 | http://schemas.android.com/apk/res/android 39 | 40 | 41 | 42 |
43 |
44 | 45 | 46 | 47 | .*:name 48 | 49 | http://schemas.android.com/apk/res/android 50 | 51 | 52 | 53 |
54 |
55 | 56 | 57 | 58 | name 59 | 60 | ^$ 61 | 62 | 63 | 64 |
65 |
66 | 67 | 68 | 69 | style 70 | 71 | ^$ 72 | 73 | 74 | 75 |
76 |
77 | 78 | 79 | 80 | .* 81 | 82 | ^$ 83 | 84 | 85 | BY_NAME 86 | 87 |
88 |
89 | 90 | 91 | 92 | .* 93 | 94 | http://schemas.android.com/apk/res/android 95 | 96 | 97 | ANDROID_ATTRIBUTE_ORDER 98 | 99 |
100 |
101 | 102 | 103 | 104 | .* 105 | 106 | .* 107 | 108 | 109 | BY_NAME 110 | 111 |
112 |
113 |
114 |
115 |
116 |
-------------------------------------------------------------------------------- /samples/android/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | -------------------------------------------------------------------------------- /samples/android/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 15 | 16 | -------------------------------------------------------------------------------- /samples/android/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 14 | -------------------------------------------------------------------------------- /samples/android/.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /samples/android/README.md: -------------------------------------------------------------------------------- 1 | This folder contains 2 sample applications for Android: [Benchmark](../../README.md#benchmark) and [VideoRecognizer](../../README.md#Sample-applications-Video-Recognizer). 2 | 3 | More information on how to try these samples could be found [here](../../README.md#Sample-applications-Trying-the-samples-Android). 4 | -------------------------------------------------------------------------------- /samples/android/benchmark/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /samples/android/benchmark/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | 6 | 7 | defaultConfig { 8 | applicationId "org.doubango.ultimateMrz.benchmark" 9 | minSdkVersion 21 10 | targetSdkVersion 28 11 | versionCode 1 12 | versionName "1.0" 13 | 14 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 15 | } 16 | 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | 24 | sourceSets { 25 | main { 26 | assets.srcDirs += ['../../../assets/images'] 27 | } 28 | } 29 | } 30 | 31 | dependencies { 32 | implementation fileTree(dir: 'libs', include: ['*.jar']) 33 | 34 | implementation 'androidx.appcompat:appcompat:1.1.0' 35 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 36 | 37 | implementation project(":sdk") 38 | } 39 | -------------------------------------------------------------------------------- /samples/android/benchmark/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /samples/android/benchmark/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 10 | 11 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /samples/android/benchmark/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /samples/android/benchmark/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 18 | 19 | -------------------------------------------------------------------------------- /samples/android/benchmark/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /samples/android/benchmark/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /samples/android/benchmark/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/samples/android/benchmark/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /samples/android/benchmark/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/samples/android/benchmark/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /samples/android/benchmark/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/samples/android/benchmark/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /samples/android/benchmark/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/samples/android/benchmark/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /samples/android/benchmark/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/samples/android/benchmark/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /samples/android/benchmark/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/samples/android/benchmark/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /samples/android/benchmark/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/samples/android/benchmark/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /samples/android/benchmark/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/samples/android/benchmark/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /samples/android/benchmark/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/samples/android/benchmark/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /samples/android/benchmark/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/samples/android/benchmark/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /samples/android/benchmark/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #008577 4 | #00574B 5 | #D81B60 6 | 7 | -------------------------------------------------------------------------------- /samples/android/benchmark/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Benchmark 3 | 4 | -------------------------------------------------------------------------------- /samples/android/benchmark/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /samples/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | google() 7 | maven { 8 | url "https://maven.google.com" 9 | } 10 | } 11 | dependencies { 12 | classpath 'com.android.tools.build:gradle:3.5.1' 13 | 14 | // NOTE: Do not place your application dependencies here; they belong 15 | // in the individual module build.gradle files 16 | } 17 | } 18 | 19 | allprojects { 20 | repositories { 21 | jcenter() 22 | google() 23 | maven { 24 | url "https://maven.google.com" 25 | } 26 | 27 | } 28 | } 29 | 30 | task clean(type: Delete) { 31 | delete rootProject.buildDir 32 | } 33 | -------------------------------------------------------------------------------- /samples/android/common/src/main/java/org/doubango/ultimateMrz/common/MrzAutoFitTextureView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.doubango.ultimateMrz.common; 18 | 19 | import android.content.Context; 20 | import android.util.AttributeSet; 21 | import android.view.TextureView; 22 | 23 | /** 24 | * A {@link TextureView} that can be adjusted to a specified aspect ratio. 25 | */ 26 | public class MrzAutoFitTextureView extends TextureView { 27 | 28 | private int mRatioWidth = 0; 29 | private int mRatioHeight = 0; 30 | 31 | public MrzAutoFitTextureView(Context context) { 32 | this(context, null); 33 | } 34 | 35 | public MrzAutoFitTextureView(Context context, AttributeSet attrs) { 36 | this(context, attrs, 0); 37 | } 38 | 39 | public MrzAutoFitTextureView(Context context, AttributeSet attrs, int defStyle) { 40 | super(context, attrs, defStyle); 41 | } 42 | 43 | /** 44 | * Sets the aspect ratio for this view. The size of the view will be measured based on the ratio 45 | * calculated from the parameters. Note that the actual sizes of parameters don't matter, that 46 | * is, calling setAspectRatio(2, 3) and setAspectRatio(4, 6) make the same result. 47 | * 48 | * @param width Relative horizontal size 49 | * @param height Relative vertical size 50 | */ 51 | public void setAspectRatio(int width, int height) { 52 | if (width < 0 || height < 0) { 53 | throw new IllegalArgumentException("Size cannot be negative."); 54 | } 55 | mRatioWidth = width; 56 | mRatioHeight = height; 57 | requestLayout(); 58 | } 59 | 60 | @Override 61 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 62 | super.onMeasure(widthMeasureSpec, heightMeasureSpec); 63 | int width = MeasureSpec.getSize(widthMeasureSpec); 64 | int height = MeasureSpec.getSize(heightMeasureSpec); 65 | if (0 == mRatioWidth || 0 == mRatioHeight) { 66 | setMeasuredDimension(width, height); 67 | } else { 68 | if (width < height * mRatioWidth / mRatioHeight) { 69 | setMeasuredDimension(width, width * mRatioHeight / mRatioWidth); 70 | } else { 71 | setMeasuredDimension(height * mRatioWidth / mRatioHeight, height); 72 | } 73 | } 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /samples/android/common/src/main/java/org/doubango/ultimateMrz/common/MrzBackgroundTask.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2019 Doubango AI 3 | * License: For non-commercial use only 4 | * Source code: https://github.com/DoubangoTelecom/ultimateMRZ-SDK 5 | * WebSite: https://www.doubango.org/webapps/mrz/ 6 | */ 7 | package org.doubango.ultimateMrz.common; 8 | 9 | 10 | import android.os.Handler; 11 | import android.os.HandlerThread; 12 | 13 | public class MrzBackgroundTask { 14 | 15 | private Handler mHandler; 16 | private HandlerThread mThread; 17 | 18 | public synchronized final Handler getHandler() { 19 | return mHandler; 20 | } 21 | public synchronized final boolean isRunning() { return mHandler != null; } 22 | 23 | public synchronized void start(final String threadName) { 24 | if (mThread != null) { 25 | return; 26 | } 27 | mThread = new HandlerThread(threadName); 28 | mThread.start(); 29 | mHandler = new Handler(mThread.getLooper()); 30 | } 31 | 32 | public synchronized void stop() { 33 | if (mThread == null) { 34 | return; 35 | } 36 | mThread.quitSafely(); 37 | try { 38 | mThread.join(); 39 | mThread = null; 40 | mHandler = null; 41 | } catch (InterruptedException e) { 42 | e.printStackTrace(); 43 | } 44 | } 45 | 46 | public synchronized void post(final Runnable r) { 47 | if (mHandler != null) { 48 | mHandler.post(r); 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /samples/android/common/src/main/java/org/doubango/ultimateMrz/common/MrzImage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2019 Doubango AI 3 | * License: For non-commercial use only 4 | * Source code: https://github.com/DoubangoTelecom/ultimateMRZ-SDK 5 | * WebSite: https://www.doubango.org/webapps/mrz/ 6 | */ 7 | package org.doubango.ultimateMrz.common; 8 | 9 | import android.media.Image; 10 | 11 | import java.util.concurrent.atomic.AtomicInteger; 12 | 13 | public class MrzImage { 14 | 15 | Image mImage; 16 | final AtomicInteger mRefCount; 17 | 18 | private MrzImage(final Image image) { 19 | assert image != null; 20 | mImage = image; 21 | mRefCount = new AtomicInteger(0); 22 | } 23 | 24 | public static MrzImage newInstance(final Image image) { 25 | return new MrzImage(image); 26 | } 27 | 28 | public final Image getImage() { 29 | assert mRefCount.intValue() >= 0; 30 | return mImage; 31 | } 32 | 33 | public MrzImage takeRef() { 34 | assert mRefCount.intValue() >= 0; 35 | if (mRefCount.intValue() < 0) { 36 | return null; 37 | } 38 | mRefCount.incrementAndGet(); 39 | return this; 40 | } 41 | 42 | public void releaseRef() { 43 | assert mRefCount.intValue() >= 0; 44 | final int refCount = mRefCount.decrementAndGet(); 45 | if (refCount <= 0) { 46 | mImage.close(); 47 | mImage = null; 48 | } 49 | } 50 | 51 | @Override 52 | protected synchronized void finalize() { 53 | if (mImage != null && mRefCount.intValue() < 0) { 54 | mImage.close(); 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /samples/android/common/src/main/res/drawable-hdpi/ic_action_info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/samples/android/common/src/main/res/drawable-hdpi/ic_action_info.png -------------------------------------------------------------------------------- /samples/android/common/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/samples/android/common/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /samples/android/common/src/main/res/drawable-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/samples/android/common/src/main/res/drawable-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /samples/android/common/src/main/res/drawable-hdpi/tile.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/samples/android/common/src/main/res/drawable-hdpi/tile.9.png -------------------------------------------------------------------------------- /samples/android/common/src/main/res/drawable-mdpi/ic_action_info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/samples/android/common/src/main/res/drawable-mdpi/ic_action_info.png -------------------------------------------------------------------------------- /samples/android/common/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/samples/android/common/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /samples/android/common/src/main/res/drawable-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/samples/android/common/src/main/res/drawable-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /samples/android/common/src/main/res/drawable-xhdpi/ic_action_info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/samples/android/common/src/main/res/drawable-xhdpi/ic_action_info.png -------------------------------------------------------------------------------- /samples/android/common/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/samples/android/common/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /samples/android/common/src/main/res/drawable-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/samples/android/common/src/main/res/drawable-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /samples/android/common/src/main/res/drawable-xxhdpi/ic_action_info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/samples/android/common/src/main/res/drawable-xxhdpi/ic_action_info.png -------------------------------------------------------------------------------- /samples/android/common/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/samples/android/common/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /samples/android/common/src/main/res/drawable-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoubangoTelecom/ultimateMRZ-SDK/db64de7a955de75c2b554f44923d0eedffe9cd56/samples/android/common/src/main/res/drawable-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /samples/android/common/src/main/res/layout-land/fragment_camera.xml: -------------------------------------------------------------------------------- 1 | 7 | 11 | 12 | 31 | 32 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /samples/android/common/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 7 | 14 | -------------------------------------------------------------------------------- /samples/android/common/src/main/res/layout/fragment_camera.xml: -------------------------------------------------------------------------------- 1 | 7 | 11 | 12 | 31 | 32 | 51 | 52 | -------------------------------------------------------------------------------- /samples/android/common/src/main/res/values-sw600dp/template-dimens.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | 11 | 12 | @dimen/margin_huge 13 | @dimen/margin_medium 14 | 15 | 16 | -------------------------------------------------------------------------------- /samples/android/common/src/main/res/values-sw600dp/template-styles.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /samples/android/common/src/main/res/values-v11/template-styles.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /samples/android/common/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | #cc4285f4 10 | 11 | -------------------------------------------------------------------------------- /samples/android/common/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | Picture 9 | Info 10 | This sample needs camera permission. 11 | This device doesn\'t support Camera2 API. 12 | 13 | -------------------------------------------------------------------------------- /samples/android/common/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 11 | 12 | -------------------------------------------------------------------------------- /samples/android/common/src/main/res/values/template-dimens.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | 11 | 12 | 4dp 13 | 8dp 14 | 16dp 15 | 32dp 16 | 64dp 17 | 18 | 19 | 20 | @dimen/margin_medium 21 | @dimen/margin_medium 22 | 23 | 24 | -------------------------------------------------------------------------------- /samples/android/common/src/main/res/values/template-styles.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | 11 | 12 | 25 | 26 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /samples/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app's APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true 20 | 21 | -------------------------------------------------------------------------------- /samples/android/sdk/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /samples/android/sdk/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 28 5 | 6 | 7 | defaultConfig { 8 | minSdkVersion 21 9 | targetSdkVersion 28 10 | versionCode 1 11 | versionName "1.0" 12 | 13 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 14 | consumerProguardFiles 'consumer-rules.pro' 15 | } 16 | 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | 24 | sourceSets { 25 | main { 26 | jniLibs.srcDirs += ['../../../binaries/android/jniLibs'] 27 | java.srcDirs += ['../../../java/android'] 28 | assets.srcDirs += ['../../../assets/models'] 29 | } 30 | } 31 | } 32 | 33 | dependencies { 34 | implementation fileTree(dir: 'libs', include: ['*.jar']) 35 | 36 | implementation 'androidx.appcompat:appcompat:1.0.2' 37 | } 38 | -------------------------------------------------------------------------------- /samples/android/sdk/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /samples/android/sdk/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /samples/android/sdk/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ultimaeMrzSdk 3 | 4 | -------------------------------------------------------------------------------- /samples/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':sdk', ':benchmark', ':videorecognizer' 2 | rootProject.name='ultimateMrz' 3 | -------------------------------------------------------------------------------- /samples/android/videorecognizer/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /samples/android/videorecognizer/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | 6 | 7 | defaultConfig { 8 | applicationId "org.doubango.ultimateMrz.videorecognizer" 9 | minSdkVersion 21 10 | targetSdkVersion 28 11 | versionCode 1 12 | versionName "1.0" 13 | 14 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 15 | } 16 | 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | 24 | compileOptions { 25 | sourceCompatibility = '1.8' 26 | targetCompatibility = '1.8' 27 | } 28 | 29 | sourceSets { 30 | main { 31 | java.srcDirs += ['../common/src/main/java'] 32 | res.srcDirs += ['../common/src/main/res'] 33 | assets.srcDirs += ['../../../assets/fonts'] 34 | } 35 | } 36 | 37 | } 38 | 39 | dependencies { 40 | implementation fileTree(dir: 'libs', include: ['*.jar']) 41 | 42 | implementation 'androidx.appcompat:appcompat:1.1.0' 43 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 44 | 45 | implementation project(":sdk") 46 | } 47 | -------------------------------------------------------------------------------- /samples/android/videorecognizer/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /samples/android/videorecognizer/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /samples/android/videorecognizer/src/main/res/values/base-strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | MrzVideoRecognizer 11 | 12 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /samples/c++/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0) 2 | 3 | add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/benchmark) 4 | add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/parser) 5 | add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/recognizer) 6 | add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/runtimeKey) 7 | add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/validation) 8 | -------------------------------------------------------------------------------- /samples/c++/README.md: -------------------------------------------------------------------------------- 1 | - [Cross compilation](#cross-compilation) 2 | - [Raspberry Pi](#cross-compilation-rpi) 3 | - [Installing the toolchain](#cross-compilation-rpi-install) 4 | - [Windows](#cross-compilation-rpi-install-windows) 5 | - [Ubuntu](#cross-compilation-rpi-install-ubuntu) 6 | - [Known issues](#known-issues) 7 | 8 | 9 | There are 5 C++ samples: [Benchmark](benchmark), [Parser](parser), [Recognizer](recognizer), [RuntimeKey](runtimeKey) and [Validation](validation). Check [here](benchmark/README.md), [here](parser/README.md), [here](recognizer/README.md), [here](runtimeKey/README.md) and Check [here](validation/README.md) on how to build and use them. 10 | 11 | The C++ samples are common to all platforms: **Android**, **Windows**, **iOS**, **Raspberry Pi (3 or 4)**, **Linux**... 12 | 13 | For **Android**, we recommend using the Java samples under [android](../android) folder. These are complete samples with support for reatime recognition from video stream (camera) and require Android Studio to build. More info on how to install these samples is available [here](../../README.md#trying-the-samples-android). 14 | 15 | For **iOS**, we recommend using the Obj-C samples under [iOS](../iOS) folder. These are complete samples with support for reatime recognition from video stream (camera) and require Xcode to build. More info on how to install these samples is available [here](../../README.md#trying-the-samples-ios). 16 | 17 | 18 | # Cross compilation # 19 | 20 | Every sample contain a single C++ source file and is easy to cross compile. 21 | 22 | 23 | ## Raspberry Pi (Raspbian OS) ## 24 | 25 | This section explain how to install Raspberry Pi 4 (Raspbian OS) toolchain to cross compile the samples. These instructions can be easily adapted to another target platform (e.g Android). 26 | 27 | 28 | ### Installing the toolchain ### 29 | 30 | 31 | #### Windows #### 32 | The toolchain for Raspberry Pi 4 could be found at [http://sysprogs.com/getfile/566/raspberry-gcc8.3.0.exe](http://sysprogs.com/getfile/566/raspberry-gcc8.3.0.exe) and more toolchain versions are at [https://gnutoolchains.com/raspberry/](https://gnutoolchains.com/raspberry/). 33 | 34 | If you haven't changed the installation dir then, it should be installed at **C:\SysGCC**. To add the toolchain to the **%PATH**: 35 | ``` 36 | set PATH=%PATH%;C:\SysGCC\raspberry\bin 37 | ``` 38 | 39 | 40 | #### Ubuntu #### 41 | ``` 42 | sudo apt-get update 43 | sudo apt-get install crossbuild-essential-armhf 44 | ``` 45 | 46 | 47 | # Known issues # 48 | - On Linux you may get `[CompVSharedLib] Failed to load library with path=<...>libultimatePluginOpenVINO.so, Error: 0xffffffff`. Make sure to set `LD_LIBRARY_PATH` to add binaries folder to help the loader find all dependencies. You can also run `ldd libultimatePluginOpenVINO.so` to see which libraries are missing. 49 | - On Linux you may get `'GLIBC_2.27' not found (required by <...>)`. This message means you're using an old glibc version. Update glibc or your OS to Ubuntu 18, Debian Buster... You can check your actual version by running `ldd --version`. 50 | -------------------------------------------------------------------------------- /samples/c++/android_utils.h: -------------------------------------------------------------------------------- 1 | #if !defined(_ULTIMATE_ALPR_SDK_SAMPLES_ANDROID_UTILS_H_) 2 | #define _ULTIMATE_ALPR_SDK_SAMPLES_ANDROID_UTILS_H_ 3 | 4 | #include 5 | 6 | #if ULTALPR_SDK_OS_ANDROID // below code come from https://github.com/DoubangoTelecom/compv/blob/master/api/include/compv/compv_api.h 7 | 8 | using namespace ultimateAlprSdk; 9 | 10 | # include 11 | # include 12 | extern "C" void ANativeActivity_onCreatePriv(ANativeActivity* activity, void* savedState, size_t savedStateSize, void(*android_main)(struct android_app* app)); // CompVbase: https://github.com/DoubangoTelecom/compv/blob/master/base/android/compv_android_native_activity.cxx 13 | 14 | static AAssetManager* __sdk_android_assetmgr = nullptr; 15 | 16 | static void android_main(struct android_app* state) { 17 | extern int main(); 18 | main(); 19 | } 20 | 21 | __attribute__((visibility("default"))) void ANativeActivity_onCreate(ANativeActivity* activity, void* savedState, size_t savedStateSize) { 22 | ANativeActivity_onCreatePriv(activity, savedState, savedStateSize, android_main); 23 | __sdk_android_assetmgr = activity->assetManager; 24 | UltAlprSdkEngine::setAssetManager(activity->assetManager); 25 | } 26 | 27 | static int sdk_android_asset_fread(void* cookie, char* buf, int size) { 28 | return AAsset_read((AAsset*)cookie, buf, size); 29 | } 30 | static int sdk_android_asset_fwrite(void* cookie, const char* buf, int size) { 31 | return EACCES; 32 | } 33 | static fpos_t sdk_android_asset_fseek(void* cookie, fpos_t offset, int whence) { 34 | return AAsset_seek((AAsset*)cookie, offset, whence); 35 | } 36 | static int sdk_android_asset_fclose(void* cookie) { 37 | AAsset_close((AAsset*)cookie); 38 | return 0; 39 | } 40 | static FILE* sdk_android_asset_fopen(const char* fname, const char* mode, size_t* size = nullptr) { 41 | AAsset* asset = AAssetManager_open(__sdk_android_assetmgr, fname, 0); 42 | if (!asset) { 43 | return nullptr; 44 | } 45 | if (size) { 46 | *size = static_cast(AAsset_getLength(asset)); 47 | } 48 | return funopen(asset, sdk_android_asset_fread, sdk_android_asset_fwrite, sdk_android_asset_fseek, sdk_android_asset_fclose); 49 | } 50 | 51 | #endif /* ULTALPR_SDK_OS_ANDROID */ 52 | 53 | #endif /* _ULTIMATE_ALPR_SDK_SAMPLES_ANDROID_UTILS_H_ */ 54 | -------------------------------------------------------------------------------- /samples/c++/benchmark/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0) 2 | 3 | project(benchmark VERSION 1.0.0 LANGUAGES CXX C) 4 | 5 | #### ultimate Libraries #### 6 | add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../../../SDK_dev/lib build/ultimateMRZ/SDK_dev) 7 | 8 | include_directories( 9 | ${CMAKE_CURRENT_SOURCE_DIR}/../../../../SDK_dev/lib/include 10 | ) 11 | 12 | set(benchmark_SOURCES 13 | main.cxx 14 | ) 15 | 16 | ###### The executable ###### 17 | add_executable(benchmark ${benchmark_SOURCES}) 18 | 19 | ###### 3rd parties libs ###### 20 | target_link_libraries(benchmark ${LIB_LINK_SCOPE} ultimate_mrz-sdk) 21 | add_dependencies(benchmark ultimate_mrz-sdk) 22 | 23 | ###### Install Libs ###### 24 | install(TARGETS benchmark DESTINATION bin) 25 | -------------------------------------------------------------------------------- /samples/c++/benchmark/benchmark.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "benchmark", "benchmark.vcxproj", "{484DDD42-7D21-4487-BBB8-70BD2244164B}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug_sdk|x64 = Debug_sdk|x64 11 | Release_sdk|x64 = Release_sdk|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {484DDD42-7D21-4487-BBB8-70BD2244164B}.Debug_sdk|x64.ActiveCfg = Debug_sdk|x64 15 | {484DDD42-7D21-4487-BBB8-70BD2244164B}.Debug_sdk|x64.Build.0 = Debug_sdk|x64 16 | {484DDD42-7D21-4487-BBB8-70BD2244164B}.Release_sdk|x64.ActiveCfg = Release_sdk|x64 17 | {484DDD42-7D21-4487-BBB8-70BD2244164B}.Release_sdk|x64.Build.0 = Release_sdk|x64 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /samples/c++/benchmark/benchmark.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /samples/c++/mrz_utils.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2016-2019 Doubango Telecom 2 | * File author: Mamadou DIOP (Doubango Telecom, France). 3 | * License: For non commercial use only. 4 | * Source code: https://github.com/DoubangoTelecom/ultimateMRZ-SDK 5 | * WebSite: https://www.doubango.org/webapps/mrz/ 6 | */ 7 | 8 | #if !defined(_ULTIMATE_MRZ_SDK_SAMPLES_UTILS_H_) 9 | #define _ULTIMATE_MRZ_SDK_SAMPLES_UTILS_H_ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | // Not part of the SDK, used to decode images -> https://github.com/nothings/stb 18 | #define STB_IMAGE_IMPLEMENTATION 19 | #define STB_IMAGE_STATIC 20 | #include "stb_image.h" 21 | 22 | #if ULTMRZ_SDK_OS_ANDROID 23 | #include "mrz_utils.h" 24 | #endif /* ULTMRZ_SDK_OS_ANDROID */ 25 | 26 | using namespace ultimateMrzSdk; 27 | 28 | /* 29 | * File description 30 | */ 31 | struct MrzFile { 32 | void* uncompressedData = nullptr; 33 | size_t width = 0; 34 | size_t height = 0; 35 | ULTMRZ_SDK_IMAGE_TYPE type; 36 | 37 | virtual ~MrzFile() { 38 | release(); 39 | } 40 | 41 | void release() { 42 | if (uncompressedData) { 43 | free(uncompressedData); 44 | uncompressedData = nullptr; 45 | } 46 | } 47 | 48 | inline bool isValid() const { 49 | return (uncompressedData != nullptr && width && height); 50 | } 51 | }; 52 | 53 | /* 54 | * Decodes a JPEG/PNG/BMP file 55 | * @param path 56 | * @param type 57 | * @param width 58 | * @param height 59 | * @returns 60 | */ 61 | static bool mrzDecodeFile(const std::string& path, MrzFile& mrzFile) 62 | { 63 | ULTMRZ_SDK_ASSERT(!path.empty()); 64 | 65 | // Open file 66 | FILE* file = 67 | # if ULTMRZ_SDK_OS_ANDROID 68 | sdk_android_asset_fopen(path.c_str(), "rb"); 69 | # else 70 | fopen(path.c_str(), "rb"); 71 | # endif 72 | if (!file) { 73 | ULTMRZ_SDK_PRINT_ERROR("Failed to open file at: %s", path.c_str()); 74 | return false; 75 | } 76 | 77 | // Decode the file 78 | int width, height, channels; 79 | stbi_uc* uncompressedData = stbi_load_from_file(file, &width, &height, &channels, 0); 80 | fclose(file); 81 | if (!uncompressedData || width <= 0 || height <= 0 || (channels != 1 && channels != 3 && channels != 4)) { 82 | ULTMRZ_SDK_PRINT_ERROR("Invalid file(%s, %d, %d, %d)", path.c_str(), width, height, channels); 83 | if (uncompressedData) { 84 | free(uncompressedData); 85 | } 86 | return false; 87 | } 88 | 89 | // We expect RGB-family data from the JPEG/PNG/BMP file 90 | // If you're using data from your camera then, it should be YUV-family and you don't need 91 | // to convert to RGB-family. 92 | // List of supported types: https://www.doubango.org/SDKs/anpr/docs/cpp-api.html#_CPPv4N15ultimateMrzSdk22ULTMRZ_SDK_IMAGE_TYPEE 93 | mrzFile.type = (channels == 3) ? ULTMRZ_SDK_IMAGE_TYPE_RGB24 : (channels == 1 ? ULTMRZ_SDK_IMAGE_TYPE_Y : ULTMRZ_SDK_IMAGE_TYPE_RGBA32); 94 | mrzFile.uncompressedData = uncompressedData; 95 | mrzFile.width = static_cast(width); 96 | mrzFile.height = static_cast(height); 97 | 98 | return true; 99 | } 100 | 101 | static bool mrzParseArgs(int argc, char *argv[], std::map& values) 102 | { 103 | ULTMRZ_SDK_ASSERT(argc > 0 && argv != nullptr); 104 | 105 | values.clear(); 106 | 107 | // Make sure the number of arguments is even 108 | if ((argc - 1) & 1) { 109 | ULTMRZ_SDK_PRINT_ERROR("Number of args must be even"); 110 | return false; 111 | } 112 | 113 | // Parsing 114 | for (int index = 1; index < argc; index += 2) { 115 | std::string key = argv[index]; 116 | if (key.size() < 2 || key[0] != '-' || key[1] != '-') { 117 | ULTMRZ_SDK_PRINT_ERROR("Invalid key: %s", key.c_str()); 118 | return false; 119 | } 120 | values[key] = argv[index + 1]; 121 | } 122 | 123 | return true; 124 | } 125 | 126 | 127 | #endif /* _ULTIMATE_MRZ_SDK_SAMPLES_UTILS_H_ */ 128 | -------------------------------------------------------------------------------- /samples/c++/parser/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0) 2 | 3 | project(parser VERSION 1.0.0 LANGUAGES CXX C) 4 | 5 | #### ultimate Libraries #### 6 | add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../../../SDK_dev/lib build/ultimateMRZ/SDK_dev) 7 | 8 | include_directories( 9 | ${CMAKE_CURRENT_SOURCE_DIR}/../../../../SDK_dev/lib/include 10 | ) 11 | 12 | set(parser_SOURCES 13 | main.cxx 14 | ) 15 | 16 | ###### The executable ###### 17 | add_executable(parser ${parser_SOURCES}) 18 | 19 | ###### 3rd parties libs ###### 20 | target_link_libraries(parser ${LIB_LINK_SCOPE} ultimate_mrz-sdk) 21 | add_dependencies(parser ultimate_mrz-sdk) 22 | 23 | ###### Install Libs ###### 24 | install(TARGETS parser DESTINATION bin) 25 | -------------------------------------------------------------------------------- /samples/c++/parser/README.md: -------------------------------------------------------------------------------- 1 | - [Pre-built binaries](#prebuilt) 2 | - [Building](#building) 3 | - [Android](#building-android) 4 | - [iOS](#building-ios) 5 | - [Windows](#building-windows) 6 | - [Generic GCC](#building-generic-gcc) 7 | - [Raspberry Pi (Raspbian OS)](#building-rpi) 8 | - [Testing](#testing) 9 | - [Usage](#testing-usage) 10 | - [Examples](#testing-examples) 11 | 12 | This sample application parses MRZ lines to extract the fields (name, birth date, expiry date...). The algorithm is explained at https://www.doubango.org/SDKs/mrz/docs/MRZ_parser.html. 13 | 14 | This sample is a standalone application with no dependencies. 15 | 16 | 17 | # Pre-built binaries # 18 | 19 | If you don't want to build this sample by yourself then, use the pre-built versions: 20 | - Windows: [parser.exe](../../../binaries/windows/x86_64/parser.exe) under [binaries/windows/x86_64](../../../binaries/windows/x86_64) 21 | - Linux: [parser](../../../binaries/linux/x86_64/parser) under [binaries/linux/x86_64](../../../binaries/linux/x86_64). Built on Ubuntu 18. **You'll need to download libtensorflow.so as explained [here](../README.md#gpu-acceleration-tensorflow-linux)**. 22 | - Raspberry Pi: [parser](../../../binaries/raspbian/armv7l/parser) under [binaries/raspbian/armv7l](../../../binaries/raspbian/armv7l) 23 | - Android: check [android](../../android) folder 24 | - iOS: check [ios](../../ios) folder 25 | 26 | On **Windows**, the easiest way to try this sample is to navigate to [binaries/windows/x86_64](../../../binaries/windows/x86_64/) and run [binaries/windows/x86_64/parser.bat](../../../binaries/windows/x86_64/parser.bat). You can edit this file to use your own txt file. 27 | 28 | 29 | # Building # 30 | 31 | This sample contains [a single C++ source file](main.cxx) and is easy to build. 32 | 33 | 34 | ## Android ## 35 | Please check [android](../../android) folder for Android samples. 36 | 37 | 38 | ## iOS ## 39 | Please check [iOS](../../ios) folder for iOS samples. 40 | 41 | 42 | ## Windows ## 43 | You'll need Visual Studio to build the code. The VS project is at [parser.vcxproj](parser.vcxproj). Open it. 44 | 1. You will need to change the **"Command Arguments"** like the [below image](../../../VC++_config.jpg). Default value: `$(ProjectDir)..\..\..\assets\samples\td1.txt`. 45 | 46 | ![VC++ config](../../../VCpp_config.jpg) 47 | 48 | You're now ready to build and run the sample. 49 | 50 | 51 | ## Generic GCC ## 52 | Next command is a generic GCC command: 53 | ``` 54 | cd ultimateMRZ-SDK/samples/c++/parser 55 | 56 | g++ main.cxx -O3 -o parser 57 | ``` 58 | - If you're cross compiling then, you'll have to change `g++` with the correct triplet. For example, on Android ARM64 the triplet would be equal to `aarch64-linux-android-g++`. 59 | 60 | 61 | ## Raspberry Pi (Raspbian OS) ## 62 | 63 | To build the sample for Raspberry Pi you can either do it on the device itself or cross compile it on [Windows](../README.md#cross-compilation-rpi-install-windows), [Linux](../README.md#cross-compilation-rpi-install-ubuntu) or OSX machines. 64 | For more information on how to install the toolchain for cross compilation please check [here](../README.md#cross-compilation-rpi). 65 | 66 | ``` 67 | cd ultimateMRZ-SDK/samples/c++/parser 68 | 69 | arm-linux-gnueabihf-g++ main.cxx -O3 -o parser 70 | ``` 71 | - On Windows: replace `arm-linux-gnueabihf-g++` with `arm-linux-gnueabihf-g++.exe` 72 | - If you're building on the device itself: replace `arm-linux-gnueabihf-g++` with `g++` to use the default GCC 73 | 74 | 75 | # Testing # 76 | After [building](#building) the application you can test it on your local machine. 77 | 78 | 79 | ## Usage ## 80 | 81 | `parser` is a command line application with the following usage: 82 | ``` 83 | parser 84 | ``` 85 | - `` Path to txt file containing MRZ lines to parse. You can use default files at [../../../assets/samples/*.txt](../../../assets/samples). 86 | 87 | 88 | ## Examples ## 89 | 90 | For example, on **Raspberry Pi** you may call the parser application using the following command: 91 | ``` 92 | chmod +x ./parser 93 | ./parser ../../../assets/samples/td1.txt 94 | ``` 95 | 96 | 97 | -------------------------------------------------------------------------------- /samples/c++/parser/main.cxx: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2011-2020 Doubango Telecom 2 | * File author: Mamadou DIOP (Doubango Telecom, France). 3 | * License: For non commercial use only. 4 | * Source code: https://github.com/DoubangoTelecom/ultimateMRZ-SDK 5 | * WebSite: https://www.doubango.org/webapps/mrz/ 6 | */ 7 | // More info about parser application: https://www.doubango.org/SDKs/mrz/docs/MRZ_parser.html 8 | /* 9 | https://github.com/DoubangoTelecom/ultimateMRZ-SDK/blob/master/samples/c++/parser/README.md 10 | Usage: 11 | parser 12 | 13 | Example: 14 | parser C:/Projects/GitHub/ultimate/ultimateMRZ/SDK_dist/assets/samples/td1.txt 15 | 16 | */ 17 | #include "../mrz_parser.h" 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | int main(int argc, char *argv[]) 25 | { 26 | if (argc != 2) { 27 | ULTMRZ_SDK_PRINT_INFO( 28 | "\nUsage:\n" 29 | "parser \n" 30 | "\n" 31 | ); 32 | return -1; 33 | } 34 | 35 | // Build lines using data from the file 36 | const std::string filePath = argv[1]; 37 | FILE* fp = fopen(filePath.c_str(), "rb"); 38 | if (!fp) { 39 | ULTMRZ_SDK_PRINT_FATAL("Cannot open file: %s", filePath.c_str()); 40 | return -1; 41 | } 42 | 43 | struct stat st_; 44 | ULTMRZ_SDK_ASSERT(stat(filePath.c_str(), &st_) == 0); 45 | const size_t size = static_cast(st_.st_size); 46 | ULTMRZ_SDK_ASSERT(size > 0); 47 | 48 | void* data = malloc(size + 1); 49 | ULTMRZ_SDK_ASSERT(data != nullptr); 50 | ULTMRZ_SDK_ASSERT(size == fread(data, 1, size, fp)); 51 | fclose(fp); 52 | reinterpret_cast(data)[size] = '\0'; 53 | 54 | std::stringstream stream(reinterpret_cast(data)); 55 | free(data); 56 | std::vector lines; 57 | for (std::string line; std::getline(stream, line); ) { 58 | line.erase(std::remove(line.begin(), line.end(), '\n'), line.end()); 59 | line.erase(std::remove(line.begin(), line.end(), '\r'), line.end()); 60 | ULTMRZ_SDK_PRINT_INFO("Line #%zu: %s [%zu]", lines.size(), line.c_str(), line.size()); 61 | lines.push_back(line); 62 | } 63 | if (lines.size() != 2 && lines.size() != 3) { 64 | ULTMRZ_SDK_PRINT_FATAL("%zu not a valid number of lines. Expecting 2 or 3 lines", lines.size()); 65 | return -1; 66 | } 67 | 68 | // Make sure all lines have same length 69 | for (size_t i = 1; i < lines.size(); ++i) { 70 | if (lines.front().size() != lines[i].size()) { 71 | ULTMRZ_SDK_PRINT_FATAL("All lines must have same length: %zu != %zu", lines.front().size(), lines[i].size()); 72 | return false; 73 | } 74 | } 75 | 76 | // Process 77 | MrzData mrz_data; 78 | if (!__mrz_parser_process(lines, mrz_data)) { 79 | ULTMRZ_SDK_PRINT_FATAL("Processing failed"); 80 | return -1; 81 | } 82 | 83 | // Print result 84 | ULTMRZ_SDK_PRINT_INFO("========================="); 85 | switch (mrz_data.type) { 86 | case MRZ_DOCUMENT_TYPE_TD1: ULTMRZ_SDK_PRINT_INFO("=== Document Type: TD1 ==="); break; 87 | case MRZ_DOCUMENT_TYPE_TD2: ULTMRZ_SDK_PRINT_INFO("=== Document Type: TD2 ==="); break; 88 | case MRZ_DOCUMENT_TYPE_TD3: ULTMRZ_SDK_PRINT_INFO("=== Document Type: TD3 ==="); break; 89 | case MRZ_DOCUMENT_TYPE_MRVA: ULTMRZ_SDK_PRINT_INFO("=== Document Type: MRVA ==="); break; 90 | case MRZ_DOCUMENT_TYPE_MRVB: ULTMRZ_SDK_PRINT_INFO("=== Document Type: MRVB ==="); break; 91 | default: ULTMRZ_SDK_ASSERT(false); break; 92 | } 93 | for (const auto& field : mrz_data.fields) { 94 | ULTMRZ_SDK_PRINT_INFO("%s:\t%s", field.first.c_str(), field.second.c_str()); 95 | } 96 | ULTMRZ_SDK_PRINT_INFO("========================="); 97 | 98 | // Press any key to terminate 99 | ULTMRZ_SDK_PRINT_INFO("Press any key to terminate !!"); 100 | getchar(); 101 | 102 | return 0; 103 | } 104 | 105 | 106 | -------------------------------------------------------------------------------- /samples/c++/parser/parser.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "parser", "parser.vcxproj", "{7E50EDB1-CDCF-4AA6-9840-FB3AFEE1EE25}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug_sdk|x64 = Debug_sdk|x64 11 | Release_sdk|x64 = Release_sdk|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {7E50EDB1-CDCF-4AA6-9840-FB3AFEE1EE25}.Debug_sdk|x64.ActiveCfg = Debug_sdk|x64 15 | {7E50EDB1-CDCF-4AA6-9840-FB3AFEE1EE25}.Debug_sdk|x64.Build.0 = Debug_sdk|x64 16 | {7E50EDB1-CDCF-4AA6-9840-FB3AFEE1EE25}.Release_sdk|x64.ActiveCfg = Release_sdk|x64 17 | {7E50EDB1-CDCF-4AA6-9840-FB3AFEE1EE25}.Release_sdk|x64.Build.0 = Release_sdk|x64 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /samples/c++/parser/parser.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug_sdk 6 | x64 7 | 8 | 9 | Release_sdk 10 | x64 11 | 12 | 13 | 14 | {7E50EDB1-CDCF-4AA6-9840-FB3AFEE1EE25} 15 | Win32Proj 16 | parser 17 | 8.1 18 | 19 | 20 | 21 | Application 22 | true 23 | v140 24 | Unicode 25 | 26 | 27 | Application 28 | false 29 | v140 30 | true 31 | Unicode 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | true 47 | 48 | 49 | false 50 | 51 | 52 | 53 | 54 | 55 | Level3 56 | Disabled 57 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS 58 | true 59 | true 60 | 61 | 62 | Console 63 | true 64 | 65 | 66 | 67 | 68 | Level3 69 | 70 | 71 | MaxSpeed 72 | true 73 | true 74 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS 75 | true 76 | true 77 | 78 | 79 | Console 80 | true 81 | true 82 | true 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /samples/c++/parser/parser.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | 23 | 24 | Header Files 25 | 26 | 27 | -------------------------------------------------------------------------------- /samples/c++/recognizer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0) 2 | 3 | project(recognizer VERSION 1.0.0 LANGUAGES CXX C) 4 | 5 | #### ultimate Libraries #### 6 | add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../../../SDK_dev/lib build/ultimateMRZ/SDK_dev) 7 | 8 | include_directories( 9 | ${CMAKE_CURRENT_SOURCE_DIR}/../../../../SDK_dev/lib/include 10 | ) 11 | 12 | set(recognizer_SOURCES 13 | main.cxx 14 | ) 15 | 16 | ###### The executable ###### 17 | add_executable(recognizer ${recognizer_SOURCES}) 18 | 19 | ###### 3rd parties libs ###### 20 | target_link_libraries(recognizer ${LIB_LINK_SCOPE} ultimate_mrz-sdk) 21 | add_dependencies(recognizer ultimate_mrz-sdk) 22 | 23 | ###### Install Libs ###### 24 | install(TARGETS recognizer DESTINATION bin) 25 | -------------------------------------------------------------------------------- /samples/c++/recognizer/recognizer.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "recognizer", "recognizer.vcxproj", "{9627900B-1A92-4B61-BC66-78642A49540B}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug_sdk|x64 = Debug_sdk|x64 11 | Release_sdk|x64 = Release_sdk|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {9627900B-1A92-4B61-BC66-78642A49540B}.Debug_sdk|x64.ActiveCfg = Debug_sdk|x64 15 | {9627900B-1A92-4B61-BC66-78642A49540B}.Debug_sdk|x64.Build.0 = Debug_sdk|x64 16 | {9627900B-1A92-4B61-BC66-78642A49540B}.Release_sdk|x64.ActiveCfg = Release_sdk|x64 17 | {9627900B-1A92-4B61-BC66-78642A49540B}.Release_sdk|x64.Build.0 = Release_sdk|x64 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /samples/c++/recognizer/recognizer.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | 23 | 24 | Header Files 25 | 26 | 27 | -------------------------------------------------------------------------------- /samples/c++/runtimeKey/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0) 2 | 3 | project(runtimeKey VERSION 1.0.0 LANGUAGES CXX C) 4 | 5 | #### ultimate Libraries #### 6 | add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../../../SDK_dev/lib build/ultimateMRZ/SDK_dev) 7 | 8 | include_directories( 9 | ${CMAKE_CURRENT_SOURCE_DIR}/../../../../SDK_dev/lib/include 10 | ) 11 | 12 | set(runtimeKey_SOURCES 13 | main.cxx 14 | ) 15 | 16 | ###### The executable ###### 17 | add_executable(runtimeKey ${runtimeKey_SOURCES}) 18 | 19 | ###### 3rd parties libs ###### 20 | target_link_libraries(runtimeKey ${LIB_LINK_SCOPE} ultimate_mrz-sdk) 21 | add_dependencies(runtimeKey ultimate_mrz-sdk) 22 | 23 | ###### Install Libs ###### 24 | install(TARGETS runtimeKey DESTINATION bin) 25 | -------------------------------------------------------------------------------- /samples/c++/runtimeKey/runtimeKey.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "runtimeKey", "runtimeKey.vcxproj", "{4F2E95FE-E2CA-42A5-BC03-5103FE9326B2}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug_sdk|x64 = Debug_sdk|x64 11 | Release_sdk|x64 = Release_sdk|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {4F2E95FE-E2CA-42A5-BC03-5103FE9326B2}.Debug_sdk|x64.ActiveCfg = Debug_sdk|x64 15 | {4F2E95FE-E2CA-42A5-BC03-5103FE9326B2}.Debug_sdk|x64.Build.0 = Debug_sdk|x64 16 | {4F2E95FE-E2CA-42A5-BC03-5103FE9326B2}.Release_sdk|x64.ActiveCfg = Release_sdk|x64 17 | {4F2E95FE-E2CA-42A5-BC03-5103FE9326B2}.Release_sdk|x64.Build.0 = Release_sdk|x64 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /samples/c++/runtimeKey/runtimeKey.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /samples/c++/validation/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0) 2 | 3 | project(validation VERSION 1.0.0 LANGUAGES CXX C) 4 | 5 | #### ultimate Libraries #### 6 | add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../../../SDK_dev/lib build/ultimateMRZ/SDK_dev) 7 | 8 | include_directories( 9 | ${CMAKE_CURRENT_SOURCE_DIR}/../../../../SDK_dev/lib/include 10 | ) 11 | 12 | set(validation_SOURCES 13 | main.cxx 14 | ) 15 | 16 | ###### The executable ###### 17 | add_executable(validation ${validation_SOURCES}) 18 | 19 | ###### 3rd parties libs ###### 20 | target_link_libraries(validation ${LIB_LINK_SCOPE} ultimate_mrz-sdk) 21 | add_dependencies(validation ultimate_mrz-sdk) 22 | 23 | ###### Install Libs ###### 24 | install(TARGETS validation DESTINATION bin) 25 | -------------------------------------------------------------------------------- /samples/c++/validation/README.md: -------------------------------------------------------------------------------- 1 | - [Pre-built binaries](#prebuilt) 2 | - [Building](#building) 3 | - [Android](#building-android) 4 | - [iOS](#building-ios) 5 | - [Windows](#building-windows) 6 | - [Generic GCC](#building-generic-gcc) 7 | - [Raspberry Pi (Raspbian OS)](#building-rpi) 8 | - [Testing](#testing) 9 | - [Usage](#testing-usage) 10 | - [Examples](#testing-examples) 11 | 12 | This sample application validates MRZ fields (document number, birth date, expiry date...). The algorithm is explained at https://www.doubango.org/SDKs/mrz/docs/Data_validation.html. 13 | 14 | This sample is standalone application with no dependencies. 15 | 16 | 17 | # Pre-built binaries # 18 | 19 | If you don't want to build this sample by yourself then, use the pre-built versions: 20 | - Windows: [validation.exe](../../../binaries/windows/x86_64/validation.exe) under [binaries/windows/x86_64](../../../binaries/windows/x86_64) 21 | - Linux: [validation](../../../binaries/linux/x86_64/validation) under [binaries/linux/x86_64](../../../binaries/linux/x86_64). Built on Ubuntu 18. 22 | - Raspberry Pi: [validation](../../../binaries/raspbian/armv7l/validation) under [binaries/raspbian/armv7l](../../../binaries/raspbian/armv7l) 23 | - Android: check [android](../../android) folder 24 | - iOS: check [ios](../../ios) folder 25 | 26 | On **Windows**, the easiest way to try this sample is to navigate to [binaries/windows/x86_64](../../../binaries/windows/x86_64/) and run [binaries/windows/x86_64/validation.bat](../../../binaries/windows/x86_64/validation.bat). You can edit this file to use your own txt file and configuration options. 27 | 28 | 29 | # Building # 30 | 31 | This sample contains [a single C++ source file](main.cxx) and is easy to build. 32 | 33 | 34 | ## Android ## 35 | Please check [android](../../android) folder for Android samples. 36 | 37 | 38 | ## iOS ## 39 | Please check [iOS](../../ios) folder for iOS samples. 40 | 41 | 42 | ## Windows ## 43 | You'll need Visual Studio to build the code. The VS project is at [validation.vcxproj](validation.vcxproj). Open it. 44 | 1. You will need to change the **"Command Arguments"** like the [below image](../../../VC++_config.jpg). Default value: `$(ProjectDir)..\..\..\assets\samples\td1.txt` 45 | 46 | ![VC++ config](../../../VCpp_config.jpg) 47 | 48 | You're now ready to build and run the sample. 49 | 50 | 51 | ## Generic GCC ## 52 | Next command is a generic GCC command: 53 | ``` 54 | cd ultimateMRZ-SDK/samples/c++/validation 55 | 56 | g++ main.cxx -O3 -o validation 57 | ``` 58 | - If you're cross compiling then, you'll have to change `g++` with the correct triplet. For example, on Android ARM64 the triplet would be equal to `aarch64-linux-android-g++`. 59 | 60 | 61 | ## Raspberry Pi (Raspbian OS) ## 62 | 63 | To build the sample for Raspberry Pi you can either do it on the device itself or cross compile it on [Windows](../README.md#cross-compilation-rpi-install-windows), [Linux](../README.md#cross-compilation-rpi-install-ubuntu) or OSX machines. 64 | For more information on how to install the toolchain for cross compilation please check [here](../README.md#cross-compilation-rpi). 65 | 66 | ``` 67 | cd ultimateMRZ-SDK/samples/c++/validation 68 | 69 | arm-linux-gnueabihf-g++ main.cxx -O3 -o validation 70 | ``` 71 | - On Windows: replace `arm-linux-gnueabihf-g++` with `arm-linux-gnueabihf-g++.exe` 72 | - If you're building on the device itself: replace `arm-linux-gnueabihf-g++` with `g++` to use the default GCC 73 | 74 | 75 | # Testing # 76 | After [building](#building) the application you can test it on your local machine. 77 | 78 | 79 | ## Usage ## 80 | 81 | `validation` is a command line application with the following usage: 82 | ``` 83 | validation 84 | ``` 85 | - `` Path to txt file containing MRZ lines to parse. You can use default files at [../../../assets/samples/*.txt](../../../assets/samples). 86 | 87 | 88 | ## Examples ## 89 | 90 | For example, on **Raspberry Pi** you may call the validation application using the following command: 91 | ``` 92 | chmod +x ./validation 93 | ./validation ../../../assets/samples/td1.txt 94 | ``` 95 | 96 | 97 | -------------------------------------------------------------------------------- /samples/c++/validation/validation.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /samples/csharp/README.md: -------------------------------------------------------------------------------- 1 | There is 1 C# sample (more will be added): [Recognizer](recognizer). Check [here](recognizer/README.md) on how to build. 2 | 3 | The C# samples are common to all platforms: **Android**, **Windows**, **iOS**, **Raspberry Pi (3 or 4)**, **Linux**... 4 | -------------------------------------------------------------------------------- /samples/csharp/recognizer/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /samples/csharp/recognizer/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("recognizer")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("recognizer")] 13 | [assembly: AssemblyCopyright("Copyright © 2020")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("a0decb92-8f4a-4dfe-bdc3-ebb54e85ca18")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /samples/csharp/recognizer/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace recognizer.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("recognizer.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized string similar to C:\Projects\GitHub\ultimate\ultimateALPR\WIN64_dist\samples\csharp\recognizer\ 65 | ///. 66 | /// 67 | internal static string RecognizerProjectDir { 68 | get { 69 | return ResourceManager.GetString("RecognizerProjectDir", resourceCulture); 70 | } 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /samples/csharp/recognizer/README.md: -------------------------------------------------------------------------------- 1 | - [Pre-built binaries](#prebuilt) 2 | - [Building](#building) 3 | - [Testing](#testing) 4 | - [Usage](#testing-usage) 5 | - [Examples](#testing-examples) 6 | 7 | 8 | This application is a reference implementation for developers to show how to use the C# API and could 9 | be used to easily check the accuracy. The C# API is a wrapper around the C++ API defined at [https://www.doubango.org/SDKs/mrz/docs/cpp-api.html](https://www.doubango.org/SDKs/mrz/docs/cpp-api.html). 10 | 11 | The application accepts path to a JPEG/PNG/BMP file as input. This **is not the recommended** way to use the API. We recommend reading the data directly from the camera and feeding the SDK with the uncompressed **YUV data** without saving it to a file or converting it to RGB. 12 | 13 | If you don't want to build this sample and is looking for a quick way to check the accuracy then, try 14 | our cloud-based solution at [https://www.doubango.org/webapps/mrz/](https://www.doubango.org/webapps/mrz/). 15 | 16 | This sample is open source and doesn't require registration or license key. 17 | 18 | 19 | # Pre-built binaries # 20 | 21 | If you don't want to build this sample by yourself then, use the pre-built C++ versions: 22 | - Windows: [recognizer.exe](../../../binaries/windows/x86_64/recognizer.exe) under [binaries/windows/x86_64](../../../binaries/windows/x86_64) 23 | - Linux: [recognizer](../../../binaries/linux/x86_64/recognizer) under [binaries/linux/x86_64](../../../binaries/linux/x86_64). Built on Ubuntu 18. 24 | - Raspberry Pi: [recognizer](../../../binaries/raspbian/armv7l/recognizer) under [binaries/raspbian/armv7l](../../../binaries/raspbian/armv7l) 25 | - Android: check [android](../../android) folder 26 | - iOS: check [ios](../../ios) folder 27 | 28 | On **Windows**, the easiest way to try this sample is to navigate to [binaries/windows/x86_64](../../../binaries/windows/x86_64/) and run [binaries/windows/x86_64/recognizer.bat](../../../binaries/windows/x86_64/recognizer.bat). You can edit these files to use your own images and configuration options. 29 | 30 | 31 | # Building # 32 | 33 | This sample contains [a single C# source file](Program.cs). 34 | 35 | You'll need Visual Studio to build the code. The VS project is at [recognizer.vcxproj](recognizer.vcxproj). Open it. 36 | - You will need to change the **"Command line arguments"** like the [below image](../../../VC#_config.jpg). Default value: `--assets "$(ProjectDir)..\..\..\assets" --image "$(ProjectDir)..\..\..\assets\images\Czech_passport_2005_MRZ_orient1_1300x1002.jpg"` 37 | 38 | ![VC# config](../../../VCsharp_config.jpg) 39 | 40 | You're now ready to build and run the sample. 41 | 42 | 43 | ## Usage ## 44 | 45 | `recognizer` is a command line application with the following usage: 46 | ``` 47 | recognizer \ 48 | --image \ 49 | [--assets ] \ 50 | [--tokenfile ] \ 51 | [--tokendata ] 52 | ``` 53 | Options surrounded with **[]** are optional. 54 | - `--image` Path to the image(JPEG/PNG/BMP) to process. You can use default image at [../../../assets/images/Czech_passport_2005_MRZ_orient1_1300x1002.jpg](../../../assets/images/Czech_passport_2005_MRZ_orient1_1300x1002.jpg). 55 | - `--assets` Path to the [assets](../../../assets) folder containing the configuration files and models. Default value is the current folder. 56 | - `--tokenfile` Path to the file containing the base64 license token if you have one. If not provided then, the application will act like a trial version. Default: *null*. 57 | - `--tokendata` Base64 license token if you have one. If not provided then, the application will act like a trial version. Default: *null*. 58 | 59 | 60 | ## Examples ## 61 | You'll need to change the Visual Studio properties to define the command line arguments. 62 | 63 | ``` 64 | recognizer.exe \ 65 | --image ../../../assets/images/Czech_passport_2005_MRZ_orient1_1300x1002.jpg \ 66 | --assets ../../../assets 67 | ``` 68 | 69 | Please note that if you're cross compiling the application then you've to make sure to copy the application and both the [assets](../../../assets) and [binaries](../../../binaries) folders to the target device. 70 | 71 | 72 | -------------------------------------------------------------------------------- /samples/csharp/recognizer/Resources/RecognizerProjectDir.txt: -------------------------------------------------------------------------------- 1 | C:\Projects\GitHub\ultimate\ultimateMRZ-SDK\samples\csharp\recognizer\ 2 | -------------------------------------------------------------------------------- /samples/csharp/recognizer/recognizer.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {A0DECB92-8F4A-4DFE-BDC3-EBB54E85CA18} 8 | Exe 9 | Properties 10 | recognizer 11 | recognizer 12 | v4.5.2 13 | 512 14 | true 15 | 16 | 17 | x64 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | true 26 | false 27 | 28 | 29 | AnyCPU 30 | pdbonly 31 | true 32 | bin\Release\ 33 | TRACE 34 | prompt 35 | 4 36 | false 37 | false 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | ultimateMrzSdk.cs 54 | 55 | 56 | ultimateMrzSdkPINVOKE.cs 57 | 58 | 59 | UltMrzSdkEngine.cs 60 | 61 | 62 | UltMrzSdkResult.cs 63 | 64 | 65 | ULTMRZ_SDK_IMAGE_TYPE.cs 66 | 67 | 68 | 69 | 70 | True 71 | True 72 | Resources.resx 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | ResXFileCodeGenerator 81 | Resources.Designer.cs 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | xcopy /y /d "$(ProjectDir)..\..\..\binaries\windows\x86_64\*.dll" "$(ProjectDir)$(OutDir)" 90 | 91 | 92 | echo $(ProjectDir) > "$(ProjectDir)\Resources\RecognizerProjectDir.txt" 93 | 94 | 101 | -------------------------------------------------------------------------------- /samples/csharp/recognizer/recognizer.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "recognizer", "recognizer.csproj", "{A0DECB92-8F4A-4DFE-BDC3-EBB54E85CA18}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {A0DECB92-8F4A-4DFE-BDC3-EBB54E85CA18}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {A0DECB92-8F4A-4DFE-BDC3-EBB54E85CA18}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {A0DECB92-8F4A-4DFE-BDC3-EBB54E85CA18}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {A0DECB92-8F4A-4DFE-BDC3-EBB54E85CA18}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /samples/ios/Benchmark/Benchmark.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /samples/ios/Benchmark/Benchmark.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /samples/ios/Benchmark/Benchmark/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2011-2019 Doubango Telecom 2 | * File author: Mamadou DIOP (Doubango Telecom, France). 3 | * License: For non commercial use only. 4 | * Source code: https://github.com/DoubangoTelecom/ultimateMRZ-SDK 5 | * WebSite: https://www.doubango.org/webapps/mrz/ 6 | */ 7 | 8 | #import 9 | 10 | @interface AppDelegate : UIResponder 11 | 12 | @property (strong, nonatomic) UIWindow *window; 13 | 14 | 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /samples/ios/Benchmark/Benchmark/AppDelegate.mm: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2011-2019 Doubango Telecom 2 | * File author: Mamadou DIOP (Doubango Telecom, France). 3 | * License: For non commercial use only. 4 | * Source code: https://github.com/DoubangoTelecom/ultimateMRZ-SDK 5 | * WebSite: https://www.doubango.org/webapps/mrz/ 6 | */ 7 | 8 | #import "AppDelegate.h" 9 | #import /* Public header for MRZ/MRTD framework */ 10 | 11 | using namespace ultimateMrzSdk; /* MRZ/MRTD engine C++ namespace */ 12 | 13 | // Configuration for MRZ/MRTD deep learning engine 14 | static const char* kUltimateMrzConfig = 15 | "{" 16 | "\"debug_level\": \"info\"," 17 | "\"debug_write_input_image_enabled\": false," 18 | "\"debug_internal_data_path\": \".\"," 19 | "" 20 | "\"num_threads\": -1," 21 | "\"gpgpu_enabled\": true," 22 | #if defined(__arm__) || defined(__thumb__) || defined(__TARGET_ARCH_ARM) || defined(__TARGET_ARCH_THUMB) || defined(_ARM) || defined(_M_ARM) || defined(_M_ARMT) || defined(__arm) || defined(__aarch64__) 23 | "\"gpgpu_workload_balancing_enabled\": true," 24 | #else // Disable GPGPU/CPU work balancing on x86 and enable it on ARM -> https://devtalk.nvidia.com/default/topic/494659/execute-kernels-without-100-cpu-busy-wait-/ 25 | "\"gpgpu_workload_balancing_enabled\": false," 26 | #endif 27 | "" 28 | "\"segmenter_accuracy\": \"high\"," 29 | "\"interpolation\": \"bilinear\"," 30 | "\"min_num_lines\": 2," 31 | "\"roi\": [0, 0, 0, 0]," 32 | "\"min_score\": 0.0" 33 | "}"; 34 | 35 | @interface AppDelegate () 36 | 37 | @end 38 | 39 | @implementation AppDelegate 40 | 41 | 42 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 43 | // Initialize the MRZ/MRTD engine 44 | // https://www.doubango.org/SDKs/mrz/docs/cpp-api.html#_CPPv4N14ultimateMrzSdk15UltMrzSdkEngine4initEPKc 45 | ULTMRZ_SDK_PRINT_INFO("Initializing the MRZ/MRTD engine..."); 46 | ULTMRZ_SDK_ASSERT(UltMrzSdkEngine::init(kUltimateMrzConfig).isOK()); 47 | 48 | return YES; 49 | } 50 | 51 | 52 | - (void)applicationWillResignActive:(UIApplication *)application { 53 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 54 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 55 | } 56 | 57 | 58 | - (void)applicationDidEnterBackground:(UIApplication *)application { 59 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 60 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 61 | } 62 | 63 | 64 | - (void)applicationWillEnterForeground:(UIApplication *)application { 65 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 66 | } 67 | 68 | 69 | - (void)applicationDidBecomeActive:(UIApplication *)application { 70 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 71 | } 72 | 73 | 74 | - (void)applicationWillTerminate:(UIApplication *)application { 75 | // DeInitialize the MRZ/MRTD engine 76 | // https://www.doubango.org/SDKs/mrz/docs/cpp-api.html#_CPPv4N14ultimateMrzSdk15UltMrzSdkEngine6deInitEv 77 | ULTMRZ_SDK_PRINT_INFO("DeInitializing the MRZ/MRTD engine..."); 78 | ULTMRZ_SDK_ASSERT(UltMrzSdkEngine::deInit().isOK()); 79 | 80 | } 81 | 82 | 83 | @end 84 | -------------------------------------------------------------------------------- /samples/ios/Benchmark/Benchmark/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | } 88 | ], 89 | "info" : { 90 | "version" : 1, 91 | "author" : "xcode" 92 | } 93 | } -------------------------------------------------------------------------------- /samples/ios/Benchmark/Benchmark/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /samples/ios/Benchmark/Benchmark/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /samples/ios/Benchmark/Benchmark/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | BenchmarkMRZ 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /samples/ios/Benchmark/Benchmark/ViewController.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2011-2019 Doubango Telecom 2 | * File author: Mamadou DIOP (Doubango Telecom, France). 3 | * License: For non commercial use only. 4 | * Source code: https://github.com/DoubangoTelecom/ultimateMRZ-SDK 5 | * WebSite: https://www.doubango.org/webapps/mrz/ 6 | */ 7 | 8 | #import 9 | 10 | @interface ViewController : UIViewController 11 | 12 | @end 13 | 14 | -------------------------------------------------------------------------------- /samples/ios/Benchmark/Benchmark/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Benchmark 4 | // 5 | // Created by Mamadou DIOP on 27/12/2019. 6 | // Copyright © 2019 Doubango Telecom. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /samples/ios/README.md: -------------------------------------------------------------------------------- 1 | This folder contains 2 sample applications for iOS 8.0+: [Benchmark](../../README.md#benchmark) and [VideoRecognizer](../../README.md#Sample-applications-Video-Recognizer). 2 | 3 | More information on how to try these samples could be found [here](../../README.md#Sample-applications-Trying-the-samples-iOS). 4 | -------------------------------------------------------------------------------- /samples/ios/VideoRecognizer/VideoRecognizer.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /samples/ios/VideoRecognizer/VideoRecognizer.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /samples/ios/VideoRecognizer/VideoRecognizer/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2011-2019 Doubango Telecom 2 | * File author: Mamadou DIOP (Doubango Telecom, France). 3 | * License: For non commercial use only. 4 | * Source code: https://github.com/DoubangoTelecom/ultimateMRZ-SDK 5 | * WebSite: https://www.doubango.org/webapps/mrz/ 6 | */ 7 | 8 | #import 9 | 10 | @interface AppDelegate : UIResponder 11 | 12 | @property (strong, nonatomic) UIWindow *window; 13 | 14 | 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /samples/ios/VideoRecognizer/VideoRecognizer/AppDelegate.mm: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2011-2019 Doubango Telecom 2 | * File author: Mamadou DIOP (Doubango Telecom, France). 3 | * License: For non commercial use only. 4 | * Source code: https://github.com/DoubangoTelecom/ultimateMRZ-SDK 5 | * WebSite: https://www.doubango.org/webapps/mrz/ 6 | */ 7 | 8 | #import "AppDelegate.h" 9 | #import /* Public header for MRZ/MRTD framework */ 10 | 11 | using namespace ultimateMrzSdk; /* MRZ/MRTD engine C++ namespace */ 12 | 13 | // Configuration for MRZ/MRTD deep learning engine 14 | static const char* kUltimateMrzConfig = 15 | "{" 16 | "\"debug_level\": \"info\"," 17 | "\"debug_write_input_image_enabled\": false," 18 | "\"debug_internal_data_path\": \".\"," 19 | "" 20 | "\"num_threads\": -1," 21 | "\"gpgpu_enabled\": true," 22 | #if defined(__arm__) || defined(__thumb__) || defined(__TARGET_ARCH_ARM) || defined(__TARGET_ARCH_THUMB) || defined(_ARM) || defined(_M_ARM) || defined(_M_ARMT) || defined(__arm) || defined(__aarch64__) 23 | "\"gpgpu_workload_balancing_enabled\": true," 24 | #else // Disable GPGPU/CPU work balancing on x86 and enable it on ARM -> https://devtalk.nvidia.com/default/topic/494659/execute-kernels-without-100-cpu-busy-wait-/ 25 | "\"gpgpu_workload_balancing_enabled\": false," 26 | #endif 27 | "" 28 | "\"segmenter_accuracy\": \"high\"," 29 | "\"interpolation\": \"bilinear\"," 30 | "\"min_num_lines\": 2," 31 | "\"roi\": [0, 0, 0, 0]," 32 | "\"min_score\": 0.0" 33 | "}"; 34 | 35 | @interface AppDelegate () 36 | 37 | @end 38 | 39 | @implementation AppDelegate 40 | 41 | 42 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 43 | // Initialize the MRZ/MRTD engine 44 | // https://www.doubango.org/SDKs/mrz/docs/cpp-api.html#_CPPv4N14ultimateMrzSdk15UltMrzSdkEngine4initEPKc 45 | ULTMRZ_SDK_PRINT_INFO("Initializing the MRZ/MRTD engine..."); 46 | ULTMRZ_SDK_ASSERT(UltMrzSdkEngine::init(kUltimateMrzConfig).isOK()); 47 | 48 | return YES; 49 | } 50 | 51 | 52 | - (void)applicationWillResignActive:(UIApplication *)application { 53 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 54 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 55 | } 56 | 57 | 58 | - (void)applicationDidEnterBackground:(UIApplication *)application { 59 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 60 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 61 | } 62 | 63 | 64 | - (void)applicationWillEnterForeground:(UIApplication *)application { 65 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 66 | } 67 | 68 | 69 | - (void)applicationDidBecomeActive:(UIApplication *)application { 70 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 71 | } 72 | 73 | 74 | - (void)applicationWillTerminate:(UIApplication *)application { 75 | // DeInitialize the MRZ/MRTD engine 76 | // https://www.doubango.org/SDKs/mrz/docs/cpp-api.html#_CPPv4N14ultimateMrzSdk15UltMrzSdkEngine6deInitEv 77 | ULTMRZ_SDK_PRINT_INFO("DeInitializing the MRZ/MRTD engine..."); 78 | ULTMRZ_SDK_ASSERT(UltMrzSdkEngine::deInit().isOK()); 79 | 80 | } 81 | 82 | 83 | @end 84 | -------------------------------------------------------------------------------- /samples/ios/VideoRecognizer/VideoRecognizer/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /samples/ios/VideoRecognizer/VideoRecognizer/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /samples/ios/VideoRecognizer/VideoRecognizer/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /samples/ios/VideoRecognizer/VideoRecognizer/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | UIAppFonts 6 | 7 | OcrB Regular.ttf 8 | 9 | NSCameraUsageDescription 10 | $(PRODUCT_NAME) requires access to your phone’s camera. 11 | CFBundleExecutable 12 | $(EXECUTABLE_NAME) 13 | CFBundleIdentifier 14 | $(PRODUCT_BUNDLE_IDENTIFIER) 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | $(PRODUCT_NAME) 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleVersion 24 | 1 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /samples/ios/VideoRecognizer/VideoRecognizer/ViewController.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2011-2019 Doubango Telecom 2 | * File author: Mamadou DIOP (Doubango Telecom, France). 3 | * License: For non commercial use only. 4 | * Source code: https://github.com/DoubangoTelecom/ultimateMRZ-SDK 5 | * WebSite: https://www.doubango.org/webapps/mrz/ 6 | */ 7 | 8 | #import 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /samples/ios/VideoRecognizer/VideoRecognizer/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // VideoRecognizer 4 | // 5 | // Created by Mamadou DIOP on 27/12/2019. 6 | // Copyright © 2019 Doubango Telecom. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /samples/java/README.md: -------------------------------------------------------------------------------- 1 | There is 1 Java sample (more will be added): [Recognizer](recognizer). Check [here](recognizer/README.md) on how to build. 2 | 3 | These Java samples are designed for Windows and Linux platforms. For Android, please check [android](../android) folder. 4 | -------------------------------------------------------------------------------- /samples/java/recognizer/README.md: -------------------------------------------------------------------------------- 1 | - [Pre-built binaries](#prebuilt) 2 | - [Building](#building) 3 | - [Testing](#testing) 4 | - [Usage](#testing-usage) 5 | - [Examples](#testing-examples) 6 | 7 | 8 | This application is a reference implementation for developers to show how to use the Java API and could 9 | be used to easily check the accuracy. The Java API is a wrapper around the C++ API defined at [https://www.doubango.org/SDKs/mrz/docs/cpp-api.html](https://www.doubango.org/SDKs/mrz/docs/cpp-api.html). 10 | 11 | The application accepts path to a JPEG/PNG/BMP file as input. This **is not the recommended** way to use the API. We recommend reading the data directly from the camera and feeding the SDK with the uncompressed **YUV data** without saving it to a file or converting it to RGB. 12 | 13 | If you don't want to build this sample and is looking for a quick way to check the accuracy then, try 14 | our cloud-based solution at [https://www.doubango.org/webapps/mrz/](https://www.doubango.org/webapps/mrz/). 15 | 16 | This sample is open source and doesn't require registration or license key. 17 | 18 | 19 | # Pre-built binaries # 20 | 21 | If you don't want to build this sample by yourself then, use the pre-built C++ versions: 22 | - Windows: [recognizer.exe](../../../binaries/windows/x86_64/recognizer.exe) under [binaries/windows/x86_64](../../../binaries/windows/x86_64) 23 | - Linux: [recognizer](../../../binaries/linux/x86_64/recognizer) under [binaries/linux/x86_64](../../../binaries/linux/x86_64). Built on Ubuntu 18. 24 | - Raspberry Pi: [recognizer](../../../binaries/raspbian/armv7l/recognizer) under [binaries/raspbian/armv7l](../../../binaries/raspbian/armv7l) 25 | - Android: check [android](../../android) folder 26 | - iOS: check [ios](../../ios) folder 27 | 28 | On **Windows**, the easiest way to try this sample is to navigate to [binaries/windows/x86_64](../../../binaries/windows/x86_64/) and run [binaries/windows/x86_64/recognizer.bat](../../../binaries/windows/x86_64/recognizer.bat). You can edit these files to use your own images and configuration options. 29 | 30 | 31 | # Building # 32 | 33 | This sample contains [a single Java source file](Recognizer.java). 34 | 35 | Here is how to build the file using `javac`: 36 | ``` 37 | javac @sources.txt -d . 38 | ``` 39 | 40 | 41 | ## Usage ## 42 | 43 | `Recognizer` is a command line application with the following usage: 44 | ``` 45 | Recognizer \ 46 | --image \ 47 | [--assets ] \ 48 | [--tokenfile ] \ 49 | [--tokendata ] 50 | ``` 51 | Options surrounded with **[]** are optional. 52 | - `--image` Path to the image(JPEG/PNG/BMP) to process. You can use default image at [../../../assets/images/Czech_passport_2005_MRZ_orient1_1300x1002.jpg](../../../assets/images/Czech_passport_2005_MRZ_orient1_1300x1002.jpg). 53 | - `--assets` Path to the [assets](../../../assets) folder containing the configuration files and models. Default value is the current folder. 54 | - `--tokenfile` Path to the file containing the base64 license token if you have one. If not provided then, the application will act like a trial version. Default: *null*. 55 | - `--tokendata` Base64 license token if you have one. If not provided then, the application will act like a trial version. Default: *null*. 56 | 57 | 58 | ## Examples ## 59 | You'll need to build the sample as explained [above](#building). 60 | 61 | ``` 62 | java Recognizer --image ../../../assets/images/Czech_passport_2005_MRZ_orient1_1300x1002.jpg --assets ../../../assets 63 | ``` 64 | 65 | Please note that if you're cross compiling the application then you've to make sure to copy the application and both the [assets](../../../assets) and [binaries](../../../binaries) folders to the target device. 66 | 67 | 68 | -------------------------------------------------------------------------------- /samples/java/recognizer/Recognizer.bat: -------------------------------------------------------------------------------- 1 | REM building 2 | javac @sources.txt -d . 3 | 4 | REM running 5 | java Recognizer --image ../../../assets/images/Czech_passport_2005_MRZ_orient1_1300x1002.jpg --assets ../../../assets -------------------------------------------------------------------------------- /samples/java/recognizer/Recognizer.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "..\\..\\..\\java\\org" 5 | } 6 | ] 7 | } -------------------------------------------------------------------------------- /samples/java/recognizer/sources.txt: -------------------------------------------------------------------------------- 1 | Recognizer.java 2 | ../../../java/org/doubango/ultimateMrz/Sdk/ultimateMrzSdk.java 3 | ../../../java/org/doubango/ultimateMrz/Sdk/ultimateMrzSdkConstants.java 4 | ../../../java/org/doubango/ultimateMrz/Sdk/ultimateMrzSdkJNI.java 5 | ../../../java/org/doubango/ultimateMrz/Sdk/ULTMRZ_SDK_IMAGE_TYPE.java 6 | ../../../java/org/doubango/ultimateMrz/Sdk/UltMrzSdkEngine.java 7 | ../../../java/org/doubango/ultimateMrz/Sdk/UltMrzSdkResult.java -------------------------------------------------------------------------------- /samples/python/README.md: -------------------------------------------------------------------------------- 1 | This folder contains Python samples. These samples work on all platforms (Windows, Linux, Raspberry Pi...). 2 | 3 | [**You must build the Python extension**](../../python/README.md) before trying these samples. More info on how to build the extension could be found [here](../../python/README.md). 4 | -------------------------------------------------------------------------------- /samples/python/recognizer/run_linux_x64.sh: -------------------------------------------------------------------------------- 1 | PYTHONPATH=../../../binaries/linux/x86_64:../../../python \ 2 | LD_LIBRARY_PATH=../../../binaries/linux/x86_64:$LD_LIBRARY_PATH \ 3 | python3 recognizer.py --image ../../../assets/images/Czech_passport_2005_MRZ_orient1_1300x1002.jpg --assets ../../../assets --backprop True --vcheck True --ielcd True -------------------------------------------------------------------------------- /samples/python/recognizer/run_rpi_armv7l.sh: -------------------------------------------------------------------------------- 1 | PYTHONPATH=../../../binaries/raspbian/armv7l:../../../python \ 2 | LD_LIBRARY_PATH=../../../binaries/raspbian/armv7l:$LD_LIBRARY_PATH \ 3 | python3 recognizer.py --image ../../../assets/images/Czech_passport_2005_MRZ_orient1_1300x1002.jpg --assets ../../../assets --backprop False --vcheck False --ielcd False -------------------------------------------------------------------------------- /samples/python/recognizer/run_windows_x64.bat: -------------------------------------------------------------------------------- 1 | setlocal 2 | set PYTHONPATH=../../../binaries/windows/x86_64;../../../python 3 | python recognizer.py --image ../../../assets/images/Czech_passport_2005_MRZ_orient1_1300x1002.jpg --assets ../../../assets --backprop True --vcheck True --ielcd True 4 | endlocal --------------------------------------------------------------------------------