PLATFORMS << DESKTOP AND SERVER
MRZ Scanner for Linux
One shared library with a C API, for servers, containers and devices.
- Packagemrzscanner-linux (tar.gz)
- Requiresx86_64 or aarch64, glibc 2.17 and later
- Version2.5.0
Linuxc
#include "mrzscanner.h"
mrz_register_license("MRZ2...", "com.example.app", "", 4); /* 4: desktop */
mrz_status status;
mrz_scanner *scanner = mrz_scanner_create("/opt/mrzscanner/tessdata/", &status);
mrz_image image = {pixels, width, height, 0, MRZ_PIXEL_RGB8};
mrz_result *result = NULL;
if (mrz_scan_image(scanner, &image, NULL, &result) == MRZ_OK) {
puts(mrz_result_text(result)); /* the MRZ lines */
puts(mrz_result_json(result)); /* the parsed fields */
}How it starts
- 1Unpack the archive from Downloads (x86_64 or aarch64).
- 2Build with -I include -L lib -lmrzscanner, and an rpath to the lib folder.
- 3Call mrz_register_license once, create a scanner with the tessdata folder, and pass images to mrz_scan_image.
Install
The archive with libmrzscanner.so, the header and an example is under Downloads in the portal. It runs on any distribution since 2014, with no other dependencies.
Scan a document
Linuxc
#include "mrzscanner.h"
mrz_register_license("MRZ2...", "com.example.app", "", 4); /* 4: desktop */
mrz_status status;
mrz_scanner *scanner = mrz_scanner_create("/opt/mrzscanner/tessdata/", &status);
mrz_image image = {pixels, width, height, 0, MRZ_PIXEL_RGB8};
mrz_result *result = NULL;
if (mrz_scan_image(scanner, &image, NULL, &result) == MRZ_OK) {
puts(mrz_result_text(result)); /* the MRZ lines */
puts(mrz_result_json(result)); /* the parsed fields */
}
mrz_result_free(result);
mrz_scanner_destroy(scanner);