Effacer les filtres
Effacer les filtres

how to use drawcircle methods with centroids array from bwconncomp

3 vues (au cours des 30 derniers jours)
mehmet baki
mehmet baki le 27 Mai 2024
Déplacé(e) : DGM le 27 Mai 2024
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)

Réponse acceptée

DGM
DGM le 27 Mai 2024
Déplacé(e) : DGM le 27 Mai 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.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by