Fix dimension mismatch between downscaled cameras and images in colmap. (#3232)

Co-authored-by: jisung.yoo <jisung.yoo@naverlabs.com>
This commit is contained in:
Jisung Yooandjisung.yoo authored and GitHub committed 2024-06-29 04:46:54 +00:00
1 parent c8fcf081ec
commit 90cc4f1d1e
1 file changed
+5 -4
@@ -478,12 +478,13 @@ class ColmapDataParser(DataParser):
with status(msg="[bold yellow]Downscaling images...", spinner="growVertical"):
assert downscale_factor > 1
assert isinstance(downscale_factor, int)
filepath = next(iter(paths))
img = Image.open(filepath)
w, h = img.size
w_scaled, h_scaled = calculate_scaled_size(w, h, downscale_factor, downscale_rounding_mode)
# Using %05d ffmpeg commands appears to be unreliable (skips images).
for path in paths:
# Compute image-wise rescaled width/height.
img = Image.open(path)
w, h = img.size
w_scaled, h_scaled = calculate_scaled_size(w, h, downscale_factor, downscale_rounding_mode)
# Downscale images using ffmpeg.
nn_flag = "" if not nearest_neighbor else ":flags=neighbor"
path_out = get_fname(path)
path_out.parent.mkdir(parents=True, exist_ok=True)