how to remove hair , and find the center of finger knuckle

10 views (last 30 days)
alqaed on 29 Dec 2014
Edited: alqaed on 5 Feb 2015
I used this code to remove the hairs, but the result were not good & affected the canny edge detection of the image ( I want to remove the hairs only from the images which have it , and the unhaired one must not be affected when the code applied to it ) , it is important to know that the code must not exceed 100 msec.
se = strel('disk',5);
hairs = imbothat(T,se);
replacedImage = roifill(T,hairs);
figure(4), imshow(replacedImage);
ll = edge (replacedImage,'canny')
figure(5),imshow (ll)
at the next step I want to find the knuckle location. (image is attached for clearness)

Accepted Answer

Image Analyst
Image Analyst on 14 Jan 2015
You can't find the center of the knuckle if you don't have the entire knuckle in the image. And if you did have it, it's not clear why you think you need to remove the hairs to find it. Do you think that you need to find vertical wrinkles to know where the knuckle is laterally, and that that hairs might interfere with that if the hair go vertically?
  1 Comment
alqaed on 5 Feb 2015
I have the entire knuckle in the image , finding the center is an important step to avoid affect of the movement of finger in matching process. so I wanna remove hair to have more accurate image , & knuckle center for making movement of finger without effect on recognition process

Sign in to comment.

More Answers (1)

Bruno Pop-Stefanov
Bruno Pop-Stefanov on 14 Jan 2015
This is not perfect, but slightly better than the results you got:
I = rgb2gray(imread('06.jpg'));
se = strel('disk',5);
hairs = imbothat(I,se);
BW = hairs > 15;
BW2 = imdilate(BW,strel('disk',2));
replacedImage = roifill(I,BW2);
ll = edge (replacedImage,'canny');
The problem in the code you posted comes from the hairs image:
It is in fact a grayscale image with a majority of non-zero pixels:
When passing hairs to roifill, non-zero pixels indicate the regions to fill in the image. In other words, you are filling the majority of the image, instead of filling only the pixels corresponding to the hairs.
In my code I am creating BW as a binary image: roifill will fill pixels whose intensity values in hairs is greater than 15. Take a look at the histogram of hairs:
Most pixels have intensity < 50.
Dilating the BW image ensures that we are smearing the hairs and a little more.

Community Treasure Hunt

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

Start Hunting!