How to measure radius of circle in big image?
Mostrar comentarios más antiguos

(image above is copydrawing of original image. Sorry for impossible of uploading original image)
Because its size is over 2000x2000 pixels, Some problem has been found.
I tried 3 ways, and failed with each following reasons.
%%%%%%%%%%%%%%%fail 1 %%%%%%%%%%%%%%%%%%%%%%%%%
stats = regionprops('table',K,'Centroid',...
'MajorAxisLength','MinorAxisLength');
centers = stats.Centroid;
diameters = mean([stats.MajorAxisLength stats.MinorAxisLength],2);
radii = diameters/2;
viscircles(centers,radii);
% Tracked wrong circle.
%%%%%%%%%%%%%%%fail 1 %%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%fail 2 %%%%%%%%%%%%%%%%%%%%%%%%%
[centers, radii] = imfindcircles(out,[1000 1100], 'Sensitivity', 0.92);
h = viscircles(centers, radii);
% Too big size to track it
% One radius per multiple circles tracked.
%%%%%%%%%%%%%%%fail 2 %%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%fail 3 %%%%%%%%%%%%%%%%%%%%%%%%%
r = sqrt(sum(out(:))/pi);
% Code for full circle
%%%%%%%%%%%%%%%fail 3 %%%%%%%%%%%%%%%%%%%%%%%%%
And trying one experiment. seeing code from http://matlab.wikia.com/wiki/FAQ#How_can_I_fit_a_circle_to_a_set_of_XY_data.3F
%%%%%%%%%%%%%%%exp 1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[B,L,N] = bwboundaries(out,4,'holes');
figure; imshow(out); hold on;
for k = 1 : length(B),
boundary = B{k};
if(k > N)
plot(boundary(:,2), boundary(:,1), 'g', 'LineWidth', 2);
else
plot(boundary(:,2), boundary(:,1), 'r', 'LineWidth', 2);
end
end
x = boundary(:,2);
y = boundary(:,1);
n=length(x); xx=x.*x; yy=y.*y; xy=x.*y;
A=[sum(x) sum(y) n;sum(xy) sum(yy) sum(y);sum(xx) sum(xy) sum(x)];
B=[-sum(xx+yy) ; -sum(xx.*y+yy.*y) ; -sum(xx.*x+xy.*y)];
a=A\B;
xc = -.5*a(1);
yc = -.5*a(2);
R = sqrt((a(1)^2+a(2)^2)/4-a(3));
%
%%%%%%%%%%%%%%%exp 1 %%%%%%%%%%%%%%%%%%%%%%%%%
and still finding which elements should be selected as x,y component in circfit function.
- Is there anything I missed?
- Or did I choose wrong way?
Any small kind answer would be a huge help!
Respuestas (1)
hyong suk choo
el 6 de Mzo. de 2017
Editada: hyong suk choo
el 6 de Mzo. de 2017
Categorías
Más información sobre Blocked Images en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!