-
Notifications
You must be signed in to change notification settings - Fork 0
/
transfer_deformation.py
29 lines (23 loc) · 1001 Bytes
/
transfer_deformation.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""
:author: Allan
:copyright: © 2020 Yalun Hu <[email protected]>
:license: MIT, see LICENSE for more details.
"""
from deformation_transfer import DeformationTransferSolver
from config import get_deformation_transfer_solver_args
import process_obj_file as p_obj
import os
"""
This script shows a demo that how to execute the deformation transfer algorithm.
If you want to transfer a sequence of source mesh's deformation, you'd better use
multiprocessing to accelerate the algorithm.
"""
if __name__ == "__main__":
cfg = get_deformation_transfer_solver_args()
solver = DeformationTransferSolver(cfg)
src_def_vts, _ = p_obj.load_obj_file(cfg.src_def_obj)
_, dst_ref_faces = p_obj.load_obj_file(cfg.dst_ref_obj)
solver_right_mat = solver.build_problem(src_def_vts)
dst_def_vts = solver.solve_problem(solver_right_mat)
save_path = os.path.join(cfg.save_dir, "dt_result.obj")
p_obj.write_obj_file(save_path, dst_def_vts, dst_ref_faces)