Question

I'm using mayavi in python to visualize some data. I have a surface in 3D space and I want to map an image to it. I have looked at mayavi documentation and all I could find was this, which really doesn't help me much. Has anybody done something like this before?

Was it helpful?

Solution

I found that the mesh function actually does take a scalars argument, which then colors the corresponding point on the surface in accordance to the chosen colormap. I still however don't know how to map an arbitrary RGB image to the surface.

OTHER TIPS

I guess you didn't saw the chapter "Python scripting for 3D plotting". There is a collection of the mayavi commands which can be used inside python. For example the section "3D Plotting functions for numpy arrays". If you follow the links you find some description about the functions and a small example for each of them.

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

I would suggest to check the examples.

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

Have a nice day and Happy Holidays.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top