Juan Minoli
Juan Minoli

Reputation: 11

Error when I try to assign triangles in open3D

i'm trying to do this:

mesh = o3d.geometry.TriangleMesh()
mesh.vertices=o3d.utility.Vector3dVector(vertices)
mesh.triangles=o3d.utility.Vector3dVector(triangles)

but i got this error:

TypeError: (): incompatible function arguments. The following argument types are supported:
1. (self: open3d.open3d_pybind.geometry.TriangleMesh, arg0: open3d.open3d_pybind.utility.Vector3iVector) -> None

Invoked with: geometry::TriangleMesh with 3400 points and 0 triangles., std::vector with 6768 elements.
Use numpy.asarray() to access data.

Did you forget to #include ? Or ,
, , etc. Some automatic
conversions are optional and require extra headers to be included
when compiling your pybind11 module.

    vertices is a numpy array with shape (3400,3)
    and triangles is also a numpy array with shape (6768,3)

thanks

Upvotes: 0

Views: 2449

Answers (1)

Juan Minoli
Juan Minoli

Reputation: 11

The solution is change this mesh.triangles=o3d.utility.Vector3dVector(triangles) to mesh.triangles=o3d.utility.Vector3iVector(triangles).

Upvotes: 1

Related Questions