### Run MRZ Parser Sample Source: https://github.com/doubangotelecom/ultimatemrz-sdk/blob/master/samples/c++/parser/README.md This example demonstrates how to make the compiled MRZ parser executable and run it with a sample MRZ file. This is typically done after building the application on a target system like Raspberry Pi. ```bash chmod +x ./parser ./parser ../../../assets/samples/td1.txt ``` -------------------------------- ### Raspberry Pi Recognizer Execution Example Source: https://github.com/doubangotelecom/ultimatemrz-sdk/blob/master/samples/c++/recognizer/README.md This example demonstrates how to run the 'recognizer' application on a Raspberry Pi. It sets the LD_LIBRARY_PATH to include the ARMv7l binaries and specifies the image, assets, and disables backpropagation, vertical check, and IELCD. ```bash LD_LIBRARY_PATH=../../../binaries/raspbian/armv7l:$LD_LIBRARY_PATH ./recognizer \ --image ../../../assets/images/Czech_passport_2005_MRZ_orient1_1300x1002.jpg \ --assets ../../../assets \ --backprop false --vcheck false --ielcd false ``` -------------------------------- ### Install Raspberry Pi Cross-Compilation Toolchain on Ubuntu Source: https://github.com/doubangotelecom/ultimatemrz-sdk/blob/master/samples/c++/README.md These commands install the necessary cross-compilation toolchain for Raspberry Pi on an Ubuntu system. This enables compiling C++ samples for the Raspberry Pi architecture. The commands update package lists and then install the 'crossbuild-essential-armhf' package. ```bash sudo apt-get update sudo apt-get install crossbuild-essential-armhf ``` -------------------------------- ### Linux x86_64 Recognizer Execution Example Source: https://github.com/doubangotelecom/ultimatemrz-sdk/blob/master/samples/c++/recognizer/README.md This example shows how to execute the 'recognizer' application on a Linux x86_64 system. It configures the LD_LIBRARY_PATH for x86_64 binaries and enables backpropagation, vertical check, and IELCD. ```bash LD_LIBRARY_PATH=../../../binaries/linux/x86_64:$LD_LIBRARY_PATH ./recognizer \ --image ../../../assets/images/Czech_passport_2005_MRZ_orient1_1300x1002.jpg \ --assets ../../../assets \ --backprop true --vcheck true --ielcd true ``` -------------------------------- ### Install Executable Source: https://github.com/doubangotelecom/ultimatemrz-sdk/blob/master/samples/c++/parser/CMakeLists.txt Installs the compiled 'parser' executable to the 'bin' directory on the target system. This makes the executable available for use after the build and installation process. ```cmake install(TARGETS parser DESTINATION bin) ``` -------------------------------- ### Windows x86_64 Recognizer Execution Example Source: https://github.com/doubangotelecom/ultimatemrz-sdk/blob/master/samples/c++/recognizer/README.md This example illustrates running the 'recognizer.exe' application on a Windows x86_64 system. It specifies the image and assets paths and enables backpropagation, vertical check, and IELCD. ```batch recognizer.exe ^ --image ../../../assets/images/Czech_passport_2005_MRZ_orient1_1300x1002.jpg ^ --assets ../../../assets ^ --backprop true --vcheck true --ielcd true ``` -------------------------------- ### Initialize and Process MRZ in C++ (Cross-Platform) Source: https://github.com/doubangotelecom/ultimatemrz-sdk/blob/master/README.md Initializes the UltimateMRZ SDK engine using a JSON configuration string and processes image data. This C++ example is suitable for iOS, Windows, Raspberry Pi, and Linux. It includes conditional compilation for GPGPU workload balancing on ARM architectures. The SDK is initialized before processing and de-initialized before exiting. ```cpp #include // C++ API: https://www.doubango.org/SDKs/mrz/docs/cpp-api.html // JSON configuration string // More info at https://www.doubango.org/SDKs/mrz/docs/Configuration_options.html static const char* __jsonConfig = "{" "\"debug_level\": \"info\"," "\"debug_write_input_image_enabled\": false," "\"debug_internal_data_path\": \".\"," "" "\"num_threads\": -1," "\"gpgpu_enabled\": true," #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__) "\"gpgpu_workload_balancing_enabled\": true," #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-/ "\"gpgpu_workload_balancing_enabled\": false," #endif "" "\"segmenter_accuracy\": \"high\"," "\"interpolation\": \"bilinear\"," "\"min_num_lines\": 2," "\"roi\": [0, 0, 0, 0], "\"min_score\": 0.0 "}"; // Local variable UltMrzSdkResult result(0, "OK", "{}"); // Initialize the engine (should be done once) ULTMRZ_SDK_ASSERT((result = UltMrzSdkEngine::init( __jsonConfig )).isOK()); // Processing (detection + recognition) // Call this function for every video frame const void* imageData = nullptr; ULTMRZ_SDK_ASSERT((*result_ = UltMrzSdkEngine::process( ULTMRZ_SDK_IMAGE_TYPE_RGB24, imageData, imageWidth, imageHeight )).isOK()); // DeInit // Call this function before exiting the app to free the allocate resources // You must not call process() after calling this function ULTMRZ_SDK_ASSERT((result = UltMrzSdkEngine::deInit()).isOK()); ``` -------------------------------- ### Run Java MRZ SDK Sample Source: https://github.com/doubangotelecom/ultimatemrz-sdk/blob/master/samples/java/recognizer/README.md This example shows how to execute the compiled Java `Recognizer` application from the command line. It specifies the input image file and the path to the assets folder containing configuration files and models. This is a typical usage scenario for testing the MRZ data extraction capabilities. ```bash java Recognizer --image ../../../assets/images/Czech_passport_2005_MRZ_orient1_1300x1002.jpg --assets ../../../assets ``` -------------------------------- ### Install Executable (CMake) Source: https://github.com/doubangotelecom/ultimatemrz-sdk/blob/master/samples/c++/recognizer/CMakeLists.txt Configures the installation of the recognizer executable to the 'bin' directory. ```cmake install(TARGETS recognizer DESTINATION bin) ``` -------------------------------- ### Build MRZ Parser with GCC Source: https://github.com/doubangotelecom/ultimatemrz-sdk/blob/master/samples/c++/parser/README.md This snippet shows how to build the MRZ parser application using GCC. It's a generic command applicable to systems with GCC installed. For cross-compilation, replace 'g++' with the appropriate triplet compiler. ```bash cd ultimateMRZ-SDK/samples/c++/parser g++ main.cxx -O3 -o parser ``` -------------------------------- ### Linux x86_64 MRZ Recognition Example Source: https://github.com/doubangotelecom/ultimatemrz-sdk/blob/master/samples/python/recognizer/README.md This command shows how to execute the MRZ recognizer on a Linux x86_64 system. It configures the `PYTHONPATH` and `LD_LIBRARY_PATH` for the respective binaries and Python extensions, then runs the `recognizer.py` script, enabling backpropagation, vertical check, and IELCD. ```bash PYTHONPATH=../../../binaries/linux/x86_64:../../../python \ LD_LIBRARY_PATH=../../../binaries/linux/x86_64:$LD_LIBRARY_PATH \ python recognizer.py --image ../../../assets/images/Czech_passport_2005_MRZ_orient1_1300x1002.jpg --assets ../../../assets --backprop true --vcheck true --ielcd true ``` -------------------------------- ### Raspberry Pi MRZ Recognition Example Source: https://github.com/doubangotelecom/ultimatemrz-sdk/blob/master/samples/python/recognizer/README.md This command demonstrates how to run the MRZ recognizer on a Raspberry Pi. It sets the `PYTHONPATH` and `LD_LIBRARY_PATH` environment variables to include the necessary binaries and Python extensions, then executes the `recognizer.py` script with specific image and asset paths, and disables backpropagation, vertical check, and IELCD. ```bash PYTHONPATH=../../../binaries/raspbian/armv7l:../../../python \ LD_LIBRARY_PATH=../../../binaries/raspbian/armv7l:$LD_LIBRARY_PATH \ python recognizer.py --image ../../../assets/images/Czech_passport_2005_MRZ_orient1_1300x1002.jpg --assets ../../../assets --backprop false --vcheck false --ielcd false ``` -------------------------------- ### Generate Azure Instance Runtime Key Source: https://github.com/doubangotelecom/ultimatemrz-sdk/blob/master/AWS.md Generates a runtime key for an Azure VM instance. This method attaches the license to the VM itself. Requires libcurl to be installed. ```bash ./runtimeKey --type azure-instance --assets ../../../assets ``` -------------------------------- ### Build MRZ Parser for Raspberry Pi with GCC Source: https://github.com/doubangotelecom/ultimatemrz-sdk/blob/master/samples/c++/parser/README.md This command builds the MRZ parser for Raspberry Pi using a specific GCC cross-compilation toolchain. It assumes the toolchain is installed and accessible. If building directly on the device, use the default 'g++'. ```bash cd ultimateMRZ-SDK/samples/c++/parser arm-linux-gnueabihf-g++ main.cxx -O3 -o parser ``` -------------------------------- ### Generate Azure BYOL Runtime Key Source: https://github.com/doubangotelecom/ultimatemrz-sdk/blob/master/AWS.md Generates a runtime key for Azure using the Bring Your Own License (BYOL) model. This method attaches the license to the hardware. Requires libcurl to be installed. ```bash ./runtimeKey --type azure-byol --assets ../../../assets ``` -------------------------------- ### Generate AWS Instance Runtime Key (C++) Source: https://github.com/doubangotelecom/ultimatemrz-sdk/blob/master/AWS.md Generates a runtime key for binding the SDK license to an AWS instance. This method uses libcurl to query instance-specific information. Ensure libcurl is installed on Linux or its DLLs are available on Windows. ```bash ./runtimeKey --type aws-instance --assets ../../../assets ``` -------------------------------- ### Windows x86_64 MRZ Recognition Example Source: https://github.com/doubangotelecom/ultimatemrz-sdk/blob/master/samples/python/recognizer/README.md This command illustrates running the MRZ recognizer on a Windows x86_64 system. It uses `setlocal` and `set` commands to configure the `PYTHONPATH` environment variable, then executes the `recognizer.py` script with MRZ processing options enabled. ```batch setlocal set PYTHONPATH=../../../binaries/windows/x86_64;../../../python python recognizer.py --image ../../../assets/images/Czech_passport_2005_MRZ_orient1_1300x1002.jpg --assets ../../../assets --backprop true --vcheck true --ielcd true endlocal ``` -------------------------------- ### Configure Benchmark Executable Build with CMake Source: https://github.com/doubangotelecom/ultimatemrz-sdk/blob/master/samples/c++/benchmark/CMakeLists.txt This CMake script sets up the build environment for the benchmark executable. It defines the minimum required CMake version, project name, languages (C++ and C), includes the ultimate MRZ SDK library, specifies source files, links necessary libraries, and configures installation. ```cmake cmake_minimum_required(VERSION 3.0) project(benchmark VERSION 1.0.0 LANGUAGES CXX C) #### ultimate Libraries #### add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../../../SDK_dev/lib build/ultimateMRZ/SDK_dev) include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/../../../../SDK_dev/lib/include ) set(benchmark_SOURCES main.cxx ) ###### The executable ###### add_executable(benchmark ${benchmark_SOURCES}) ###### 3rd parties libs ###### target_link_libraries(benchmark ${LIB_LINK_SCOPE} ultimate_mrz-sdk) add_dependencies(benchmark ultimate_mrz-sdk) ###### Install Libs ###### install(TARGETS benchmark DESTINATION bin) ``` -------------------------------- ### Configure RuntimeKey Executable Build with CMake Source: https://github.com/doubangotelecom/ultimatemrz-sdk/blob/master/samples/c++/runtimeKey/CMakeLists.txt This CMake script configures the build for the 'runtimeKey' executable. It sets the minimum CMake version, project name, and languages (CXX, C). It includes the ultimate MRZ SDK library and specifies the source file 'main.cxx'. The executable is then linked against the 'ultimate_mrz-sdk' library and installed into the 'bin' directory. ```cmake cmake_minimum_required(VERSION 3.0) project(runtimeKey VERSION 1.0.0 LANGUAGES CXX C) #### ultimate Libraries #### add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../../../SDK_dev/lib build/ultimateMRZ/SDK_dev) include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/../../../../SDK_dev/lib/include ) set(runtimeKey_SOURCES main.cxx ) ###### The executable ###### add_executable(runtimeKey ${runtimeKey_SOURCES}) ###### 3rd parties libs ###### target_link_libraries(runtimeKey ${LIB_LINK_SCOPE} ultimate_mrz-sdk) add_dependencies(runtimeKey ultimate_mrz-sdk) ###### Install Libs ###### install(TARGETS runtimeKey DESTINATION bin) ``` -------------------------------- ### Configure Windows Visual Studio Project for Recognizer Source: https://github.com/doubangotelecom/ultimatemrz-sdk/blob/master/samples/c++/recognizer/README.md Instructions for configuring the Visual Studio project for the recognizer sample on Windows. This involves setting the 'Command Arguments' to specify the input image and assets directory, and configuring the 'Environment' variable to include the necessary binaries path. ```text Command Arguments: --image $(ProjectDir)..\..\..\assets\images\Czech_passport_2005_MRZ_orient1_1300x1002.jpg --assets $(ProjectDir)..\..\..\assets Environment: PATH=$(VCRedistPaths)%PATH%;$(ProjectDir)..\..\..\binaries\windows\x86_64 ``` -------------------------------- ### Benchmark Application Usage Source: https://github.com/doubangotelecom/ultimatemrz-sdk/blob/master/samples/c++/benchmark/README.md This shows the command-line usage for the benchmark application. It accepts paths to positive and negative images for testing, optional asset folder, loop count, rate, and license token information. Optional arguments are enclosed in square brackets. ```bash benchmark \ --positive \ --negative \ [--assets ] \ [--loops ] \ [--rate ] \ [--tokenfile ] \ [--tokendata ] ``` -------------------------------- ### Install Validation Executable Source: https://github.com/doubangotelecom/ultimatemrz-sdk/blob/master/samples/c++/validation/CMakeLists.txt Configures the installation of the 'validation' executable to the 'bin' directory, making it accessible after the build process. ```cmake install(TARGETS validation DESTINATION bin) ``` -------------------------------- ### Build C++ Benchmark with Generic GCC Source: https://github.com/doubangotelecom/ultimatemrz-sdk/blob/master/samples/c++/benchmark/README.md This snippet shows how to compile the C++ benchmark application using a generic GCC compiler. It requires specifying the include paths, library paths, and the SDK library. You need to replace placeholders like and with actual values for your target system. For cross-compilation, the compiler command (e.g., g++) should be replaced with the appropriate cross-compilation toolchain triplet. ```bash cd ultimateMRZ-SDK/samples/c++/benchmark g++ main.cxx -O3 -I../../../c++ -L../../../binaries// -lultimate_mrz-sdk -o benchmark ``` -------------------------------- ### Run Benchmark on Windows x86_64 Source: https://github.com/doubangotelecom/ultimatemrz-sdk/blob/master/samples/c++/benchmark/README.md This command executes the benchmark application on a Windows x86_64 architecture. It directly calls the benchmark executable and provides paths to positive and negative images, assets, and benchmark parameters using caret (^) for line continuation. ```cmd benchmark.exe ^ --positive ../../../assets/images/Passport-Australia_1280x720.jpg ^ --negative ../../../assets/images/Passport-France_1200x864.jpg ^ --assets ../../../assets ^ --loops 100 ^ --rate 0.2 ``` -------------------------------- ### Build Recognizer with Generic GCC Source: https://github.com/doubangotelecom/ultimatemrz-sdk/blob/master/samples/c++/recognizer/README.md This command demonstrates how to build the recognizer sample using a generic GCC compiler. It requires specifying the correct paths for include and library directories, and the target architecture. Cross-compilation for different architectures like Android ARM64 is also supported by changing the compiler triplet. ```bash cd ultimateMRZ-SDK/samples/c++/recognizer g++ main.cxx -O3 -I../../../c++ -L../../../binaries// -lultimate_mrz-sdk -o recognizer ``` -------------------------------- ### Run Benchmark on Raspberry Pi (armv7l) Source: https://github.com/doubangotelecom/ultimatemrz-sdk/blob/master/samples/c++/benchmark/README.md This command executes the benchmark application on a Raspberry Pi (armv7l) architecture. It requires setting the LD_LIBRARY_PATH to include the necessary binaries and provides paths to positive and negative images, assets, and benchmark parameters. ```bash LD_LIBRARY_PATH=../../../binaries/raspbian/armv7l:$LD_LIBRARY_PATH ./benchmark \ --positive ../../../assets/images/Passport-Australia_1280x720.jpg \ --negative ../../../assets/images/Passport-France_1200x864.jpg \ --assets ../../../assets \ --loops 100 \ --rate 0.2 ``` -------------------------------- ### Build Recognizer for Raspberry Pi with GCC Source: https://github.com/doubangotelecom/ultimatemrz-sdk/blob/master/samples/c++/recognizer/README.md This command shows how to build the recognizer sample for Raspberry Pi using a specific GCC cross-compilation toolchain. It specifies the include and library paths for the Raspbian environment. The command can be adapted for building on the device itself by using the default 'g++' compiler. ```bash cd ultimateMRZ-SDK/samples/c++/recognizer arm-linux-gnueabihf-g++ main.cxx -O3 -I../../../c++ -L../../../binaries/raspbian/armv7l -lultimate_mrz-sdk -o recognizer ``` -------------------------------- ### Run Benchmark on Linux x86_64 Source: https://github.com/doubangotelecom/ultimatemrz-sdk/blob/master/samples/c++/benchmark/README.md This command executes the benchmark application on a Linux x86_64 architecture. It requires setting the LD_LIBRARY_PATH to include the necessary binaries and provides paths to positive and negative images, assets, and benchmark parameters. ```bash LD_LIBRARY_PATH=../../../binaries/linux/x86_64:$LD_LIBRARY_PATH ./benchmark \ --positive ../../../assets/images/Passport-Australia_1280x720.jpg \ --negative ../../../assets/images/Passport-France_1200x864.jpg \ --assets ../../../assets \ --loops 100 \ --rate 0.2 ``` -------------------------------- ### Add Raspberry Pi Toolchain to Windows PATH Source: https://github.com/doubangotelecom/ultimatemrz-sdk/blob/master/samples/c++/README.md This command adds the Raspberry Pi toolchain directory to the Windows PATH environment variable. This is necessary for cross-compiling C++ samples on Windows for the Raspberry Pi. Ensure the path 'C:\SysGCC\raspberry\bin' matches your installation directory. ```batch set PATH=%PATH%;C:\SysGCC\raspberry\bin ``` -------------------------------- ### Java MRZ SDK Sample Command Line Usage Source: https://github.com/doubangotelecom/ultimatemrz-sdk/blob/master/samples/java/recognizer/README.md This outlines the command-line interface for the `Recognizer` application, part of the UltimateMRZ SDK. It details the required `--image` argument for the input image and optional arguments like `--assets`, `--tokenfile`, and `--tokendata` for configuration and licensing. ```bash Recognizer \ --image \ [--assets ] \ [--tokenfile ] \ [--tokendata ] ``` -------------------------------- ### Android License Configuration Source: https://github.com/doubangotelecom/ultimatemrz-sdk/blob/master/PerAppLicense.md This JSON configuration entry is used to provide the license token to the MRZ engine. The license token is a base64 encrypted string containing the application identifier, allowed installers, and the signing certificate's fingerprint. This unlocks the SDK's features for your application. ```json { "license_token_data": "<< your base64 encoded license string here >>" } ``` -------------------------------- ### Recognize MRZ in C# for Windows Desktop Source: https://context7.com/doubangotelecom/ultimatemrz-sdk/llms.txt This C# code snippet shows how to initialize the UltimateMRZ SDK, load a bitmap image, handle EXIF orientation, and process the image for MRZ recognition. It uses P/Invoke and requires the System.Drawing and System.Web.Script.Serialization namespaces. ```csharp using System; using System.Drawing; using System.Drawing.Imaging; using org.doubango.ultimateMrz.Sdk; using System.Web.Script.Serialization; class MrzRecognizer { public static string RecognizeMrz(string imagePath, string assetsFolder) { // Build JSON configuration var config = new JavaScriptSerializer().Serialize(new { debug_level = "info", num_threads = -1, gpgpu_enabled = true, gpgpu_workload_balancing_enabled = false, backpropagation_enabled = true, vertical_check_enabled = true, ielcd_enabled = true, segmenter_accuracy = "high", interpolation = "bilinear", min_num_lines = 2, roi = new float[] { 0f, 0f, 0f, 0f }, min_score = 0.0, assets_folder = assetsFolder }); // Initialize SDK UltMrzSdkResult result = UltMrzSdkEngine.init(config); if (!result.isOK()) throw new Exception($"Init failed: {result.json()}"); // Load image Bitmap image = new Bitmap(imagePath); int bytesPerPixel = Image.GetPixelFormatSize(image.PixelFormat) >> 3; // Get EXIF orientation int orientation = 1; const int ExifOrientationTagId = 0x112; if (Array.IndexOf(image.PropertyIdList, ExifOrientationTagId) > -1) { orientation = image.GetPropertyItem(ExifOrientationTagId).Value[0]; } // Lock bitmap for processing BitmapData imageData = image.LockBits( new Rectangle(0, 0, image.Width, image.Height), ImageLockMode.ReadOnly, image.PixelFormat ); try { // Determine image type ULTMRZ_SDK_IMAGE_TYPE imageType = bytesPerPixel switch { 1 => ULTMRZ_SDK_IMAGE_TYPE.ULTMRZ_SDK_IMAGE_TYPE_Y, 3 => ULTMRZ_SDK_IMAGE_TYPE.ULTMRZ_SDK_IMAGE_TYPE_BGR24, 4 => ULTMRZ_SDK_IMAGE_TYPE.ULTMRZ_SDK_IMAGE_TYPE_BGRA32, _ => throw new Exception($"Unsupported BPP: {bytesPerPixel}") }; // Process image result = UltMrzSdkEngine.process( imageType, imageData.Scan0, (uint)imageData.Width, (uint)imageData.Height, (uint)(imageData.Stride / bytesPerPixel), orientation ); Console.WriteLine($"Result: {result.json()}"); return result.json(); } finally { image.UnlockBits(imageData); UltMrzSdkEngine.deInit(); } } } // Usage class Program { static void Main(string[] args) { string json = MrzRecognizer.RecognizeMrz( @"C:\images\passport.jpg", @"C:\ultimateMRZ-SDK\assets" ); } } ``` -------------------------------- ### Check GLIBC Version on Linux Source: https://github.com/doubangotelecom/ultimatemrz-sdk/blob/master/samples/c++/README.md This command displays the version of the GNU C Library (glibc) installed on a Linux system. The error message regarding 'GLIBC_2.27' not found indicates an outdated glibc version, and this command helps verify the current version to determine if an update is needed. ```bash ldd --version ``` -------------------------------- ### Build C++ Benchmark for Raspberry Pi with GCC Source: https://github.com/doubangotelecom/ultimatemrz-sdk/blob/master/samples/c++/benchmark/README.md This command compiles the C++ benchmark application for Raspberry Pi using an ARM cross-compilation toolchain. It specifies the include and library paths for the Raspbian OS and ARMv7l architecture. If building directly on the Raspberry Pi, replace the cross-compiler with the default 'g++'. On Windows, append '.exe' to the cross-compiler executable. ```bash cd ultimateMRZ-SDK/samples/c++/benchmark arm-linux-gnueabihf-g++ main.cxx -O3 -I../../../c++ -L../../../binaries/raspbian/armv7l -lultimate_mrz-sdk -o benchmark ``` -------------------------------- ### Build Java MRZ SDK Sample with javac Source: https://github.com/doubangotelecom/ultimatemrz-sdk/blob/master/samples/java/recognizer/README.md This snippet demonstrates how to compile the single Java source file for the MRZ SDK sample using the `javac` command. It utilizes a response file (`@sources.txt`) to manage the list of source files and specifies the output directory for the compiled class files. ```bash javac @sources.txt -d . ``` -------------------------------- ### Initialize SDK Engine with JSON Configuration (C++) Source: https://context7.com/doubangotelecom/ultimatemrz-sdk/llms.txt Initializes the ultimateMRZ-SDK engine using a JSON configuration string. This function must be called once before any processing. It configures parameters such as threading, GPU acceleration, segmentation accuracy, and recognition features. Dependencies include the 'ultimateMRZ-SDK-API-PUBLIC.h' header. ```cpp #include using namespace ultimateMrzSdk; // JSON configuration string static const char* jsonConfig = "{" "\"debug_level\": \"info\"," "\"debug_write_input_image_enabled\": false," "\"debug_internal_data_path\": \".\"," "\"num_threads\": -1," "\"gpgpu_enabled\": true," "\"gpgpu_workload_balancing_enabled\": false," "\"segmenter_accuracy\": \"high\"," "\"interpolation\": \"bilinear\"," "\"backpropagation_enabled\": true," "\"vertical_check_enabled\": true," "\"ielcd_enabled\": true," "\"min_num_lines\": 2," "\"roi\": [0, 0, 0, 0], "\"min_score\": 0.0, "\"assets_folder\": \"/path/to/assets\"" "}"; int main() { // Initialize the engine UltMrzSdkResult result = UltMrzSdkEngine::init(jsonConfig); if (!result.isOK()) { fprintf(stderr, "Init failed: %s\n", result.phrase()); return -1; } printf("Engine initialized successfully\n"); // ... perform processing ... return 0; } ``` -------------------------------- ### Build Runtime Key Generator for Raspberry Pi with GCC Source: https://github.com/doubangotelecom/ultimatemrz-sdk/blob/master/samples/c++/runtimeKey/README.md This snippet demonstrates building the runtime key generator for Raspberry Pi using an ARM cross-compilation toolchain. It specifies the target architecture and library path. Building directly on the device or cross-compiling on Windows are also mentioned. ```bash cd ultimateALPR-SDK/samples/c++/runtimeKey arm-linux-gnueabihf-g++ main.cxx -O3 -I../../../c++ -L../../../binaries/raspbian/armv7l -lultimate_mrz-sdk -o runtimeKey ``` -------------------------------- ### Build Runtime Key Generator with GCC Source: https://github.com/doubangotelecom/ultimatemrz-sdk/blob/master/samples/c++/runtimeKey/README.md This snippet shows a generic GCC command to build the runtime key generator application. It requires specifying the operating system and architecture for the library path. Cross-compilation is also supported by changing the compiler executable. ```bash cd ultimateMRZ-SDK/samples/c++/runtimeKey g++ main.cxx -O3 -I../../../c++ -L../../../binaries// -lultimate_mrz-sdk -o runtimeKey ``` -------------------------------- ### Define Executable Sources and Build Source: https://github.com/doubangotelecom/ultimatemrz-sdk/blob/master/samples/c++/parser/CMakeLists.txt Lists the source files that constitute the 'parser' executable and then defines the executable itself using the 'add_executable' command. This step compiles the specified source files into a runnable program. ```cmake set(parser_SOURCES main.cxx ) add_executable(parser ${parser_SOURCES}) ``` -------------------------------- ### Initialize and Process MRZ in Android (Java) Source: https://github.com/doubangotelecom/ultimatemrz-sdk/blob/master/README.md Initializes the UltimateMRZ SDK engine using a JSON configuration string and processes image data from a camera feed. It requires Android's ImageReader and Media API. The SDK is initialized in `onCreate` and de-initialized in `onDestroy`. ```java import org.doubango.ultimateMrz.Sdk.ULTMRZ_SDK_IMAGE_TYPE; import org.doubango.ultimateMrz.Sdk.UltMrzSdkEngine; import org.doubango.ultimateMrz.Sdk.UltMrzSdkResult; // JSON configuration string // More info at https://www.doubango.org/SDKs/mrz/docs/Configuration_options.html final static String CONFIG = "{" + "\"debug_level\": \"info\"," + "\"debug_write_input_image_enabled\": false," + "\"debug_internal_data_path\": \".\"," + "" + "\"num_threads\": -1," + "\"gpgpu_enabled\": true," + "\"gpgpu_workload_balancing_enabled\": true," + "" + "\"segmenter_accuracy\": \"high\"," + "\"interpolation\": \"bilinear\"," + "\"min_num_lines\": 2," + "\"roi\": [0, 0, 0, 0], + "\"min_score\": 0.0 "}"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Initialize the engine assert UltMrzSdkEngine.init( getAssets(), CONFIG ).isOK(); } // Camera listener: https://developer.android.com/reference/android/media/ImageReader.OnImageAvailableListener final ImageReader.OnImageAvailableListener mOnImageAvailableListener = new ImageReader.OnImageAvailableListener() { @Override public void onImageAvailable(ImageReader reader) { try { final Image image = reader.acquireLatestImage(); if (image == null) { return; } // MRZ recognition final int exifOrientation = 1; // Normal (landscape) - no rotation final Image.Plane[] planes = image.getPlanes(); final UltMrzSdkResult result = UltMrzSdkEngine.process( ULTMRZ_SDK_IMAGE_TYPE.ULTMRZ_SDK_IMAGE_TYPE_YUV420P, planes[0].getBuffer(), planes[1].getBuffer(), planes[2].getBuffer(), image.getWidth(), image.getHeight(), planes[0].getRowStride(), planes[1].getRowStride(), planes[2].getRowStride(), planes[1].getPixelStride(), exifOrientation ); assert result.isOK(); image.close(); } catch (final Exception e) { e.printStackTrace(); } } }; @Override public void onDestroy() { // DeInitialize the engine assert UltMrzSdkEngine.deInit().isOK(); super.onDestroy(); } ``` -------------------------------- ### Check Missing Libraries on Linux with ldd Source: https://github.com/doubangotelecom/ultimatemrz-sdk/blob/master/samples/c++/README.md The 'ldd' command is used on Linux to display the shared object dependencies of an executable or library. Running 'ldd libultimatePluginOpenVINO.so' will list all required libraries and indicate if any are missing, helping to diagnose loading errors. ```bash ldd libultimatePluginOpenVINO.so ``` -------------------------------- ### Runtime Key Generator Command Line Usage Source: https://github.com/doubangotelecom/ultimatemrz-sdk/blob/master/samples/c++/runtimeKey/README.md This snippet illustrates the command-line interface for the runtimeKey application. It shows optional arguments for JSON output, asset folder path, and host type for license attachment. ```bash runtimeKey \ [--json ] \ [--assets ] \ [--type ] ``` -------------------------------- ### Generate Runtime License Key - C++ Source: https://context7.com/doubangotelecom/ultimatemrz-sdk/llms.txt Generates a device-specific runtime license key. The engine must be initialized first. The function can return the key as a JSON object or a raw string. No internet connectivity is required for generation. ```cpp #include using namespace ultimateMrzSdk; void generateLicenseKey() { // Initialize engine first UltMrzSdkResult result = UltMrzSdkEngine::init(jsonConfig); if (!result.isOK()) return; // Get runtime license key as JSON result = UltMrzSdkEngine::requestRuntimeLicenseKey(false); if (result.isOK()) { printf("License key (JSON): %s\n", result.json()); // Output: {"key":"base64-encoded-device-specific-key"} } // Or get raw key string without JSON wrapper result = UltMrzSdkEngine::requestRuntimeLicenseKey(true); if (result.isOK()) { printf("License key (raw): %s\n", result.json()); } UltMrzSdkEngine::deInit(); } ``` -------------------------------- ### Initialize SDK Engine Source: https://context7.com/doubangotelecom/ultimatemrz-sdk/llms.txt Initializes the MRZ recognition engine using a JSON configuration string. This must be called before any processing operations. ```APIDOC ## UltMrzSdkEngine.init - Initialize the SDK Engine ### Description Initializes the MRZ recognition engine with a JSON configuration string. This function must be called once before any processing operations. It loads deep learning models and initializes GPU shaders. The configuration supports options for threading, GPU acceleration, segmentation accuracy, and various recognition features like backpropagation and image enhancement for low contrast documents (IELCD). ### Method `static UltMrzSdkResult init(const char* jsonConfig)` ### Parameters #### Request Body - **jsonConfig** (string) - Required - A JSON string containing configuration options for the SDK engine. ### Request Example ```cpp #include using namespace ultimateMrzSdk; // JSON configuration string static const char* jsonConfig = "{" "\"debug_level\": \"info\"," "\"debug_write_input_image_enabled\": false," "\"debug_internal_data_path\": \".\"," "\"num_threads\": -1," "\"gpgpu_enabled\": true," "\"gpgpu_workload_balancing_enabled\": false," "\"segmenter_accuracy\": \"high\"," "\"interpolation\": \"bilinear\"," "\"backpropagation_enabled\": true," "\"vertical_check_enabled\": true," "\"ielcd_enabled\": true," "\"min_num_lines\": 2," "\"roi\": [0, 0, 0, 0], "\"min_score\": 0.0, "\"assets_folder\": \"/path/to/assets\"" "}"; int main() { // Initialize the engine UltMrzSdkResult result = UltMrzSdkEngine::init(jsonConfig); if (!result.isOK()) { fprintf(stderr, "Init failed: %s\n", result.phrase()); return -1; } printf("Engine initialized successfully\n"); // ... perform processing ... return 0; } ``` ### Response #### Success Response (0) - **result** (UltMrzSdkResult) - An object indicating the success or failure of the initialization. #### Response Example (No specific JSON response for success, check `result.isOK()` and `result.phrase()` for status) ```