4
0
mirror of https://github.com/nerfstudio-project/nerfstudio.git synced 2026-11-11 02:24:38 +08:00

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 Yoo 2024-06-29 13:46:54 +09:00 committed by GitHub
parent c8fcf081ec
commit 90cc4f1d1e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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)