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

8 visualizaciones (últimos 30 días)
Alex Zai
Alex Zai el 27 de Abr. de 2021
Comentada: Alex Zai el 1 de Mayo de 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.
  1 comentario
Alex Zai
Alex Zai el 29 de Abr. de 2021
Someone can suggest or help me, please?
I appreciate your answer.

Iniciar sesión para comentar.

Respuesta aceptada

Matt J
Matt J el 29 de Abr. de 2021
Editada: Matt J el 29 de Abr. de 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.

Más respuestas (1)

Image Analyst
Image Analyst el 29 de Abr. de 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