r_testFindCircles.m 1.43 KB
function r_testFindCircles( image )
% R_DATA - Uses to adjust parameters in the function imfindcircles. 
%
% Syntax:  r_testFindCircles()
%
%
% Example:
%    r_testFindCircles('im0100_interp.jpg')
%
% Other m-files required: Image Processus Toolbox
% Subfunctions: none
% MAT-files required: none
%
% See also: r_isolateCircle
%
% Author: Marie-Pier Marquis, Dany Dumont
% UQAR/ISMER
% email: dany_dumont@uqar.ca
% Website: http://www.ismer.ca/dumont-dany
% October 2014
% ________________________________________________________________________
%% 
% Black out 
iBlack = 1:601;
        jBlack = [1:108,208:421];
%  iBlack7 = [1:170,280:601];
%  jBlack7 = 300:420;
I = imread(image);
I(iBlack,jBlack,:) = 0;
%  I(iBlack2,jBlack2,:) = 0;

% I(iBlack6,jBlack6,:) = 0;
%   I(iBlack3,jBlack3,:) = 0;
%  I(iBlack4,jBlack4,:) = 0;
%  I(iBlack5,jBlack5,:) = 0;



% Helps to adjust the Sensitivity and EdgeThreshold parameters

figure(1);clf
imshow(I);                          
% [centers, radii] = imfindcircles(I,[47 55],'ObjectPolarity','dark', ...
%     'Sensitivity',0.98);
% [centers, radii] = imfindcircles(I,[45 55], 'ObjectPolarity','dark', ...
%           'Sensitivity',0.98,'Method','twostage');
% h = viscircles(centers,radii);
% The real radius is 49.5
[centersBright, radiiBright] = imfindcircles(I,[47 55], ...
    'ObjectPolarity','bright','Sensitivity',0.965,'EdgeThreshold',0.015);
h = viscircles(centersBright, radiiBright,'EdgeColor','b');


end