usnistgov / NFIQ2

Optical live-scan and ink fingerprint image quality assessment tool
https://www.nist.gov/services-resources/software/development-nfiq-20
Other
129 stars 57 forks source link

Off-by-one when cropping whitespace #298

Closed gfiumara closed 2 years ago

gfiumara commented 3 years ago

https://github.com/usnistgov/NFIQ2/blob/e6b40e7b3831d934cf84bcfd3baf106113e53a46/NFIQ2/NFIQ2Algorithm/src/nfiq2/nfiq2_fingerprintimagedata.cpp#L87

ISO/IEC 29794-4:2017, Section 5.1.4.2 states that the first/last occurrence where mu <= MU_THRESHOLD should be the first/last row/column in the image. We, however, set the top/left/bottom/right index to the index where the last occurrence of mu > MU_THRESHOLD, off by one row/column. When there is a single white row/column surrounding the image, it will not be cropped.

Fix by always setting the index to the loop iterator, such that the width and height are later calculated correctly.

(Submitted on behalf of the MITRE MTF and IQS Assessment team.)