diff --git a/nerfstudio/data/dataparsers/colmap_dataparser.py b/nerfstudio/data/dataparsers/colmap_dataparser.py index dede3a3be5..3159b34ebd 100644 --- a/nerfstudio/data/dataparsers/colmap_dataparser.py +++ b/nerfstudio/data/dataparsers/colmap_dataparser.py @@ -28,7 +28,7 @@ from rich.prompt import Confirm from nerfstudio.cameras import camera_utils -from nerfstudio.cameras.cameras import CAMERA_MODEL_TO_TYPE, Cameras +from nerfstudio.cameras.cameras import CAMERA_MODEL_TO_TYPE, Cameras, CameraType from nerfstudio.data.dataparsers.base_dataparser import DataParser, DataParserConfig, DataparserOutputs from nerfstudio.data.scene_box import SceneBox from nerfstudio.data.utils import colmap_parsing_utils as colmap_utils @@ -279,12 +279,14 @@ def _generate_dataparser_outputs(self, split: str = "train", **kwargs): cy.append(float(frame["cy"])) height.append(int(frame["h"])) width.append(int(frame["w"])) - if any([k in frame and float(frame[k]) != 0.0 for k in ["k4", "k5", "k6"]]): + if camera_type == CameraType.PERSPECTIVE and "k4" in frame and float(frame["k4"]) != 0.0: raise ValueError( - "K4/K5/K6 is non-zero! Note that Nerfstudio camera model's K4 has different meaning than colmap " - "OPENCV camera model K4. Nerfstudio's K4 is the 4-th order of radial distortion coefficient, while " - "colmap/OPENCV's K4 is 4-th coefficient in fractional radial distortion model." + "K4 is non-zero! Note that Nerfstudio's perspective distortion parameter K4 has different meaning " + "than colmap's OPENCV parameter K4. Nerfstudio's K4 is the 4-th order of radial distortion " + "coefficient, while colmap/OPENCV's K4 is 4-th coefficient in fractional radial distortion model." ) + if any([k in frame and float(frame[k]) != 0.0 for k in ["k5", "k6"]]): + raise ValueError("Non-zero K5 or K6 distortion parameter is unsupported by Nerfstudio .") distort.append( camera_utils.get_distortion_params( k1=float(frame["k1"]) if "k1" in frame else 0.0,