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.
This sample is a standalone application with no dependencies.
If you don't want to build this sample by yourself then, use the pre-built versions:
- Windows: parser.exe under binaries/windows/x86_64
- Linux: parser under binaries/linux/x86_64. Built on Ubuntu 18. You'll need to download libtensorflow.so as explained here.
- Raspberry Pi: parser under binaries/raspbian/armv7l
- Android: check android folder
- iOS: check ios folder
On Windows, the easiest way to try this sample is to navigate to binaries/windows/x86_64 and run binaries/windows/x86_64/parser.bat. You can edit this file to use your own txt file.
This sample contains a single C++ source file and is easy to build.
Please check android folder for Android samples.
Please check iOS folder for iOS samples.
You'll need Visual Studio to build the code. The VS project is at parser.vcxproj. Open it.
- You will need to change the "Command Arguments" like the below image. Default value:
$(ProjectDir)..\..\..\assets\samples\td1.txt
.
You're now ready to build and run the sample.
Next command is a generic GCC command:
cd ultimateMRZ-SDK/samples/c++/parser
g++ main.cxx -O3 -o parser
- 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 toaarch64-linux-android-g++
.
To build the sample for Raspberry Pi you can either do it on the device itself or cross compile it on Windows, Linux or OSX machines. For more information on how to install the toolchain for cross compilation please check here.
cd ultimateMRZ-SDK/samples/c++/parser
arm-linux-gnueabihf-g++ main.cxx -O3 -o parser
- On Windows: replace
arm-linux-gnueabihf-g++
witharm-linux-gnueabihf-g++.exe
- If you're building on the device itself: replace
arm-linux-gnueabihf-g++
withg++
to use the default GCC
After building the application you can test it on your local machine.
parser
is a command line application with the following usage:
parser <path-to-file-containing mrz-lines>
<path-to-file-containing mrz-lines>
Path to txt file containing MRZ lines to parse. You can use default files at ../../../assets/samples/*.txt.
For example, on Raspberry Pi you may call the parser application using the following command:
chmod +x ./parser
./parser ../../../assets/samples/td1.txt