how to get the 1st and the 3rd boundary objects in the binary image

1 回表示 (過去 30 日間)
Elysi Cochin
Elysi Cochin 2018 年 2 月 2 日
コメント済み: Image Analyst 2018 年 2 月 2 日
i segmented an image and got a binary image bw
when i do the below line, i get only 1 numberOfblobs
[labeledImage, numberOfblobs] = bwlabel(bw, 8);
but when i do
structBoundaries = bwboundaries(bw);
i get 5 boundaries, and i need only the 1st and the 3rd boundary objects in the binary image. How to get it in a new binary image with only the first and the third region?

採用された回答

Guillaume
Guillaume 2018 年 2 月 2 日
編集済み: Guillaume 2018 年 2 月 2 日
Isn't it
structBoundaries([1 3])
?
By the way structBoundaries is a very misleading name, implying the variable is a structure when it is actually a cell array.
  1 件のコメント
Image Analyst
Image Analyst 2018 年 2 月 2 日
You can use bwselect() or ismember() on the labeled image.
labeledImage = bwlabel(binaryImage);
% Extract blob #3
blob3 = ismember(labeledImage, 3); % blob3 is a binary image.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by