How to connect specified x,y coordinate points in image?
4 views (last 30 days)
Show older comments
Hello everyone,
I would like to connect the specified x,y coordinates points in image.
1). First, I did find x,y points of the center of the eyes and mouth. Then I marked that points in the image.
2) I would like to connect 2 points of eyes and one mouth of each face (like Triangle). And then I wanna find the center points of that triangle points. How can I do that, please?
I attached image files (marked points in image, x,y values of center of eyes and mouth).
Someone can suggest or help me, please?
I appreciate your answer.
Thanks alot.
Accepted Answer
Matt J
on 29 Apr 2021
Edited: Matt J
on 29 Apr 2021
To connect the points you can use the drawpolygon() command, feeding it the known vertices of the 3 points:
drawpolygon('Position',[v1;v2;v3])
To find the triangle centers, just average the vertex coordinates together.
More Answers (1)
Image Analyst
on 29 Apr 2021
You can use plot():
hold on
plot([x1,x2,x3, x1], [y1,y2,y3, y1], 'y-', 'LineWidth', 3);
Make sure you tack on the first point to the end, like I did, to close the triangle, otherwise you'll just get a V.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!