how to find the smallest object in the coin image?

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

Risposta accettata

Matt J
Matt J il 1 Gen 2022
Modificato: Matt J il 1 Gen 2022
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 Commenti
betty
betty il 1 Gen 2022
yes, I think he finds the smallest object
Matt J
Matt J il 1 Gen 2022
okay, well if you think the problem is solved, then please Accept-click the answer to indicate so.

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by