|
73 | 73 | logging.error(f"Mapper failed with code {exit_code}. Exiting.")
|
74 | 74 | exit(exit_code)
|
75 | 75 |
|
| 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 | + |
76 | 86 | ### Image undistortion
|
77 | 87 | ## We need to undistort our images into ideal pinhole intrinsics.
|
78 | 88 | img_undist_cmd = (colmap_command + " image_undistorter \
|
@@ -175,21 +185,21 @@ def concat_alpha(seg_path):
|
175 | 185 |
|
176 | 186 | destination_file = os.path.join(args.source_path, "images_2", file)
|
177 | 187 | 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) |
179 | 189 | if exit_code != 0:
|
180 | 190 | logging.error(f"50% resize failed with code {exit_code}. Exiting.")
|
181 | 191 | exit(exit_code)
|
182 | 192 |
|
183 | 193 | destination_file = os.path.join(args.source_path, "images_4", file)
|
184 | 194 | 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) |
186 | 196 | if exit_code != 0:
|
187 | 197 | logging.error(f"25% resize failed with code {exit_code}. Exiting.")
|
188 | 198 | exit(exit_code)
|
189 | 199 |
|
190 | 200 | destination_file = os.path.join(args.source_path, "images_8", file)
|
191 | 201 | 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) |
193 | 203 | if exit_code != 0:
|
194 | 204 | logging.error(f"12.5% resize failed with code {exit_code}. Exiting.")
|
195 | 205 | exit(exit_code)
|
|
0 commit comments