nv-tlabs / NKSR

[CVPR 2023 Highlight] Neural Kernel Surface Reconstruction
https://research.nvidia.com/labs/toronto-ai/NKSR
Other
735 stars 43 forks source link

Save reconstruct colored mesh #58

Open PiotrRzRobotec opened 8 months ago

PiotrRzRobotec commented 8 months ago

I have a problem with saving generated mesh as ply with vertex color. I can visualize proper colors with: vis.show_3d([vis.mesh(mesh.v, mesh.f, color=mesh.c)], [pcd])

but I don't know how to save vertex color information with a mesh. I'm able to create a ply file with this: vis.to_file(vis.mesh(mesh.v, mesh.f, color=mesh.c), "../assets/final.ply") but I don't have vertex color in it.

Is it possible to do it?

zhouilu commented 8 months ago

I have a problem with saving generated mesh as ply with vertex color. I can visualize proper colors with: vis.show_3d([vis.mesh(mesh.v, mesh.f, color=mesh.c)], [pcd])

but I don't know how to save vertex color information with a mesh. I'm able to create a ply file with this: vis.to_file(vis.mesh(mesh.v, mesh.f, color=mesh.c), "../assets/final.ply") but I don't have vertex color in it.

Is it possible to do it?

your points cloud have color? you can read like this

pcd = o3d.io.read_point_cloud("input.ply")
input_xyz = torch.from_numpy(np.asarray(pcd.points)).to(torch.float)
input_color = torch.from_numpy(np.asarray(pcd.colors)).to(torch.float)
input_normal = torch.from_numpy(np.asarray(pcd.normals)).to(torch.float)
PiotrRzRobotec commented 7 months ago

Thank you for the answer. Yes, my point cloud has color and already I am reading point cloud like that. However, I realized it was an issue in Blender where I was trying to load exported ply. vis.to_file(vis.mesh(mesh.v, mesh.f, color=mesh.c) was working from beginning, everything is fine now