Numbering bubbles and extract centers
1 次查看(过去 30 天)
显示 更早的评论
I have a 2D image of bubbles (all connected to each other). I want to number each bubble seperately, compute its area and locate centre of each bubble along with its co-ordinatres. Can I do it with standard flood fill algorithm? attaching skeletonized image for reference.
0 个评论
采纳的回答
KSSV
2017-3-1
编辑:KSSV
2017-3-1
You can count the number of closed regions using bwlabeln.
I = imread('test2.png') ;
I = rgb2gray(I) ;
[L,num] = bwlabeln(I,6) ; % num gives you closed region
m = regionprops(L) ; % measurements of regions, gives centers of the regions
imshow(I)
hold on
for i = 1:num
c = m(i).Centroid ;
plot(c(1),c(2),'*r') ;
end
num gives you the number of closed regions. You can view them using vislabels(L). Download the function vislabels from here .
3 个评论
更多回答(1 个)
Abel Babu
2017-2-24
Hi Mandar,
Here is a MATLAB example that describes how to find circles in a given image:
It uses the ' imfindcircles ' function that internally uses Hough Transform to compute both center and radii of a circle. Here is the documentation for the same:
Abel
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!