-
Notifications
You must be signed in to change notification settings - Fork 0
/
find_correspondence.py
27 lines (25 loc) · 1.04 KB
/
find_correspondence.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 <allancodeman@163.com>
:license: MIT, see LICENSE for more details.
"""
import os
from correspondence_finder import CorrespondenceFinder
import json
from config import get_correspondence_finder_args
"""
This script find the correspondence triangle faces of two meshes with different topology.
The correspondence a many-to-many mapping.
The indices of the correspondent faces will be saved into a json file
"""
if __name__ == "__main__":
cfg = get_correspondence_finder_args()
finder = CorrespondenceFinder(cfg)
src_crspd_faces_indices, dst_crspd_faces_indices = finder.find_correspondence()
finder.check_crspd_faces_distance(src_crspd_faces_indices, dst_crspd_faces_indices)
data_dict = {'src': src_crspd_faces_indices, 'dst': dst_crspd_faces_indices}
# save the results into json file
save_path = os.path.join(cfg.save_dir, cfg.save_name)
with open(save_path, 'w') as f:
json.dump(data_dict, f)
print(f'Successfully save correspondence into: {save_path}')