imfindcircles() doesn't find circle although radius is within the specified range and circle was succesfully detected before

24 ビュー (過去 30 日間)
Hi there,
I have following issue with the imfindcircles() function:
I'm trying to detect circles in a row of images to track the movement of a ball. For the examplary image in the attachement when I use this code:
image1 = imread("TestIMG.jpg");
imshow(image1)
[center, radius] = imfindcircles(image1,[25 35], "Sensitivity",0.9)
viscircles(center, radius);
the ball is detected correctly and the output is
center = [133.8004 122.4886] and radius = 31.8116
When I use the same image and the same code, but change the radius range to [27 37] I would expect the same circle to be found as the radius of the detected circle from above is still in the given range. However, doing so returns empty center and empty radius. I experienced this issue in similar way for several different images and I have no clue how that can happen. I tried to find some explanation in the imfindcircles() documentation, but couldn't find any solution.

採用された回答

Yash Srivastava
Yash Srivastava 2023 年 3 月 27 日
編集済み: Yash Srivastava 2023 年 3 月 27 日
Hi Chantal
'imfindcirles' uses Circular Hough Transform for finding circles. It populates an accumulator matrix independently for every new radius range that is specified. Therefore, when a radius range of [25 35] is specified, it is a completely different problem from when a radius range of [27 37] is specified.
For each of these problems a different accumulator matrix is computed independently, which means that the number (and also the locations) of circles detected at 'Sensitivity' of 0.9 can also change independently (and unpredictably). For example in this case, for radius range [27 37] and 'Sensitivity' set to 0.95, 'imfindcircles' is able to detect the circle.
[center, radius] = imfindcircles(image1, [27 37], "Sensitivity",0.95)
Please refer to the 'Algorithms' section of 'imfindcircles' documentation for more details.

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by