Azzera filtri
Azzera filtri

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

6 visualizzazioni (ultimi 30 giorni)
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.

Risposte (1)

Walter Roberson
Walter Roberson il 29 Set 2017
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