How to visualize a 3d scene using surfing

I have an image loaded from disk as a texture, and a matrix d of the same size, which has the corresponding depths.

How can I use surfto show me an image as a 3d model? Just taking

surf(depthMatrix, img);

does not give a good result, since

  • the camera does not look from the xy plane in the z direction
  • He looks pretty black
  • It doesn’t look so smooth, although my depth matrix is ​​actually smoothed when I display it with imshow(depthMatrix, []);

image how it looks like

+3
source share
1 answer

You can use texture mapping to display an image on your surface as follows:

surf(depthMatrix,img,...           %# depthMatrix is z data, img is an image
     'FaceColor','texturemap',...  %# Use texture mapping
     'EdgeColor','none');          %# Turn off edge coloring

And to answer your 3 points:

+4

Source: https://habr.com/ru/post/1772926/


All Articles