how to remove hair , and find the center of finger knuckle
4 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
Imran Riaz
2022 年 7 月 22 日
I am facing same issue. You resolved the problem if yes then help me please. Few images in my dataset have hairs on fingers.
採用された回答
Image Analyst
2015 年 1 月 14 日
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 件)
Bruno Pop-Stefanov
2015 年 1 月 14 日
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!