mikedh / trimesh

Python library for loading and using triangular meshes.
https://trimesh.org
MIT License
3.02k stars 583 forks source link

Give heatmap to the face region #966

Closed YimingXu1213 closed 3 years ago

YimingXu1213 commented 4 years ago

Hi Mike, thanks so much for this amazing library.

We are new to trimesh, and we want to give different regions different colors according to the value assigned for each vertex. (something very similar to the plot below, got from #526 ). The mesh dimension is (a, 3), and we give each vertex a value so that the value_list is a list with length a.

The code we are having is here: vtk_mesh = vtkplotter.trimesh2vtk(new_mesh) vtk_mesh.pointColors(_[??what to put in here]_, cmap='jet') vtkplotter.show(vtk_mesh, bg="white", axes=0, interactive=True)

Also, a side question is could we directly save it into a png/jpg file by script? We have a lot of meshes and an automatic way would be fantastic.

Any suggestions will be highly appreciated. Thank you! image

mikedh commented 4 years ago

Hey, I think if you want to do it inside trimesh this is probably still the easiest way: https://github.com/mikedh/trimesh/issues/526#issuecomment-518429328

As for vtkplotter (looks like it renamed to vedo) they have a really great list of examples, I'd check those out.

YimingXu1213 commented 4 years ago

Hi Mike, thanks for the reply!

A quick check if using visual.interpolate: in our case, where should we put our value_list? Directly trimesh.visual.interpolate(value_list, color_map='viridis')?

Also, is there any way to save the visualization into a png/jpg file by script for trimesh?

Thx!

Nibenitez commented 1 year ago

@YimingXu1213 were you able to replicate the face mesh error as a heatmap? I need something similar for my 3d face reconstruction project. Do you have a tutorial or the steps to accomplish it? Thank you!

image