-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsymlink_script.py
executable file
·92 lines (79 loc) · 2.3 KB
/
symlink_script.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
import os
import json
from pathlib import Path
remote_volume = Path('/run/user/1000/gvfs/') / 'smb-share:server=drobo6.local,share=data' / 'Studies/DM-Karlsruhe-2023/TrackingExterne/2023-09-20-mercredi/'
# smb-share\:server\=drobo6.local\,share\=data/Studies/DM-Karlsruhe-2023/TrackingExterne/2023-09-20-mercredi/')
destination_folder = Path('/home/marmot/MARMOT/data_source2/raw_data/footage')
remote_360_volume = Path('/run/user/1000/gvfs/') / 'smb-share:server=drobo6.local,share=data' / 'Studies/DM-Karlsruhe-2023/Photos/360/Dm-Store.mp4'
calib_path = Path('/home/marmot/MARMOT/data/0-calibration/calibs/')
checkerboard_path = Path('/home/marmot/MARMOT/data_source2/raw_data/calibration')
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(remote_volume.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)