looking for a better way or more time optimized way to use "imfindcircles" function
2 views (last 30 days)
Show older comments
I am looking for a better way or more time optimized otion when comapred to "imfindcircles" function. Currently i am passing an binirized image as an input to "imfindcircles" function using this code "bin = imbinarize(rszd, 'adaptive', 'Sensitivity', i);" where rszd is a resized imag and the output of this function i am passing it to imfindcircles function "[rxx] = imfindcircles(bin, range, 'Method', 'TwoStage', 'ObjectPolarity', 'bright', 'Sensitivity', 0.8);" where range is [10 20] Complete looks like this
for i=s
bin = imbinarize(rszd, 'adaptive', 'Sensitivity', i);
[rxx] = imfindcircles(bin, range, 'Method', 'TwoStage', 'ObjectPolarity', 'bright', 'Sensitivity', 0.8);
if size(rxx, 1) == 7
break;
end
end
and i am converting this code into a c++ code and using it on an IMX6 hardware board after inspecting the code by adding time taken to execute a function I see that the time taken to execute imbinirize function is 1 second and the time taken to execute imfindcircle is somewhere between 8 to 25 seconds is there a way to optimize the time taken as it is very crusial. For refrence i am attaching the the image generated using imbinirize function (that is bin ) which is passed as an input to imfindcircles function
Answers (1)
Udit06
on 11 Dec 2023
Hi Nitesh,
I understand that you have noticed the "imfindcircles" function is taking a considerable amount of time to execute. The reason behind this which I can understand is that the "imfindcircles" function use Circular Hough Transform(CHT) to detect the circles which converts the input image data into parameter space and then vote for the candidate pixel. You can refer to the following MathWorks documentation to understand the implementation of CHT.
For a faster algorithm, you can refer to the following implementation of detecting circles proposed by Ou et al. (2022) which is based on information compression. In the "Introduction" section, they have also provided details about other algorithms to detect circles in an image along with their limitations.
I hope this helps.
0 Comments
See Also
Categories
Find more on Signal Processing Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!