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

5 visualizzazioni (ultimi 30 giorni)
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)
  1 Commento
Imran Riaz
Imran Riaz il 22 Lug 2022
I am facing same issue. You resolved the problem if yes then help me please. Few images in my dataset have hairs on fingers.

Accedi per commentare.

Risposta accettata

Image Analyst
Image Analyst il 14 Gen 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 Commento
alqaed
alqaed il 5 Feb 2015
Modificato: alqaed il 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

Accedi per commentare.

Più risposte (1)

Bruno Pop-Stefanov
Bruno Pop-Stefanov il 14 Gen 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));
figure(1)
subplot(1,2,1)
imshow(BW)
subplot(1,2,2)
imshow(BW2)
replacedImage = roifill(I,BW2);
figure(2)
subplot(1,2,1)
imshow(I)
subplot(1,2,2)
imshow(replacedImage)
ll = edge (replacedImage,'canny');
figure(3)
imshow(ll)
The problem in the code you posted comes from the hairs image:
figure
imshow(hairs)
It is in fact a grayscale image with a majority of non-zero pixels:
figure
imshow(logical(hairs))
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:
figure
imhist(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!

Translated by