How to connect specified x,y coordinate points in image?

8 Ansichten (letzte 30 Tage)
Alex Zai
Alex Zai am 27 Apr. 2021
Kommentiert: Alex Zai am 1 Mai 2021
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.

Akzeptierte Antwort

Matt J
Matt J am 29 Apr. 2021
Bearbeitet: Matt J am 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.

Weitere Antworten (1)

Image Analyst
Image Analyst am 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.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by