This is a Python implementation of the paper "Deformation Transfer for Triangle Meshes". I think this repo would be more in-line with the methodology which demonstrated in the paper. Since I didn't optimize the result in an iterative way, instead I use LU factorization to obtain the Moore-Penrose pseudo inverse then calculate the optimal solution of the linear optimization problem.
For Non-rigid registration part, I derive the constraint optimization problem with Lagrangian-Multiplier, then convert it to a un-constraint linear optimization, and solving the problem with LU factorization as well.
numpy 1.18.0
scipy 1.4.1
In this project, the sparse matrix calculation module of scipy is the key tool for solving the linear optimization problem.
The topology of source & target mesh is different with each other.
-
You can adjust the configurations in
./config.py
and see the arguments of each solver. -
If you want to test on your own customized data, you need to first select the marker vertices on the two meshes with different topologies(it could be achieved quickly by using Maya or Blender)
-
After selecting the marker vertices, you need to do non-rigid registration for the mesh first, by running:
python non_rigid_registration.py
This part might take a pretty long time.
- Then you need to find the correspondence of two mesh by executing:
python find_correspondence.py
- Finally, run:
python transfer_deformation.py
-
non-rigid registration stage: about 20 minutes! Though it's pretty slow, we only need to calculate it for once if we have a new pair of source/target mesh.
-
correspondence finding: about 1 minute.
-
deformation transfer: few seconds.
The speed of LU factorization seems has inversely proportional relationship with the number of vertices of mesh. So, use mesh has lower vertices and triangle faces might be faster.
The obj data file released by the author Dr. R.W. Sumner has some mistakes in "face-poses". The order of vertices of reference mesh and some deformed mesh are different!!! e.g. face-01-anger.obj, face-03-fury.obj. As far as I know, only the order of face-02-cry.obj has the same order of vertices as face-reference.obj. So only transfer the deformation of face-02-cry.obj could obtain a correct result while using my code.
I think the order of triangle faces of the face-reference.obj and other deformed face-xx-xxx.obj might be the same, follow this you could still obtain correct deformation transfer results if made some modification based on my code.
In my other tests, if the vertices order of reference and deformed source mesh can be guaranteed, the results are always good!