how to find the smallest object in the coin image?

조회 수: 3 (최근 30일)
betty
betty 2022년 1월 1일
댓글: Matt J 2022년 1월 1일
how to find the smallest object in the image below ? the code I wrote below does not work
A = imread('eight.tif');
C=imbinarize(A, 'adaptive', 'ForegroundPolarity', 'dark');
figure,imshow(C)
BW3=bwareafilt(C,1,'smallest');
Warning: One or more ties for n-th place occurred when selecting objects. Some objects were not selected.
figure, imshow(BW3)

채택된 답변

Matt J
Matt J 2022년 1월 1일
편집: Matt J 2022년 1월 1일
This should make it easier:
A = imread('eight.tif');
C=imbinarize(A, 'adaptive', 'ForegroundPolarity', 'dark');
C=bwareafilt( bwconvhull(~C,'objects') ,4);
figure,imshow(C)
  댓글 수: 4
betty
betty 2022년 1월 1일
yes, I think he finds the smallest object
Matt J
Matt J 2022년 1월 1일
okay, well if you think the problem is solved, then please Accept-click the answer to indicate so.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by