-
Notifications
You must be signed in to change notification settings - Fork 11
/
backfill_az_scenes.py
47 lines (35 loc) · 1.5 KB
/
backfill_az_scenes.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
import json
import os
from utils.camera_utils import load_distortion_static, load_intrinsic_static, write_static_distortion, write_static_intrinsic
camera_name = "az_camera1"
camera_intr = load_intrinsic_static(camera_name)
camera_dist = load_distortion_static(camera_name)
for scene in os.listdir("scenes"):
scene_dir = os.path.join("scenes", scene)
if not os.path.isdir(scene_dir):
continue
if "official_real_test" not in scene_dir:
continue
write_static_intrinsic(camera_name, scene_dir, raw=False)
write_static_intrinsic(camera_name, scene_dir, raw=True)
write_static_distortion(camera_name, scene_dir, raw=False)
write_static_distortion(camera_name, scene_dir, raw=True)
data = os.path.join(scene_dir, "data")
for f in os.listdir(data):
f = os.path.join(data, f)
if "meta" not in f:
continue
with open(f, "r") as file:
meta = json.load(file)
meta["intrinsic"] = camera_intr.tolist()
meta["distortion"] = camera_dist.tolist()
with open(f, "w") as file:
meta = json.dump(meta, file)
for scene in os.listdir("extrinsics_scenes"):
scene_dir = os.path.join("scenes", scene)
if not os.path.isdir(scene_dir):
continue
write_static_intrinsic(camera_name, scene_dir, raw=False)
write_static_intrinsic(camera_name, scene_dir, raw=True)
write_static_distortion(camera_name, scene_dir, raw=False)
write_static_distortion(camera_name, scene_dir, raw=True)