-
Notifications
You must be signed in to change notification settings - Fork 1
/
default_intrinsics.py
99 lines (83 loc) · 2.14 KB
/
default_intrinsics.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import os
import json
from pathlib import Path
# Path to the code directory
# BASEPATH = os.path.dirname(os.path.abspath(__file__)).split('code')[-2]
# CODEPATH = os.path.join(BASEPATH, 'code')
# DATAPATH = os.path.join(BASEPATH, 'data')
# sys.path.append(CODEPATH)
root_dir = Path(os.path.dirname(os.path.abspath(__file__)))
calib_path = root_dir / 'data/0-calibration/calibs/'
data_folder = root_dir / 'data/raw_data'
checkerboard_path = data_folder / 'calibration'
footage_path = data_folder / 'footage'
calib = {
"K":[
[
659.77,
0.0,
653.80
],
[
0.0,
624.16,
337.32
],
[
0.0,
0.0,
1.0
]
],
"K_new":
[
[
659.77,
0.0,
653.80
],
[
0.0,
624.16,
337.32
],
[
0.0,
0.0,
1.0
]
],
"R":None,
"T":None,
"dist":[
-0.16026,
0.0262125,
-0.00224888,
-0.00259982,
0.0
],
"view_id":1,
"ROI":None,
"bounding_box":None,
"size":None
}
calib_path.mkdir(parents=True, exist_ok=True)
for vid_id, vid_path in enumerate(sorted(footage_path.iterdir())):
# remote_vid_path = remote_volume / vid_path
# cam_folder = destination_folder / f'cam{vid_id + 1}'
# cam_folder.mkdir(parents=True, exist_ok=True)
# cam_file = cam_folder / vid_path.name
# if cam_file.is_symlink():
# cam_file.unlink()
# cam_file.symlink_to(vid_path)
calib["view_id"] = vid_id + 1
json_dict = json.dumps(calib, indent = 4)
with open(calib_path / f"cam{vid_id + 1}.json", 'w') as f:
f.write(json_dict)
# cam_folder = destination_folder / f'cam{360}'
# cam_folder.mkdir(parents=True, exist_ok=True)
# cam_file = cam_folder / '360.mp4'
# if cam_file.is_symlink():
# cam_file.unlink()
# cam_file.symlink_to(remote_360_volume)
# checkerboard_path.mkdir(parents=True, exist_ok=True)