フィルターのクリア

How to find boundaries of a blob such that they bound the image and not include it

6 ビュー (過去 30 日間)
RIshabh Golchha
RIshabh Golchha 2017 年 9 月 29 日
回答済み: Walter Roberson 2017 年 9 月 29 日
Hi,
I have an image with adjacent blobs. I want the boundaries of these blobs such that the boundaries are outside the blob and contain the blob completely inside it. How can I do so?
bwboundaries gives the boundaries such that the it is on the edge of the blob and hence do not contain the blob completely inside it.

回答 (1 件)

Walter Roberson
Walter Roberson 2017 年 9 月 29 日
Extract the blobs separately. For example,
labeled = bwlabel(YourImage);
for idx = 1 : numblob
thisbwimage = labeled == idx;
...
end
For each one, imdilate() with ones(3,3) and subtract the original from that, and then ask for the boundaries of that: the boundary should enclose the blob.
Note: this procedure will fail if the blob touches the outside edge, unless you pad the original with a sliver of black all the way around to prevent blobs from touching the edge.

Community Treasure Hunt

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

Start Hunting!

Translated by