What are (r min) & (r max) in "imfindcircles"?

9 views (last 30 days)
Shahin Safazadeh
Shahin Safazadeh on 23 Mar 2018
Commented: Shahin Safazadeh on 13 Apr 2018
To count some cells in an image, I set the radii range [20 80] in "imfindcircles" and around 70 circles were found with the largest radius < 60. After changing the radii range to [20 2000], more than 120 circle were found with the largest radius < 80! I don't understand if the largest radius is <80, why is it not found by setting the first range [20 80]?
  4 Comments
Shahin Safazadeh
Shahin Safazadeh on 2 Apr 2018
Edited: Shahin Safazadeh on 2 Apr 2018
img = imread('normal.jpg');
subplot(2,2,3),imshow(img),title('Found cells')
hold on
img_gray = rgb2gray(img);
subplot(2,2,1),imshow(img_gray), title('RGB to gray conversion')
edges_gray = edge(img_gray,'Canny');
subplot(2,2,2),imshow(edges_gray), title('Edges by Canny')
[centers1,radii1] = imfindcircles(edges_gray,[20 100]);
subplot(2,2,3),viscircles(centers1,radii1,'EdgeColor','r','LineWidth',0.6);
Image Analyst
Image Analyst on 2 Apr 2018
You forgot to attach 'D:\KUL\CV\assignment\assignment_2\circles_on_original_img.png' and 'D:\KUL\CV\assignment\assignment_2\normal.jpg'.
And you have never read this link so please read it now.

Sign in to comment.

Answers (2)

Abhishek Ballaney
Abhishek Ballaney on 2 Apr 2018
https://in.mathworks.com/help/images/ref/imfindcircles.html
  1 Comment
Shahin Safazadeh
Shahin Safazadeh on 2 Apr 2018
Would you please let me know what you are going to say by that link? I had already used this syntax!

Sign in to comment.


Suraj Mankulangara
Suraj Mankulangara on 13 Apr 2018
Hello Shahin,
I suspect that this is an accuracy issue. The recommendation from MathWorks is that for best results, the conditions rmax < 3*rmin and (rmax-rmin) < 100 should hold:
https://in.mathworks.com/help/images/ref/imfindcircles.html#Tips
It could very well be that "imfindcircles" fails since these conditions are not met when the radius range is specified as [20, 2000]
- Suraj Mankulangara
  1 Comment
Shahin Safazadeh
Shahin Safazadeh on 13 Apr 2018
Hi Suraj,
Seeing the warning in MATLAB, I already realized that I should respect those 2 conditions. Although, MATLAB can't find all the circles within the interval, when I set the interval, [20 80]! On the other hand, increasing the interval takes too long to get the result. So, I believe, this syntax is not that useful for counting cells.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!