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.
This sample is standalone application with no dependencies.
If you don't want to build this sample by yourself then, use the pre-built versions:
- Windows: validation.exe under binaries/windows/x86_64
- Linux: validation under binaries/linux/x86_64. Built on Ubuntu 18.
- Raspberry Pi: validation 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/validation.bat. You can edit this file to use your own txt file and configuration options.
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 validation.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++/validation
g++ main.cxx -O3 -o validation
- 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++/validation
arm-linux-gnueabihf-g++ main.cxx -O3 -o validation
- 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.
validation
is a command line application with the following usage:
validation <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 validation application using the following command:
chmod +x ./validation
./validation ../../../assets/samples/td1.txt