Hello, i am trying to extract an object from an image. I want to extract the butterfly from the image. I tried using otsu thresholding and the result i get are not satisfied. I want to extract it perfectly with just the butterfly only. Anyone can provide me some guidance?

 채택된 답변

Image Analyst
Image Analyst 2017년 4월 8일

1 개 추천

The computer doesn't know that butterflies aren't supposed to have pointy triangle heads so it would be hard to get rid of that part unless you had know shape templates that you could fit to it, perhaps using the Hausdorf distance.
To get rid of the black thing on the lower left, you can try to use imclose() followed by bwareafilt(~binaryImage, 1) to extract only the largest blob. Better would be to probably start with a full color image with less noise in it.
Worst case you can use imfreehand() to "chop off" the parts you don't want. Demo attached.

댓글 수: 3

Image Analyst
Image Analyst 2017년 4월 8일
Easy, except for the triangular head thing. Just find dark pixels that are not in the red - green range of hues. Try the HSV color segmentation demo in my File Exchange http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862&sort=downloads_desc
or else try the Color Thresholder app on the Apps tab of the tool ribbon.
Image Analyst
Image Analyst 2017년 4월 9일
What happened to your original image? It's not attached anymore. Also, please attach your m-file.

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

추가 답변 (0개)

태그

아직 태그를 입력하지 않았습니다.

질문:

2017년 4월 8일

편집:

2017년 4월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by