how do I find the smallest object in a binary coins image ?

1 回表示 (過去 30 日間)
betty
betty 2021 年 12 月 7 日
コメント済み: betty 2021 年 12 月 8 日
How to find the smallest object in the image below I would appreciate it if you could help

回答 (2 件)

Yusuf Suer Erdem
Yusuf Suer Erdem 2021 年 12 月 7 日
check imfindcircles command. there are multiple similar examples on matlab help center. try to adapt yours to them.

yanqi liu
yanqi liu 2021 年 12 月 8 日
clc; clear all; close all;
im=imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/826480/image.png');
bw=im2bw(im);
bw=imclearborder(imfill(bw,'holes'));
% find the smallest object
stats=regionprops(bw);
ar=cat(1,stats.Area);
[~,ind]=min(ar);
figure; imshow(im);
hold on; rectangle('position', stats(ind).BoundingBox, 'EdgeColor', 'g', 'LineWidth', 2)

カテゴリ

Help Center および File ExchangeImage Segmentation and Analysis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by