Mapping a Mayavi Texture

I use mayavi in ​​python to visualize some data. I have a surface in 3D space and I want to display an image on it. I looked through the Mayavi documentation, and all I could find was this , which actually doesn't help me much. Has anyone done something like this before?

+4
source share
2 answers

I found that the mesh function does accept a scalars argument, which then paints the corresponding point on the surface according to the selected color palette. However, I still don’t know how to match an arbitrary RGB image on the surface.

+2
source

I assume you have not seen the chapter "Python scripting for 3D plotting". There is a collection of Mayavi commands that can be used inside python. For example, the section "3D construction functions for numpy arrays" . If you follow the links, you will find a description of the functions and a small example for each of them.

In your case, you should take mesh or surf . Both functions are equal but different. For example, the surf function is a more subfunction of the mesh , which, in my opinion. You do not need to determine the x and y coordinates, you just need the z coordinates in the 2D array. If you want to use mesh , you need to pass all three coordinates (x, y, z) as 2D arrays.

I would suggest checking out the examples.

Is this the answer to your question? Maybe you should be more specific about what you want to do.

Have a nice day and happy holidays.

+1
source

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


All Articles