how to use drawcircle methods with centroids array from bwconncomp
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
DGM
2024 年 5 月 27 日
移動済み: DGM
2024 年 5 月 27 日
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 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!