Utkarsh-Deshmukh / Fingerprint-Enhancement-Python

Using oriented gabor filters to enhance fingerprint images
BSD 2-Clause "Simplified" License
221 stars 103 forks source link

Issue in ridge_filter function in some of the images #23

Closed kapilsingla22 closed 1 year ago

kapilsingla22 commented 1 year ago

Hii Utkarsh, I am running it for my palm images and for some of the images it works perfectly well but for some of the images there is an error. Error is: index 0 is out of bounds for axis 0 with size 0 in function: __ridge_filter In line : sigmax = 1 / unfreq[0] * self.kx When i try to debug it i found that variable unfreq has shape as (0,). I don't know why for some of the images it is working but for other it is not. I am also attaching image for your reference. One more thing i have resized my current image and after resizing it is not working and if I pass the image without resizing it is working fine. But again i did'nt get the reason can you explain and tell me how to solve it. The following is without resizing 047_l_940_06 The following is after resizing. 047_l_940_06

Thanks Kapil singla

Utkarsh-Deshmukh commented 1 year ago

working on this. trying to recreate the issue on my end.

Utkarsh-Deshmukh commented 1 year ago

is this the full resolution image?

kapilsingla22 commented 1 year ago

I have orignal full hand image from that image i have extracted the ROI and after extracting the ROI which is the first image and then resize the image which is 2nd image

Utkarsh-Deshmukh commented 1 year ago

can you send me the full resolution image? I am unable to recreate this on my end.

Utkarsh-Deshmukh commented 1 year ago

?

kapilsingla22 commented 1 year ago

Sorry for late reply. Here is the actual image of hand

001_l_940_01

Utkarsh-Deshmukh commented 1 year ago

Has the algorithm worked on this image? Thats pretty awesome, since the algorithm is meant to be used on images from fingerprint sensors. those images look much different than this one.

kapilsingla22 commented 1 year ago

Not exact results but got pretty good results that can be further processed to get desired results.

yunping0111 commented 1 year ago

Hi, I'm using method 1 as README said, but I also get error: IndexError: index 0 is out of bounds for axis 0 with size 0 (by the way, I'm using images from https://www.kaggle.com/code/dijorajsenroy/fingerprint-feature-extraction-for-biometrics/input )

Utkarsh-Deshmukh commented 1 year ago

I tried to run the the algorithm on one of the images from the above link. Here are a couple of points that you can use to debug this: 1) use the resize=True parameter. by default this is False. This needs to be done in your case, since the images are very small in resolution. my arguments look something like this:

out = enhance_Fingerprint(img, resize=True)     # enhance the fingerprint image

The output image looks like this: image

2) If you dont want to resize the image, then it is harder since the resolution is so small that many of the parameters reach the extrema. one of the parameter set that seemed to work for me is:

out = enhance_Fingerprint(img, ridge_segment_blksze=8, min_wave_length=2, ridge_filter_thresh=-1)

The output looks like this: image

My recommendation is to use the resize with this parameter set:

    out = enhance_Fingerprint(img, resize=True, gradient_sigma=2, ridge_filter_thresh=-4, ridge_segment_thresh=0.3)     # enhance the fingerprint image

The output looks like this: image

kapilsingla22 commented 1 year ago

ok thanks utkarsh for your reply. I will look into that.