Recognize centroids and radii of many circle
Show older comments

I have an image that contains many broken/slightly deformed circles because it is a cross section of an object. I need to be able to recognize the centroids and radii of them. I have attached the picture below. I have the image processing toolbox and have tried the method in the link below but it returns no radii or centroids. I have estimated the radius to be between 25 and 75. I also attached my code and picture I used.
img = imread('img.png'); %Reads image from directory
red = img(:,:,2); %Use first (red) color plane
red = adapthisteq(red); %Use adaptive histogram equalization
tic
[accum,circen,cirrad] = CircularHough_Grd(red,[15 75],20,13,1);
toc
if any(cirrad <= 0) %Eliminate zero radii
inds = find(cirrad>0);
cirrad = cirrad(inds);
circen = circen(inds,:);
end
imshow(red);
hold on;
plot(circen(:,1), circen(:,2), 'r+');
for ii = 1 : size(circen, 1)
rectangle('Position',[circen(ii,1) - cirrad(ii), circen(ii,2) - cirrad(ii), 2*cirrad(ii), 2*cirrad(ii)],...
'Curvature', [1,1], 'edgecolor', 'b', 'linewidth', 1.5);
end
hold off;
1 Comment
Image Analyst
on 4 Oct 2013
I don't see the img.png that you attached. Are you sure you attached it? Did you use the image icon or the paper clip icon?
Answers (2)
Image Analyst
on 4 Oct 2013
0 votes
I don't see your image. Can you use a method like in my Image Segmentation Tutorial : http://www.mathworks.com/matlabcentral/fileexchange/25157-image-segmentation-tutorial-blobsdemo?
11 Comments
Michael
on 4 Oct 2013
Image Analyst
on 4 Oct 2013
That image looks like it has bad chromatic aberration. Can you get a "blank shot" so that we can do some kind of background correction on it. Myabe you could try this: http://www.mathworks.com/matlabcentral/fileexchange/25619-image-segmentation-using-statistical-region-merging or this http://www.mathworks.com/products/demos/image/color_seg_k/ipexhistology.html
Michael
on 11 Oct 2013
Michael
on 11 Oct 2013
Image Analyst
on 11 Oct 2013
Yes that looks sharper, I think. It looked like in your original image there was shear between the red, green, and blue color channels so that the centroids might not be in the same place for each color channel. If these centroids are okay, you can look at my BlobsDemo app which does that: http://www.mathworks.com/matlabcentral/answers/contributors/1343420-image-analyst/answers You might have to separate any touching blobs using something like watershed: http://blogs.mathworks.com/steve/2006/06/02/cell-segmentation/
Michael
on 11 Oct 2013
Image Analyst
on 11 Oct 2013
Attach the image as a file (use the paper clip icon). If I get time (I'm traveling in South America at the moment), I'll see what I can do. I think that it should work though if you just adjust some parameters.
Michael
on 22 Oct 2013
Image Analyst
on 22 Oct 2013
If a blob is not a perfect circle, you can get the "diameter" by asking regionprops() for "EquivDiameter" which is the diameter you'd get if you molded your blob into a perfect circle with the same number of pixels.
Michael
on 23 Oct 2013
Image Analyst
on 23 Oct 2013
No - I just haven't had time, and I'm about to leave town again in a few hours for a few days so I may not get to it soon, if ever. Sorry.
Michael
on 12 Oct 2013
Categories
Find more on Region and Image Properties in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

