Detecting circular shaped fruit in 2D images using circular Hough transform or alternative algorithm

13 views (last 30 days)
I am trying to detect circular fruits using the circular Hough transform after applying edge detection. However, the circular Hough transform parameters seem to be very sensitive, i.e. the ''Sensitivity'' and ''EdgeTreshold''. A small change in one of these parameters has huge impact on the amount of circles that are detected. How can I avoid this or is there a better algorithm to detect the circular shaped fruits? Moreover, I need to use the Rmax of 85 for optimal results, while the absolute maximum Rmax is 55, after measuring the distance with imdistline.
I am using now the following parameters:
[centers,radii, metric] = imfindcircles(BW_Canny,[30 85],'Sensitivity',0.95,'EdgeThreshold',0.15);
viscircles(centers, radii,'EdgeColor','b');
I have added the original RGB image, the images after color thresholding and edge detection, and beneath my own results.

Answers (1)

Image Analyst
Image Analyst on 10 Jan 2022
You don't need to find circular shapes. From your other posts, you're trying to find oranges on a tree. The oranges are almost always overlapping with other oranges so the combined blob is not round, or don't have a circular shape because there is shine on the rind, or leaves are obscuring the shape, making it not round. If you limit your segmentation to only round blobs, you're going to miss the majority of blobs.
That said, there is a 'circularity' property in regionprops that gives you the circularity of blobs. You can also use bwpropfilt() to remove blobs outside the acceptable range of circularity. Again, I recommend not doing that.
  10 Comments
Image Analyst
Image Analyst on 28 Jan 2022
I can see that we're never going to see eye-to-eye on this. For another example you want to measure things that I say don't matter, like the location of the center of an orange, which of course varies tremendously depending on where the photographer was standing and how he was aiming the camera, and literally how the wind was blowing. Things like finding only round blobs, counting blobs, etc. will always be problematic and that's why, based on my 40+ years of image processing, you should look for other things like area fraction for determining when to harvest your crop or how much the oranges have grown.
So good luck to you with your approach.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!