MATLAB: Function: imfindcircles detects false circles.

Image Processing Toolboximfindcircles

I have come across this a few times. The function imfindcircles detects false circles (like at the corners shown below) even when there is no pixel intensity variation at those places. What could the reason be? How can I avoid this? Are there any other suitable methods to find circles apart from this?
I have attached an example image.
This is my code:
clear all;
close all;
A = imread('synthetic_img3.png');
BW1 = bwmorph(im2bw(A),'close');
figure;
imshow(BW1)
[centers,radii] = imfindcircles(BW1,[5,500]);
figure, imshow(BW1);
hold on
viscircles(centers, radii,'EdgeColor','b');
The resulting output:

Best Answer

If you want to segment out the small circles, you could also use thresholding and size filtering (use imclearborder and bwareaopen) instead of imfindcircles(). Then you could do things like find area, perimeter, location, etc. with regionprops().