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