Skip to content

Commit 1750fb2

Browse files
committed
Use better names for camera mappings dump
1 parent 9a0e2f0 commit 1750fb2

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

opensfm/undistort.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,7 @@ def dump_camera_mapping_cache(dest_file):
131131
global _camera_mapping_cache
132132

133133
ids = []
134-
x_maps = []
135-
y_maps = []
136-
offsets = []
134+
outs = {}
137135

138136
def cast_to_max(arr):
139137
m = np.max(arr)
@@ -151,6 +149,7 @@ def cast_to_max(arr):
151149
# map1[px_y, px_x] <--> compressed_map1[px_y,px_x] + offset[0] + px_x
152150
# map2[px_y, px_x] <--> compressed_map2[px_y,px_x] + offset[1] + px_y
153151
# (note our values are rounded to the closest pixel, though)
152+
idx = 0
154153
for key, v in _camera_mapping_cache.items():
155154
ids.append(v['id'])
156155
map1, map2 = v['map']
@@ -168,11 +167,13 @@ def cast_to_max(arr):
168167
map1 = cast_to_max(map1)
169168
map2 = cast_to_max(map2)
170169

171-
x_maps.append(map1)
172-
y_maps.append(map2)
173-
offsets.append(offset)
170+
outs['%s_x' % idx] = map1
171+
outs['%s_y' % idx] = map2
172+
outs['%s_offset' % idx] = offset
174173

175-
np.savez_compressed(dest_file, ids=ids, *x_maps, *y_maps, *offsets)
174+
idx += 1
175+
176+
np.savez_compressed(dest_file, ids=ids, **outs)
176177

177178
def undistort_image_and_masks(arguments) -> None:
178179
shot, undistorted_shots, data, udata, imageFilter = arguments

0 commit comments

Comments
 (0)