% Code:
clear all
clc
%Show Image in GrayScale
I = imread('coins.png');
imshow(I)
BWI = im2gray(I);
figure
imshow(BWI)
%%Increase Sensitivity if the coins/circles are not found, Make sure radius is correct and includes entire range
[centers,radii] = imfindcircles(BWI,[8 74],'ObjectPolarity','bright', 'Sensitivity',0.93);
viscircles(centers,radii,'color','r')
length(centers)
% Draw Radius Function
for i = 1:size(centers,1)
line([centers(i,1) centers(i,1)],[centers(i,2) centers(i,2)+radii(i,1)], 'color', 'b' );
end