Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions nerfstudio/data/dataparsers/colmap_dataparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -276,12 +276,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,
Expand Down
Loading