Open3D
Open3D copied to clipboard
got trouble in deform_as_rigid_as_possible()
Describe the bug I run mesh_deformation.py and change the given mesh to my own .obj file mesh.tar.gz some .obj run perfectly but others got trouble in deform_as_rigid_as_possible().
To Reproduce Steps to reproduce the behavior:
- load my own mesh in mesh_deformation.py
def problem3(): mesh = o3d.io.read_triangle_mesh("./mesh/mesh_normalized.obj") vertices = np.asarray(mesh.vertices) static_ids = [idx for idx in np.where(vertices[:, 1] < -0.32)[0]] static_positions = [] for id in static_ids: static_positions.append(vertices[id]) handle_ids = [0] handle_positions = [vertices[0] + np.array((0.1, 0.1, 0.1))] return mesh, static_ids + handle_ids, static_positions + handle_positions
python ./example/Python/Advanced/mesh_deformation.py- got the error:
Traceback (most recent call last): File "/home/uingue/code/Open3D/examples/Python/Advanced/mesh_deformation.py", line 101, in
o3d.utility.IntVector(constraint_ids), constraint_pos, max_iter=50) RuntimeError: [Open3D ERROR] [DeformAsRigidAsPossible] Failed to build solver (factorize)
Expected behavior get the deformed mesh
Environment (please complete the following information):
- OS: Ubuntu 16.04
- Python version: 3.7.5
- Open3D version: 0.9.0.0
- Is this remote workstation?: no
- How did you install Open3D?: pip or conda or build_from_source (provide build method, such as GCC, Xcode, Visual Studio, and so on) yes
Additional context
I tried to rerun your example with the mesh you provide. I get the same error, but the error seems to be that static_positions and static_ids are empty.
@uingue could you comment on @griegler's feedback? @griegler is this issue requires the bug fix?
@syncle maybe we could add more information to the error message. Another alternative is to expand the method parameters to use separate params for static and handle ids and positions.
I had the same error in other data. It seems that my error occurs because #constrain_ids is too small. When I increased it, the error disappeared.
I am also getting error, trying the same file from the sample 'armadillo.obj'
[DeformAsRigidAsPossible] Failed to build solver (factorize)
D:\Dev\Morphic_Git\Morph>open3dMorph.py
[Open3D DEBUG] [DeformAsRigidAsPossible] setting up S'
[Open3D DEBUG] [DeformAsRigidAsPossible] done setting up S'
[Open3D DEBUG] [DeformAsRigidAsPossible] setting up system matrix L
[Open3D DEBUG] [DeformAsRigidAsPossible] done setting up system matrix L
[Open3D DEBUG] [DeformAsRigidAsPossible] setting up sparse solver
[Open3D Error] (class std::shared_ptr<class open3d::geometry::TriangleMesh> __cdecl open3d::geometry::TriangleMesh::DeformAsRigidAsPossible(const class std::vector<int,class std::allocator
Traceback (most recent call last):
File "D:\Dev\Morphic_Git\Morph\open3dMorph.py", line 27, in
I had the same error message. It turned out there were some vertices in my mesh that weren't connected to any edges. I removed these, and then it worked. I haven't tried your code or your mesh, but maybe this helps.
@uingue please reopen if the problem still persists.
I encountered the same problem as @uingue when I deform my triangle meshes using DeformAsRigidAsPossible. I tried with a sequences of meshes with some of them going through while others failed (error message as shown below). I traced back the error to Eigen's sparseLU factorize() and the error message is "m_lastError = "THE MATRIX IS STRUCTURALLY SINGULAR ... ZERO COLUMN AT: " . I tried to add small number like 0.000001 to make the matrix non singular but the problem persists. Does any one encountered similar problem and solved it? thanks a lot!
OPEN3D ERROR MESSAGE:
C++ exception with description "[Open3D Error] (std::shared_ptropen3d::geometry::TriangleMesh open3d::geometry::TriangleMesh::DeformAsRigidAsPossible(const std::vector
Hi griegler, do you know what caused this issue? thanks so much! @griegler
I encountered the same problem as mentioned by @sonamkumar123 . I can only run deform_as_rigid_as_possible() on Armadillo mesh. If I use any other mesh, the problem persists. Can anyone solve this problem? Thanks a lot.
I had the same error - I was able to take my mesh, load it into Meshlab and used the "close holes" filter under "Remeshing, simplification and reconstruction" to seal up some holes. This allowed the solver to work for me. It feels like the deformer works best with manifold meshes that are close to being watertight. My mesh still had a hole.
@digitalmonkey @be-Frozen I had the same issue. It could be solved by specifying the energy type (although the result seems not well).
with o3d.utility.VerbosityContextManager(o3d.utility.VerbosityLevel.Debug) as cm: mesh_prime = mesh.deform_as_rigid_as_possible(constraint_ids, constraint_pos, max_iter=50, energy=o3d.geometry.DeformAsRigidAsPossibleEnergy.Spokes)
Hope above code will help.
@Ziriuzzz It appears that specifying the energy type is not the key. The problem still exists after setting energy=o3d.geometry.DeformAsRigidAsPossibleEnergy.Spokes. or energy=o3d.geometry.DeformAsRigidAsPossibleEnergy.Smoothed. After experiments, I finally found that the deform_as_rigid_as_possible function has certain restrictions on the mesh, which may cause this problem. It could be solved by removing degenerate triangles, duplicated triangles, and degenerate triangles. Here's how you can do it:
mesh.remove_unreferenced_vertices()
mesh.remove_duplicated_vertices()
mesh.remove_degenerate_triangles()
I hope this helps!
@Ziriuzzz It appears that specifying the energy type is not the key. The problem still exists after setting
energy=o3d.geometry.DeformAsRigidAsPossibleEnergy.Spokes.orenergy=o3d.geometry.DeformAsRigidAsPossibleEnergy.Smoothed. After experiments, I finally found that thedeform_as_rigid_as_possiblefunction has certain restrictions on the mesh, which may cause this problem. It could be solved by removing degenerate triangles, duplicated triangles, and degenerate triangles. Here's how you can do it:mesh.remove_unreferenced_vertices()mesh.remove_duplicated_vertices()mesh.remove_degenerate_triangles()I hope this helps!
This worked for me! :)