kwea123 / nerf_pl

NeRF (Neural Radiance Fields) and NeRF in the Wild using pytorch-lightning
https://www.youtube.com/playlist?list=PLDV2CyUo4q-K02pNEyDr7DYpTQuka3mbV
MIT License
2.74k stars 483 forks source link

Opencv extrinsic instead of colmap #128

Closed Duncan1115 closed 2 years ago

Duncan1115 commented 2 years ago

Hi, Thanks for your great work of nerf-pl ! Actually, Using colmap to estimate camera extrinsic spends much time (the installation and runing reconstrusction code...). I tried to put a chessboard in my own llff data and then calibrated it using Opencv. However, the camera parameters could not be correctly used in nerf-pl. I think may be Opencv and colmap have different coordinate systems which makes the camera extrinsic in Opencv can not be used in the code. If you know the answer about how to transform the extrinsic, please tell me. THANK U very much !!

Duncan1115 commented 2 years ago

Already figured it out.... The important thing is to tranform the coordinate system from Opencv to Opengl. As follows:

get the w2c_opencv from Opencv calibration. set a correctionMatrix, and then correctionMatrix multiplied by w2c_opencv to get w2c_opengl. inverse w2c_opengl to get c2w_opengl. I refer to this solution from this web: https://stackoverflow.com/questions/16265714/camera-pose-estimation-opencv-pnp/20373984#20373984