I have to detect circles in images (some of them don't have homogeneous background), for that I'm using the circle_hough function, which needs the edges logical matrix.
i_edge = edge(image, 'Canny', 0.3); %0.3 works in most cases
radii = 36:2:144; %144 is half the size of all the images
h = circle_hough(i_edge, radii, 'same', 'normalise');
peaks = circle_houghpeaks(h, radii, 'nhoodxy', 9, 'nhoodr', 9, 'npeaks', 1);
The thing is, some images work fine:
But others don't:
Here, you can see what I obtain after the line i_edge= edge(image, 'Canny', 0.3);
in the first one (finds the circle), and the third (doesn't find the circle). What bothers me the most is that they are more or less similar:
I tried different kinds of lowpass filters (median, average, gaussian, disk), but with none of them I get better results, rather the opposite.
In the last case, the circle in the edge matrix is almost perfect but still, doesn't find the right circle: