nerfstudio-project / gsplat

CUDA accelerated rasterization of gaussian splatting
https://docs.gsplat.studio/
Apache License 2.0
2.16k stars 273 forks source link

cv2.error for undistortion parameter of COLMAP output for gsplat #329

Open MasahiroOgawa opened 2 months ago

MasahiroOgawa commented 2 months ago

I'm trying to run gsplat on my own data, but in fail. I successfully ran COLMAP and got it's outputs including camera.bin, which is needed for gsplat. Then I ran the command;

python simple_trainer_mcmc.py --data_factor 1 --data_dir /data/

, I got below error.

Traceback (most recent call last): File "/workspace/examples/simple_trainer_mcmc.py", line 830, in main(cfg) File "/workspace/examples/simple_trainer_mcmc.py", line 810, in main runner = Runner(cfg) File "/workspace/examples/simple_trainer_mcmc.py", line 181, in init self.parser = Parser( File "/workspace/examples/datasets/colmap.py", line 209, in init K_undist, roi_undist = cv2.getOptimalNewCameraMatrix( cv2.error: OpenCV(4.10.0) /io/opencv/modules/calib3d/src/undistort.dispatch.cpp:411: error: (-215:Assertion failed) CV_IS_MAT(_distCoeffs) && (_distCoeffs->rows == 1 || _distCoeffs->cols == 1) && (_distCoeffs->rows_distCoeffs->cols == 4 || _distCoeffs->rows_distCoeffs->cols == 5 || _distCoeffs->rows_distCoeffs->cols == 8 || _distCoeffs->rows_distCoeffs->cols == 12 || _distCoeffs->rows*_distCoeffs->cols == 14) in function 'cvUndistortPointsInternal'

MasahiroOgawa commented 2 months ago

I'm using COLMAP for latest main branch (2024/7/31is the latest commit). I used docker for COLMAP with the command

colmap automatic_reconstructor --image_path ./images --workspace_path .
liruilong940607 commented 2 months ago

This is strange. Could you print out the shape of the params at this line?

https://github.com/nerfstudio-project/gsplat/blob/91bcbfa4af4088c1331345bd196d478eb5a9898d/examples/datasets/colmap.py#L210

MasahiroOgawa commented 2 months ago

I'm using docker, and accidentally I removed the container, so now I'm recreating it. After I finished recreation, I will print the shape and values.