isl-org / Open3D

Open3D: A Modern Library for 3D Data Processing
http://www.open3d.org
Other
11.28k stars 2.28k forks source link

generate point cloud with color information from mesh file(.obj) #2726

Closed Retia-development closed 2 years ago

Retia-development commented 3 years ago

If I have a mesh file like .obj, is it possible to use an mtl file for the color information using open3D?

Currently in a project I am trying to add a form of meta data to pointclouds, I wanted to try to use the color for that. However I thought to make it user friendly, instead of manually finding the right dots and coloring them (which I think is very hard since the pointcloud seems messy to me) To use the original obj file for the colors. I tried vertex colors already, but our obj files don't have enough vertices for that. I use the sample_points_poisson_disk method to solve that issue.

my current test code looks like this

inbouwdoos_enkel = o3d.io.read_triangle_mesh("Models/test4.obj")
inbouwdoos_enkel.compute_vertex_normals()
nop = 3000
pc_source = inbouwdoos_enkel.sample_points_poisson_disk(nop)
o3d.visualization.draw_geometries([pc_source],
                                    point_show_normal=True,
                                    window_name="Source and Target")
errissa commented 2 years ago

@Retia-development The mtl file stores material properties which can include a limited set of color-related properties. Please see this for details: https://en.wikipedia.org/wiki/Wavefront_.obj_file#Material_template_library

If you are still trying to work through this issue, please feel free to reopen this issue.