From: sanjay on
Dear all,



I have a binary image which is thinned and then I found centroid for each connected component, Then I specify some radii considering centroid as origin. How to find whether white pixel exist within that radii having centroid as the origin in matlab. I am sending code for thinning and for finding centroid. pls help I am new to matlab.



r = 0.02;

t = bwmorph(bw, 'thin',Inf);

figure,imshow(t);title('thinned image');

[L, n] = bwlabel(t);

hold on

for k = 1:n

[r,c] = find(L == k);

rbar = mean(r);

cbar = mean(c);

plot(cbar,rbar, 'g.');

hold off
From: ImageAnalyst on
You obviously have the Image Processing Toolbox so you can just use
regionprops after you label the image to get the centroids. See my
demo if you want an example:
http://www.mathworks.com/matlabcentral/fileexchange/25157