This application is used as reference code for developers to show how to use the C++ API and could be used to easily check the accuracy. 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.
If you don't want to build this sample and is looking for a quick way to check the accuracy then, try our cloud-based solution at https://www.doubango.org/webapps/micr/.
This sample is open source and doesn't require registration or license key.
By default GPU acceleration is disabled. Check here for more information on how to enable.
If you don't want to build this sample by yourself then, use the pre-built versions:
- Windows: recognizer.exe under binaries/windows/x86_64
- Linux: recognizer under binaries/linux/x86_64. Built on Ubuntu 18. You'll need to download libtensorflow.so as explained here.
- Raspberry Pi: recognizer under binaries/raspbian/armv7l
- Android: check android folder
On Windows, the easiest way to try this sample is to navigate to binaries/windows/x86_64 and run binaries/windows/x86_64/recognizer_cmc7.bat or binaries/windows/x86_64/recognizer_e13b.bat. You can edit these files to use your own images and configuration options.
This sample contains a single C++ source file and is easy to build. The documentation about the C++ API is at https://www.doubango.org/SDKs/micr/docs/cpp-api.html.
You'll need Visual Studio to build the code. The VS project is at recognizer.vcxproj. Open it.
- You will need to change the "Command Arguments" like the below image. Default value:
--image $(ProjectDir)..\..\..\assets\images\e13b_1280x720.jpg --format e13b+cmc7 --assets $(ProjectDir)..\..\..\assets
- You will need to change the "Environment" variable like the below image. Default value:
PATH=$(VCRedistPaths)%PATH%;$(ProjectDir)..\..\..\binaries\windows\x86_64
You're now ready to build and run the sample.
Next command is a generic GCC command:
cd ultimateMICR-SDK/samples/c++/recognizer
g++ recognizer.cxx -O3 -I../../../c++ -L../../../binaries/<yourOS>/<yourArch> -lultimate_micr-sdk -o recognizer
- You've to change
yourOS
andyourArch
with the correct values. For example, on Linux x86_64 they would be equal tolinux
andx86_64
respectively. - 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 ultimateMICR-SDK/samples/c++/recognizer
arm-linux-gnueabihf-g++ recognizer.cxx -O3 -I../../../c++ -L../../../binaries/raspbian/armv7l -lultimate_micr-sdk -o recognizer
- 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.
recognizer is a command line application with the following usage:
recognizer \
--image <path-to-image-with-to-process> \
[--assets <path-to-assets-folder>] \
[--format <format-for-dtection:e13b/cmc7/e13b+cmc7>] \
[--backprop <whether-to-enable-backpropagation:true/false>] \
[--ielcd <whether-to-enable-IELCD:true/false>] \
[--tokenfile <path-to-license-token-file>] \
[--tokendata <base64-license-token-data>]
Options surrounded with [] are optional.
--image
Path to the image(JPEG/PNG/BMP) to process. You can use default image at ../../../assets/images/e13b_1280x720.jpg.--assets
Path to the assets folder containing the configuration files and models. Default value is the current folder.--format
Defines the MICR format to enable for the detection. Usee13b
to look for E-13B lines only andcmc7
for CMC-7 lines only. To look for both, usee13b+cmc7
. For performance reasons you should not usee13b+cmc7
unless you really expect the document to contain both E-13B and CMC7 lines. Default:e13b+cmc7
.--backprop
Whether to enable backpropagation to detect the MICR lines. OnlyCMC-7
font uses this option. More information at https://www.doubango.org/SDKs/micr/docs/Detection_techniques.html#backpropagation. Default:true
for x86 CPUs andfalse
for ARM CPUs.--ielcd
Whether to enable Image Enhancement for Low Contrast Document (IELCD). More information at https://www.doubango.org/SDKs/micr/docs/IELCD.html#ielcd. Default:true
for x86 CPUs andfalse
for ARM CPUs.--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.--tokendata
Base64 license token if you have one. If not provided then, the application will act like a trial version. Default: null.
For example, on Raspberry Pi you may call the recognizer application using the following command:
LD_LIBRARY_PATH=../../../binaries/raspbian/armv7l:$LD_LIBRARY_PATH ./recognizer \
--image ../../../assets/images/cmc7_1280x720.jpg \
--assets ../../../assets \
--formay e13b+cmc7 \
--backprop true --ielcd true
On Linux x86_64, you may use the next command:
LD_LIBRARY_PATH=../../../binaries/linux/x86_64:$LD_LIBRARY_PATH ./recognizer \
--image ../../../assets/images/e13b_1280x720.jpg \
--assets ../../../assets \
--formay e13b+cmc7 \
--backprop true --ielcd true
On Windows x86_64, you may use the next command:
recognizer.exe ^
--image ../../../assets/images/e13b_1280x720.jpg ^
--assets ../../../assets ^
--format e13b+cmc7 ^
--backprop true --ielcd true
Please note that if you're cross compiling the application then you've to make sure to copy the application and both the assets and binaries folders to the target device.
This is a command-line application and the console doesn't support CMC-7 and E-13B fonts. The special characters will be mapped to ASCII alphabet as follow: