Texture mapping in MATLAB

后端 未结 2 1319
无人共我
无人共我 2021-01-02 05:14

I have points in 3D space and their corresponding 2D image points. How can I make a mesh out of the 3D points, then texture the triangle faces formed by the mesh?

2条回答
  •  自闭症患者
    2021-01-02 05:39

    If your texture is already in the proper geometry you can just use regular old texture mapping.

    The link to the MathWorks documentation of texture mapping: http://www.mathworks.com/access/helpdesk/help/techdoc/visualize/f0-18164.html#f0-9250

    Re-EDIT: Updated the code a little:

    Try this approach (I just got it to work).

     a=imread('image.jpg');
     b=double(a)/255;
    
     [x,y,z]=peaks(30);  %# This is a surface maker that you do have
                         %# The matrix [x,y,z] is the representation of the surface.
    
     surf(x,y,z,b,'FaceColor','texturemap')  %# Try this with any image and you 
                                             %# should see a pretty explanatory 
                                             %# result. (Just copy and paste) ;)
    

    So [x,y,z] is the 'surface' or rather a matrix containing a number of points in the form (x,y,z) that are on the surface. Notice that the image is stretched to fit the surface.

提交回复
热议问题