How do i find connected components in binary image

13 ビュー (過去 30 日間)
Toheeb Oyeyemi
Toheeb Oyeyemi 2021 年 6 月 25 日
回答済み: Image Analyst 2021 年 6 月 27 日
I am stuck, how do I find connected components in a binary image, using function

回答 (2 件)

Matt J
Matt J 2021 年 6 月 25 日
You can use bwconncomp() or regionprops().

Image Analyst
Image Analyst 2021 年 6 月 27 日
To identify (label) separate, individual connected components (blobs) you can use bwlabel() or bwconncomp().
To make measurements (like area, perimeter, bounding box, etc.) you can use regionprops(). The blobs don't need to be labeled before passing in to regionprops(), but they can be. It's useful to label the blobs if you want to filter them out using measurements made my regionprops, like circularity or whatever.
keeperIndexes = find([props.Area] > 1000);
labeledImage = bwlabel(binaryImage);
newBinaryImage = ismember(labeledImage, keeperIndexes);
See my Image Segmentation Tutorial for a full demo.

Community Treasure Hunt

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

Start Hunting!

Translated by