Skip to main content

Python Fingerprint Recognition

PyPI CI

Compare two fingerprint images using minutiae: the ridge endings and bifurcations that make each print unique. Built on NumPy, SciPy, scikit-image and OpenCV.

Two prints of the same finger, with the matches used to align them

How it works

  1. Contrast: CLAHE evens out the brightness of the scan.
  2. Enhancement: the image is normalised and segmented, local ridge orientation and frequency are estimated, and a bank of oriented Gabor filters turns it into a clean binary ridge map (Hong, Wan & Jain, 1998).
  3. Minutiae: the ridge map is thinned to one-pixel-wide lines, and the crossing number of each pixel marks ridge endings and bifurcations. Minutiae at the edge of the print, or crowded together (spurs and broken ridges), are discarded.
  4. Alignment: each minutia gets an ORB descriptor rotated to the local ridge direction. Descriptor matches propose correspondences, and the rotation, translation and scale that most of them agree on aligns the two prints. Every candidate transform is tried, so results are deterministic.
  5. Scoring: after alignment, minutiae that sit within 10 px of each other with ridge directions within 20° are paired one-to-one. The score is the number of pairs; 12 or more is a match (the classic "12-point" rule). The score is computed both ways and the lower one is kept, so the order of the prints doesn't matter.

On the sample images, the two same-finger pairs score 25 and 40 and the four different-finger pairs score 3 or less. Rotating a print by any angle doesn't change the verdict.

Installation

Requires Python 3.11 or newer.

pip install fingerprint-recognition

For the interactive --show window, install the plot extra: pip install "fingerprint-recognition[plot]".

Command line

fingerprint-recognition database/101_1.tif database/101_2.tif
Fingerprint matches. (25 paired minutiae, threshold 12)
Option Description
-t, --threshold Paired minutiae needed for a match (default 12)
--json Print the score, minutiae counts and verdict as JSON
--save PATH Write an image of the matches used to align the prints
--show Display the keypoints and matches (needs matplotlib)

The exit code is 0 on a match, 1 when the prints don't match and 2 if an image can't be read, so it can be used in scripts.

Python API

from fingerprint_recognition import compare

result = compare("database/101_1.tif", "database/101_2.tif")
print(result.score, result.is_match)
print(result.transform)  # 2x3 matrix mapping the first print onto the second

compare also accepts grayscale NumPy arrays. The steps are available on their own too: enhance returns the ridge map, extract_minutiae the minutiae, and extract_features / match_features let you extract features once and compare them many times.

Docker

docker build -t fingerprint-recognition .
docker run --rm -v "$PWD/database:/data" fingerprint-recognition 101_1.tif 101_2.tif

Paths are relative to /data in the container, so mount the folder that holds your images there.

Development

The project uses uv.

uv run pytest          # tests
uv run ruff check .    # lint
uv run ruff format .   # format
uv run mypy src        # type check

Limitations

This is a compact, readable pipeline for learning and experimenting, not a certified biometric system. It has only been checked on the four sample images (from FVC2002) and rotated copies of them. Before relying on the default threshold, measure false-accept and false-reject rates on a larger dataset such as the full FVC2002 databases. Don't use it for anything security-sensitive.

Credits

The enhancement step is based on Utkarsh Deshmukh's Fingerprint-Enhancement-Python, itself a port of Peter Kovesi's MATLAB code.

A write-up of the original version in Macedonian is in docs/.

License

MIT. The enhancement code keeps the notices of the works it is derived from; see THIRD_PARTY_NOTICES.md.

Metadata

Release files for fingerprint-recognition 2.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fingerprint-recognition 2.1.0
File Size Uploaded Provenance
fingerprint_recognition-2.1.0.tar.gz 392.3 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for fingerprint-recognition 2.1.0
File Interpreter ABI Platform
fingerprint_recognition-2.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 409.4 kB

Release files / fingerprint_recognition-2.1.0.tar.gz

Download URL fingerprint_recognition-2.1.0.tar.gz
Size 392.3 kB
Tags Source
SHA-256 checksum
How to use checksums
886bd612ed5777c80dec10c5c02c57d17376377036ed38d08df904862489ecc8
BLAKE2b-256 checksum
How to use checksums
bb46bc4c5686150d54527e4a354bc03d1a65b2bb81e47355d36a0829e845dc01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.

Transparency log

Release files / fingerprint_recognition-2.1.0-py3-none-any.whl

Download URL fingerprint_recognition-2.1.0-py3-none-any.whl
Size 17.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bc19eaff4f1355c820a41e11adeba2336cac1dc3060d26bad5406cbb720e51e5
BLAKE2b-256 checksum
How to use checksums
809935e001e4a69df59cd178fd6cddc236809bc0fef6612b3c7073ea6bbb04da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.

Transparency log

Security for fingerprint-recognition 2.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for fingerprint_recognition-2.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page