How to generate point on edge of circle so that input to other code?
2 views (last 30 days)
Show older comments

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), '*')
Accepted Answer
KSSV
on 15 Feb 2017
I = imread('yourimage') ;
[y,x] = find(I(:,:,1)) ; % your required points
imshow(I) ;
hold on
plot(x,y,'.r')
3 Comments
More Answers (0)
See Also
Categories
Find more on Computer Vision with Simulink in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!