New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pcu.write_ply() throws "Incompatible function arguments error" #22
Comments
I was able to solve the issue by passing in empty numpy arrays to n and uv |
But the point clouds do not make any sense to the input mesh (which is a chair). Am I doing something wrong here? |
Hey thanks for reporting the issue. Can you upload the mesh so I can try it out? I tried |
Hey, so I just downloaded your mesh and ran The results seem quite reasonable to me. For reference, I'm running point_cloud_utils version 0.15.1 installed from conda-forge on a Linux machine. Could you post a screenshot showing what was wrong with your point cloud? Could you also post the version of point_cloud_utils and platform you're running on. Reproducing stepsimport point_cloud_utils as pcu
v, f, n = pcu.read_obj("ChairArms1.obj")
pts = pcu.sample_mesh_lloyd(v, f, 15000) I plotted the mesh and points using mayavi: from mayavi import mlab
mlab.figure(bgcolor=(0.1, 0.1, 0.1))
mlab.triangular_mesh(v[:, 0], v[:, 1], v[:, 2], f)
mlab.triangular_mesh(v[:, 0], v[:, 1], v[:, 2], f, representation='wireframe', color=(0.1, 0.1, 0.1))
mlab.points3d(pts[:, 0], pts[:, 1], pts[:, 2], scale_factor=0.015)
mlab.show() which yield the following (white points are the lloyd samples): |
Is it possible to save the point clouds as .ply file? I am confused with that part of the code. I am saving it as a .ply file and the point clouds do not make any sense. |
Yes you can save the point clouds as a PLY file as follows: import point_cloud_utils as pcu
import numpy as np
v, f, n = pcu.read_obj("ChairArms1.obj")
pts = pcu.sample_mesh_lloyd(v, f, 15000)
pcu.write_ply("out.ply", pts, np.zeros([0, 3], dtype=np.int32), np.zeros([0, 3]), np.zeros([0, 2])) The zero-arrays are just passing empty faces, normals and uv coordinates. Currently, the interface for MeshIO is not very user unfriendly. I plan on overhauling this completely in the near future so it's no so confusing. EDIT: Replaced |
I am confused by this. Shouldn't we be passing 'pts' in write_ply function and not 'v'?. I have replaced the variable 'v' with 'pts' and it works. Thanks for responding! |
Ah yeah you're right! Sorry I didn't test the code before submitting the responds. I just edited the response. |
I am trying to load a mesh in .obj format, perform Lloyd Relaxation and then save the point clouds to .ply format. I am writing the following code:
Note: I have no normals in my mesh file
The text was updated successfully, but these errors were encountered: