I am trying to obtain the boundary and measure the perimeter of of the spanner. However, it seems like there are some weird boundary selected as well (1, 2 , 10, 11). can anyone suggest me how can i get rid of the unknown boundary ? i am new to matlab image processing and i am using image analyst 's code. Below is the coding for boundary :
boundaries = bwboundaries(binaryImage,'noholes');
numberOfBoundaries = size(boundaries, 1);
for k = 1 : numberOfBoundaries
thisBoundary = boundaries{k};
plot(thisBoundary(:,2), thisBoundary(:,1), 'g', 'LineWidth', 2);
end

 採用された回答

soo kin wah
soo kin wah 2018 年 10 月 7 日

0 投票

Solved! bwareaopen can be used to solve this problem ;)

その他の回答 (1 件)

Image Analyst
Image Analyst 2018 年 10 月 7 日

0 投票

Sorry, I didn't see that image when you originally posted it. You can also use bwareafilt() either by specifying the allowable size range, or by telling it how many blobs you want to take.

カテゴリ

ヘルプ センター および File ExchangeImage Processing Toolbox についてさらに検索

質問済み:

2018 年 3 月 14 日

回答済み:

2018 年 10 月 7 日

Community Treasure Hunt

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

Start Hunting!

Translated by