how do I find the smallest object in a binary coins image ?
1 次查看(过去 30 天)
显示 更早的评论
How to find the smallest object in the image below I would appreciate it if you could help
0 个评论
回答(2 个)
Yusuf Suer Erdem
2021-12-7
check imfindcircles command. there are multiple similar examples on matlab help center. try to adapt yours to them.
0 个评论
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)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!