How do I fill the missing edges of an image in order to use the imfill command?

2 ビュー (過去 30 日間)
I would like to be able to threshold the heart all by itself. The overall project is to be able to get the coordinates of the heart and superimpose them into a fake body. So far I have used sobel edging and tresholding to get the heart. How do I close off all the edges so I can use the Imfill command? Thank you

採用された回答

Image Analyst
Image Analyst 2014 年 2 月 21 日
You can try imclose() or imdilate(), which is scanning with a local max filter.
  2 件のコメント
Alexander Killam
Alexander Killam 2014 年 2 月 21 日
IM2 = imclose(IM,SE) performs morphological closing on the grayscale or binary image IM with the structuring element SE. SE must be a single structuring element object, as opposed to an array of objects.
Not to sound stupid but I am a really basic beginner. What would I place for the SE in that command?
Image Analyst
Image Analyst 2014 年 2 月 21 日
編集済み: Image Analyst 2014 年 2 月 21 日
You could look at strel() function to create masks of different shapes. If you just want a box, you can use true():
% Close with window size of 15x15.
closedImage = imclose(grayImage, true(15));

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by