Skip to content

Commit 7b72c54

Browse files
authored
Convert db to txt format
2 parents 81a0db2 + ce9f614 commit 7b72c54

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

convert.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,16 @@
7373
logging.error(f"Mapper failed with code {exit_code}. Exiting.")
7474
exit(exit_code)
7575

76+
### Convert model to text format so we can read cameras
77+
convert_cmd = (colmap_command + " model_converter \
78+
--input_path " + args.source_path + "/distorted/sparse/0 \
79+
--output_path " + args.source_path + "/distorted/sparse/0 \
80+
--output_type TXT")
81+
exit_code = os.system(convert_cmd)
82+
if exit_code != 0:
83+
logging.error(f"Convert failed with code {exit_code}. Exiting.")
84+
exit(exit_code)
85+
7686
### Image undistortion
7787
## We need to undistort our images into ideal pinhole intrinsics.
7888
img_undist_cmd = (colmap_command + " image_undistorter \
@@ -175,21 +185,21 @@ def concat_alpha(seg_path):
175185

176186
destination_file = os.path.join(args.source_path, "images_2", file)
177187
shutil.copy2(source_file, destination_file)
178-
exit_code = os.system(magick_command + " mogrify -resize 50% " + destination_file)
188+
exit_code = os.system("mogrify -resize 50% " + destination_file)
179189
if exit_code != 0:
180190
logging.error(f"50% resize failed with code {exit_code}. Exiting.")
181191
exit(exit_code)
182192

183193
destination_file = os.path.join(args.source_path, "images_4", file)
184194
shutil.copy2(source_file, destination_file)
185-
exit_code = os.system(magick_command + " mogrify -resize 25% " + destination_file)
195+
exit_code = os.system("mogrify -resize 25% " + destination_file)
186196
if exit_code != 0:
187197
logging.error(f"25% resize failed with code {exit_code}. Exiting.")
188198
exit(exit_code)
189199

190200
destination_file = os.path.join(args.source_path, "images_8", file)
191201
shutil.copy2(source_file, destination_file)
192-
exit_code = os.system(magick_command + " mogrify -resize 12.5% " + destination_file)
202+
exit_code = os.system("mogrify -resize 12.5% " + destination_file)
193203
if exit_code != 0:
194204
logging.error(f"12.5% resize failed with code {exit_code}. Exiting.")
195205
exit(exit_code)

0 commit comments

Comments
 (0)