How can I remove everything except leaves?

조회 수: 1 (최근 30일)
Oveis Hassanijalilian
Oveis Hassanijalilian 2014년 12월 2일
댓글: Mohammad Abouali 2014년 12월 2일
  댓글 수: 1
Oveis Hassanijalilian
Oveis Hassanijalilian 2014년 12월 2일
the small part of the finger above the leaf is really difficult for me to remove. I tried to remove it based on Hue, but it also remove the brown parts of the leaves.

댓글을 달려면 로그인하십시오.

채택된 답변

Mohammad Abouali
Mohammad Abouali 2014년 12월 2일
편집: Mohammad Abouali 2014년 12월 2일
Use a combination of hsv and activecontour
I=imread('Finger2.png');
hsv=rgb2hsv(I);
m=(hsv(:,:,1)>0.08 & hsv(:,:,1)<0.2);
m2=activecontour(hsv(:,:,1),m,'edge','ContractionBias',-0.1);
imshow(m2)
Movafagh bashi
  댓글 수: 2
Oveis Hassanijalilian
Oveis Hassanijalilian 2014년 12월 2일
Thank you for your response. I have a problem with this code. I think it is only usable in Matlab R2014b. I am using R2014a which I believe does not support 'ContractionBias'. I would appreciate if you could respond me. Mamnoon
Mohammad Abouali
Mohammad Abouali 2014년 12월 2일
mmmm.
How about this?
I=imread('Finger2.png');
hsv=rgb2hsv(I);
m=(hsv(:,:,1)>0.08 & hsv(:,:,1)<0.2);
m=imfill(m,'holes');
m=bwmorph(m,'majority',25);
m2=activecontour(hsv(:,:,1),m,'edge','SmoothFactor',1.5);
imshow(m2)
It doesn't work as good as last one though.
Try some dilation and erosion too.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Deepesh B
Deepesh B 2014년 12월 2일
hi
By
imtool
command find exact threshold for leaves color and apply segmentation for that color only finger will be automatically remove d
while fixing threshold use separate threshold for R, G, B with | & conditions

Community Treasure Hunt

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

Start Hunting!

Translated by