bmild / nerf

Code release for NeRF (Neural Radiance Fields)
http://tancik.com/nerf
MIT License
9.83k stars 1.37k forks source link

Opencv extrinsic instead of colmap #141

Closed Duncan1115 closed 2 years ago

Duncan1115 commented 2 years ago

Hi, Thanks for your great work of nerf ! 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 calibrate it by using Opencv. However, the camera parameters could not be correctly used in nerf. 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:

  1. get the w2c_opencv from Opencv calibration.
  2. set a correctionMatrix, and then correctionMatrix multiplied by w2c_opencv to get w2c_opengl.
  3. 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
ynma-hanvo commented 2 years ago

great work and thanks for sharing. but how many cameras in your system.

Duncan1115 commented 2 years ago

Hi @ynma-hanvo , I use only one camera and one chessboard.

ynma-hanvo commented 2 years ago

@Duncan1115 ok, i see. it means you compute the postions of consective frames by opencv. that 's great. but did you get satisfied result ?

Duncan1115 commented 2 years ago

@ynma-hanvo Sure, the NeRF result of opencv extrinsic was the same as the one of colmap. Altually the near and far bounds should be defined by myself, i.e., if camera is about 3 meters from chessboard, the near/far bound should be set as [0m,10m].