how to use drawcircle methods with centroids array from bwconncomp
3 views (last 30 days)
Show older comments
I want to draw circles from bwconncomp I have centroids but I could not draw with drawcircles all circles
imshow(image);hold on;title(['Delik Sayısı: ', num2str(length(stats))]);
%viscircles(centroids,8);
for i=1:length(centroids)
h=drawcircle("Center",[centroids(i,1),centroids(i,2)],"Radius",10,'Color','r');
end
mask = createMask(h);
imshow(mask)
0 Comments
Accepted Answer
DGM
on 27 May 2024
Moved: DGM
on 27 May 2024
You're repeatedly overwriting h before you do anything with it. It's not clear what you expect to happen. If you just want the union of masks, accumulate the union by generating the mask in the loop.
Something like this:
% preallocate the mask based on the appropriate page geometry
% use a variable name other than "image" for your image
% otherwise you're shadowing the function image().
mask = false(size(myimage,1:2));
% accumulate the union of masks
for k = 1:size(centroids,1)
ROI = drawcircle("Center",[centroids(k,1),centroids(k,2)],"Radius",10,'Color','r');
mask = mask | createMask(ROI);
end
imshow(mask)
Otherwise, you'll have to do something different.
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!