Fix colmap bug when not all images are matched (#1454)

Fix colmap when not 100 matching
This commit is contained in:
Matthew Tancik authored and GitHub committed 2023-02-19 14:48:31 -08:00
1 parent ceda935e64
commit e89d113ddc
1 file changed
+1 -10
+1 -10
View File
@@ -604,14 +604,6 @@ def colmap_to_json(
cameras = read_cameras_binary(cameras_path)
images = read_images_binary(images_path)
# Images were renamed to frame_{i:05d}.{ext} and
# the filenames needs to be replaced in the transforms.json as well
original_filenames = [x.name for x in images.values()]
# Sort was used in nerfstudio.process_data.process_data_utils:get_image_filenames
original_filenames.sort()
# Build the map to the new filenames
filename_map = {name: f"frame_{i+1:05d}{os.path.splitext(name)[-1]}" for i, name in enumerate(original_filenames)}
# Only supports one camera
camera_params = cameras[1].params
@@ -627,8 +619,7 @@ def colmap_to_json(
c2w = c2w[np.array([1, 0, 2, 3]), :]
c2w[2, :] *= -1
name = filename_map[im_data.name]
name = Path(f"./images/{name}")
name = Path(f"./images/{im_data.name}")
frame = {
"file_path": name.as_posix(),