Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/usnistgov/NFIQ2/llms.txt

Use this file to discover all available pages before exploring further.

Overview

The NFIQ2::Algorithm class applies trained random forest parameters to native quality measures, computing a unified quality score for fingerprint images. This is the primary class for performing NFIQ2 quality assessment.

Class Definition

namespace NFIQ2 {
    class Algorithm {
        // Public interface
    };
}

Constructors

Default Constructor

Algorithm();
Default constructor of Algorithm.
May load from parameters compiled into source code, in which case this can be slow.

File-based Constructor

Algorithm(const std::string &fileName, const std::string &fileHash);
Constructor that loads random forest parameters from disk.
fileName
const std::string &
The file path containing the random forest model.
fileHash
const std::string &
The md5 checksum of the provided file.

ModelInfo Constructor

Algorithm(const NFIQ2::ModelInfo &modelInfoObj);
Constructor using NFIQ2::ModelInfo to initialize the random forest.
modelInfoObj
const NFIQ2::ModelInfo &
Contains the random forest model and information about it.

Copy and Move Constructors

Algorithm(const Algorithm &);                    // Copy constructor
Algorithm &operator=(const Algorithm &);         // Assignment operator
Algorithm(Algorithm &&) noexcept;                // Move constructor
Algorithm &operator=(Algorithm &&) noexcept;     // Move assignment operator

Core Methods

computeUnifiedQualityScore (FingerprintImageData)

unsigned int computeUnifiedQualityScore(
    const NFIQ2::FingerprintImageData &rawImage) const;
Compute a unified quality score from a fingerprint image.
rawImage
const NFIQ2::FingerprintImageData &
Fingerprint image to analyze.
return
unsigned int
Computed unified quality score.
Throws: Exception if called before random forest parameters were loaded.

computeUnifiedQualityScore (Quality Measure Algorithms)

unsigned int computeUnifiedQualityScore(
    const std::vector<std::shared_ptr<NFIQ2::QualityMeasures::Algorithm>> &algorithms) const;
Compute a unified quality score from computed quality measure algorithms.
algorithms
const std::vector<std::shared_ptr<NFIQ2::QualityMeasures::Algorithm>> &
Computed quality measure algorithms.
return
unsigned int
Computed unified quality score.
Throws: Exception if called before random forest parameters were loaded.
See QualityMeasures::computeNativeQualityMeasureAlgorithms for computing quality measure algorithms.

computeUnifiedQualityScore (Features Map)

unsigned int computeUnifiedQualityScore(
    const std::unordered_map<std::string, double> &features) const;
Compute a unified quality score from a map of native quality measures.
features
const std::unordered_map<std::string, double> &
Map of quality measure algorithm identifiers to native quality measures.
return
unsigned int
Computed unified quality score.
Throws: Exception if called before random forest parameters were loaded.
See QualityMeasures::computeNativeQualityMeasures for computing native quality measures.

Quality Block Methods

getQualityBlockValues

static std::unordered_map<std::string, unsigned int> getQualityBlockValues(
    const std::unordered_map<std::string, double> &nativeQualityMeasureValues);
Obtain the quality block values (i.e., [0, 100]) for the native quality measure values.
nativeQualityMeasureValues
const std::unordered_map<std::string, double> &
Map of keys representing identifiers for the native quality measures (from nfiq2_constants.hpp), and values representing native quality measure values.
return
std::unordered_map<std::string, unsigned int>
Native quality measure values mapped [0, 100], per ISO/IEC 29794-4:2024, suitable for inclusion in an ISO/IEC 39794-2 quality block.
Throws: Exception if unrecognized key value in nativeQualityMeasureValues.

getQualityBlockValue

static unsigned int getQualityBlockValue(
    const std::string &nativeQualityMeasureIdentifier,
    const double nativeQualityMeasureValue);
Obtain the quality block value (i.e., [0, 100]) for a single native quality measure value.
nativeQualityMeasureIdentifier
const std::string &
Identifier for the native quality measure (from nfiq2_constants.hpp).
nativeQualityMeasureValue
double
Native quality measure value.
return
unsigned int
Native quality measure value mapped [0, 100], per ISO/IEC 29794-4:2024, suitable for inclusion in an ISO/IEC 39794-2 quality block.
Throws: Exception if unrecognized value for nativeQualityMeasureIdentifier.

State Methods

getParameterHash

std::string getParameterHash() const;
Obtain MD5 checksum of random forest parameter file loaded.
return
std::string
MD5 checksum of the random forest parameter file loaded.
Throws: Exception if called before random forest parameters were loaded.

isInitialized

bool isInitialized() const;
Determine if random forest parameters have been loaded.
return
bool
true if some set of random forest parameters have been loaded, false otherwise.

isEmbedded

bool isEmbedded() const;
Obtain if the random forest parameters are embedded in the library or located externally.
return
bool
true if random forest parameters are embedded, false otherwise.

getEmbeddedFCT

unsigned int getEmbeddedFCT() const;
Obtain the friction ridge capture technology (FCT) specified for the embedded random forest parameters.
return
unsigned int
Embedded FCT specified.
Throws: NFIQ2::Exception if parameters were not embedded or FCT was not specified.

Usage Example

#include <nfiq2_algorithm.hpp>
#include <nfiq2_fingerprintimagedata.hpp>

// Create algorithm with default embedded parameters
NFIQ2::Algorithm algorithm;

// Load fingerprint image
NFIQ2::FingerprintImageData imageData(pixels, size, width, height, fingerCode, 500);

// Compute quality score
unsigned int qualityScore = algorithm.computeUnifiedQualityScore(imageData);

See Also

Build docs developers (and LLMs) love