4
0
mirror of https://github.com/nerfstudio-project/nerfstudio.git synced 2026-11-10 18:17:31 +08:00
This commit is contained in:
Frédéric Devernay 2026-07-27 19:18:44 +02:00 committed by GitHub
commit 27838aac94
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -28,7 +28,7 @@ from PIL import Image
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 @@ class ColmapDataParser(DataParser):
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,