Skip to main content

Crate fprint_bozorth3

Crate fprint_bozorth3 

Source
Expand description

§fprint-bozorth3

A pure-Rust, dependency-free reimplementation of BOZORTH3 — NIST NBIS’s minutiae fingerprint matcher, which tolerates rotation and translation between two impressions of a finger. Given two prints as lists of minutiae, it returns an integer match score reproducing the stock NBIS tool’s output; higher means more corresponding ridge structure.

The two tolerances differ in strength, and tests/properties.rs holds each to its claim:

  • Translation is exact. Shifting a print by any whole number of pixels does not move the score: stage 1 reads only dx/dy, and the one absolute-coordinate reader (the cluster centroid) enters the score only as a difference between two centroids of the same print. The centroid divides with truncation, so this holds while coordinate sums stay non-negative, which every real print satisfies.
  • Rotation is a threshold. Rotating a print runs its coordinates through trig and rounds them back to integers, changing the (x, y) sort order and so the rows stage 1 emits. A rotated impression does not reproduce the score; it keeps enough of it to out-score an unrelated print.

§Provenance

BOZORTH3 is public-domain U.S. Government software (title 17 §105). This crate is a faithful port of stock upstream NBIS (see docs/bozorth3-algorithm.md), verified black-box against the stock C tool; score-exactness requires following its arithmetic closely, which public domain permits. It is not derived from libfprint’s patched nbis/ copy, whose changes carry LGPL terms. The crate carries MIT OR Apache-2.0. See ARCHITECTURE.md §Provenance & licensing.

§Types

The crate takes its own Minutia ({ x, y, theta }) — the xyt triple is an interoperability fact, so the matcher stays a self-contained arithmetic kernel with no dependency on the domain model. A consumer (e.g. fprint-backend-native) converts its fprint_core::Minutia at the boundary — one map into Minutia:

use fprint_bozorth3::{match_score, Minutia, MIN_COMPUTABLE_BOZORTH_MINUTIAE};

// Your type, whatever it is.
struct MyMinutia { col: i32, row: i32, angle_deg: i32 }

fn to_bozorth(mine: &[MyMinutia]) -> Vec<Minutia> {
    mine.iter()
        .map(|m| Minutia { x: m.col, y: m.row, theta: m.angle_deg })
        .collect()
}

let mine: Vec<MyMinutia> = (0..12)
    .map(|i| MyMinutia { col: 20 + i * 9, row: 30 + (i * 17) % 40, angle_deg: (i * 30) % 360 })
    .collect();
let print = to_bozorth(&mine);

// Check the count before reading the score: under the minimum, 0 means "cannot tell".
assert!(print.len() >= MIN_COMPUTABLE_BOZORTH_MINUTIAE);
assert!(match_score(&print, &print) > 0);

Structs§

Minutia
One detected minutia: pixel position and ridge direction.

Constants§

DEFAULT_BOZORTH_MINUTIAE
DEFAULT_BOZORTH_MINUTIAE — default cap (max_minutiae).
MAX_BOZORTH_MINUTIAE
MAX_BOZORTH_MINUTIAE — hard cap on minutiae per print.
MIN_COMPUTABLE_BOZORTH_MINUTIAE
MIN_COMPUTABLE_BOZORTH_MINUTIAE — below this (either print) the score is 0.

Functions§

match_score
The BOZORTH3 match score between a probe and a gallery minutia set.