How to generate point on edge of circle so that input to other code?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
hyong suk choo
el 15 de Feb. de 2017
Comentada: hyong suk choo
el 16 de Feb. de 2017

https://kr.mathworks.com/matlabcentral/fileexchange/19083-calccircle
I want pick 3 points on this image and recover this circle by using code in link above.
I used bwboundaries function to define coordinates of 3 points
but have no idea how to pick 3 random points and connect it to code in link.
No need to use bwboundaries function if there are solutions!
Any small help would be my big appreciate!
Here is trial and error found on defining p1, p2, p3 part..
out = imread('noname1.png');
out = rgb2gray(out);
figure; imshow(out); hold on;
[B,L,N] = bwboundaries(out,4,'holes');
a = bwboundaries(out,4,'holes');
figure; imshow(out); axis equal; 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
%%%%%%error %%%%%%%%%
p1 = (469,441);
p2 = (680,241);
p3 = (1025,512);
%%%%%%error %%%%%%%%%
[c r] = calc_circle(p1, p2, p3);
axis equal
hold on
if r == -1
disp('COLLINEAR')
else
rectangle('Position', [c(1)-r,c(2)-r,2*r,2*r],...
'Curvature', [1,1], 'EdgeColor', 'g')
end
plot(p1(1), p1(2), '*')
plot(p2(1), p2(2), '*')
plot(p3(1), p3(2), '*')
Respuesta aceptada
Más respuestas (0)
Ver también
Categorías
Más información sobre Computer Vision with Simulink en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!