Use this file to discover all available pages before exploring further.
This guide will walk you through computing your first NFIQ2 quality score using the C++ API. You’ll learn how to load a fingerprint image, compute quality measures, and obtain a unified quality score.
This guide uses the C++ API. If you prefer using the command-line tool, see the CLI Reference documentation.
This single header provides access to all NFIQ2 functionality.
2
Load the Random Forest Model
NFIQ2 requires a trained random forest model to compute quality scores. You can either use an embedded model or load one at runtime.
Runtime Model Loading
Embedded Model
// Load model information fileNFIQ2::ModelInfo modelInfoObj { "nist_plain_tir-ink.txt" };// Initialize the algorithm with the modelNFIQ2::Algorithm model { modelInfoObj };
The model file (e.g., nist_plain_tir-ink.txt) is included in the NFIQ2 release packages.
// If built with embedded model, simply instantiateNFIQ2::Algorithm model {};// Verify the model is embeddedif (!model.isEmbedded()) { std::cerr << "Model is not embedded.\n"; return EXIT_FAILURE;}
Embedded models must be configured at compile time using CMake options.
3
Load Your Fingerprint Image
Create a FingerprintImageData object with your image data:
// Image parametersconst uint16_t PPI = 500; // NFIQ2 requires 500 PPIuint32_t width = 500; // Image width in pixelsuint32_t height = 500; // Image height in pixelsuint8_t fingerCode = 0; // Finger position code// Your raw image data (8-bit grayscale)std::shared_ptr<uint8_t> imageData = loadYourImage();// Create fingerprint image data objectNFIQ2::FingerprintImageData rawImage { imageData.get(), width * height, // Data size width, height, fingerCode, PPI};
NFIQ2 only operates on images captured at 500 PPI. Using images at different resolutions will produce erroneous results.
4
Compute Quality Measures
Calculate the native quality measures from the fingerprint image: