How detect spot white circle on image

조회 수: 1 (최근 30일)
Duc Hang
Duc Hang 2017년 6월 6일
댓글: Rena Berman 2017년 6월 23일
I would like detect spot white are like below image . Hope anyone help . Thanks!

채택된 답변

KSSV
KSSV 2017년 6월 6일
편집: KSSV 2017년 6월 6일
I = imread('Screen Shot 2017-06-06 at 3.54.58 PM.png') ;
im = imclearborder(im2bw(I));
im_fill = imfill(im, 'holes');
s = regionprops(im_fill, 'Area', 'PixelList');
[~,ind] = max([s.Area]);
pix = sub2ind(size(im), s(ind).PixelList(:,2), s(ind).PixelList(:,1));
out = zeros(size(im));
out(pix) = im(pix);
% imshow(out);
[y,x] = find(out) ;
idx = boundary(x,y) ;
% idx = convhull(x,y) ;
imshow(I)
hold on
plot(x(idx),y(idx),'r','linewidth',3)
If boundary doesn't work, use convexhull
  댓글 수: 1
KSSV
KSSV 2017년 6월 6일
Attach only original image ...

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

추가 답변 (1개)

Image Analyst
Image Analyst 2017년 6월 6일
KSSV's code finds the largest blob that is not touching the border, whereas you actually want roundish objects.
Like I said in your duplicate post, You could use my code for circularity. Or you could also look for Solidities close to 1, or get the BoundingBox and look for aspect ratios close to 1.

Community Treasure Hunt

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

Start Hunting!

Translated by