Skip to content

add sigfm algorithm implementation

Natasha England-Elbro requested to merge 0x00002a/libfprint:sigfm into master

This adds an implementation of the sigfm algorithm created by @mpi3d.

This algorithm is designed to work with small scanners, and can match off a single image rather than requiring a swipe with stitching. It has already been tested with the goodixtls 5110 sensor (#376) and seems to work.

PR outline

C++/sigfm side

  • sigfm is added as another library to be built, and put at the same level as the other algorithms (e.g. nbis) in the tree
  • the sigfm library depends on opencv (and also doctest for the tests), and is built with c++. I'm not 100% sure which version of c++ is needed but I would guess at c++17, I've avoided c++20 as I don't want to restrict the compiler versions we can use too much
  • the sigfm library offers a C API in sigfm.hpp (maybe should rename to .h? -- done) which forward declares the SigfmImgInfo struct and all the functions for dealing with the algorithm
  • the SigfmImgInfo struct stores the extracted keypoints and descriptors, and the C api deals in pointers to it. This lets the api communicate with C and be threaded through the libfprint internal api while still having access to c++ niceties like std::vector (and preventing us from having to convert the keypoints and descriptors to some C type)
  • serialisation and deserialisation to binary is also supported (needed by libfprint to store enrolled fingerprints), it uses a homemade stream struct and some template magic (which would be less horrible with c++20 concepts)

C/libfprint side

  • There is a new option for the image device class algorithm, which lets you pick between sigfm or nbis (defaulting to nbis), this is used to initialise prints which also store their algorithm (type)
  • FpImage's now store a SigfmImgInfo* alongside the minutiae, this will be uninitialised until fp_image_extract_sigfm_info is called (mirroring minutiae and fp_image_detect_minutiae), this is called automatically by fpi_image_device_image_captured if the device uses sigfm (same as for nbis and minutiae)
  • verification now checks the type of the print and either calls the bz3 matcher or the sigfm one

From the perspective of drivers, all thats needed is to add <image device class ptr>->algorithm = FPI_DEVICE_ALGO_SIGFM and libfprint will do the rest.

Breaking changes that need discussion

  • bz3_threshold is now also used for the threshold for sigfm scores. Ideally it would be renamed to like score_threshold or something but this would require refactoring all the existing drivers (which is piss easy with tooling but would be an api change going forward) -- renamed to score_threshold
Edited by Natasha England-Elbro

Merge request reports