How to use imbinarize() on fingerprint? Different sensitivity gives same result.

2 views (last 30 days)
Hello,
I am preprocessing fingerprint images and have some trouble adaptively thresholding my filter output.
I get outputs like this:
I tried to binarize the image with
B = imbinarize(imageFiltered,'adaptive','Sensitivity',0.9);
but the output is rather bad and does not seem to depend on the sensitivity value. For 0.1 and 0.9 I get exactly (to the pixel) the same output. I also tried using the 'ForegroundPolarity' parameter with light and dark, which also did not seem to have an impact. Then I tried the adaptthresh() function
T = adaptthresh(imageFiltered,0.6);
I get a completely white picture - every pixel is 1, no pixel is 0 - again independently from the sensitivity I choose (in the range of 0.1 - 0.9). Am I using these functions incorrectly? How can I properly use the sensitivity value? At the moment I use a global threshold, but this works poorly on noisier images or images with locally varying intensities. Are there maybe other functions or methods to threshold those kind of images?
Thanks in advance for any help,
Kind regards,

Answers (2)

Image Analyst
Image Analyst on 20 Mar 2018
Looks like you're using anisotropic diffusion. https://www.mathworks.com/help/images/ref/imdiffusefilt.html
Maybe try a Hessian or Frangi filter to find ridges. Or try a mean shift filter to sharpen/steepen edges and flatten ridges. Check the File Exchange.
To see how others are processing fingerprints, go here: papers on fingerprint analysis

J_Matlab
J_Matlab on 21 Mar 2018
Thanks for the quick reply. I am actually trying to replicate one of the resources in your link (Hong et al. Fingerprint enhancement). The idea is to find the orientation and frequency in small subparts of the fingerprint and use Gabor filters to connect broken ridges and suppress noise. The picture I posted is the output of the Gabor filtering.
I like the idea of filtering again my filter output to enhance it, but at some point I still need to threshold it, because my final picture has to be binary. I did some more digging in the function documentation and some testing: it seems that imbinarize has problems when working with double matrices instead of uint8. This:
bin = imbinarize(imageFiltered,'adaptive','ForegroundPolarity','dark','Sensitivity',0.5);
gives the same output for all sensitivity values, but a small change to
bin = imbinarize(uint8(imageFiltered),'adaptive','ForegroundPolarity','dark','Sensitivity',0.5);
gives different outputs dependending on the sensitivity (assuming that imageFiltered has a range of 0 - 255). While this answers my initial question, now I am wondering what goes wrong here, since the documentation on imbinarize does not specify that the input has to be uint8. Is this a bug or intended and I am missing something?
  2 Comments
Image Analyst
Image Analyst on 21 Mar 2018
If it's double, it must be in the range of 0-1, not 0-255. Since you just used uint8() without scaling imageFiltered, then imageFiltered must be in the range 0-255. You could either pass it through im2double() or mat2gray() to change it to the range 0-1, or just convert it to uint8 on the original range double image, like you did.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!