Draw a textured triangle (patch) in Matlab
Posted
by Petter
on Stack Overflow
See other posts from Stack Overflow
or by Petter
Published on 2010-02-16T16:22:40Z
Indexed on
2010/03/26
18:33 UTC
Read the original article
Hit count: 334
I have a triangle in (u,v) coordinates in an image. I would like to draw this triangle at 3D coordinates (X,Y,Z) texture-mapped with the triangle in the image.
Here, u,v,X,Y,Z are all vectors with three elements representing the three corners of the triangle.
I have a very ugly, slow and insatisfactory solution in which I (1) extract a rectangular part of the image, (2) transform it to 3D space with the transformation defined by the three points, (3) draw it with surface, and (4) finally masking out everything that is not part of the triangle with AlphaData.
Surely there must be an easier way of doing this?
© Stack Overflow or respective owner