Opencv camera calibration solution unique?

0

I am using Camera calibration with OpenCV tutorial https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_calib3d/py_calibration/py_calibration.html to calibrate my camera. I have a question about how to use the real physical grid size on the chess board. I used the physical grid size in the following line:

objp[:,:2] = np.mgrid[0:7,0:6].T.reshape(-1,2) * gridsize

I found that changing the grid size does not change the camera intrinsic matrix, it only change the camera position. So in the line below:

ret, mtx, dist, rvecs, tvecs = cv2.calibrateCamera(objpoints, imgpoints, gray.shape[::-1],None,None)

mtx, dist is always the same no matter what grid size you use. Only tvecs changes with grid size.

My question is “Is there a way to get the unique solution for mtx, and tvecs, given certain grid size?”

the solution you get is correct.

for monocular calibration, mathematically, grid size only affects the tvec. the spacing of the board has no effect on any intrinsic parameters (projection matrix, distortion coefficients).

tutroals has been taken offline. all of that is available in official docs: OpenCV: Camera Calibration

Thanks for the information. My calibration for a GoPro camera is fx=1450, fy=1450. Most calibration results online I found had fx=600-700. So I am wondering how I can get similar results as those online. Is thee a way to fix tvec?

your desire is misplaced. those have no reason to be equal or similar.

focal length describes the angular/tangential resolution of the picture. I won’t go into detail with the math, just some numerical examples.

given f_x=1450, stepping 1 pixel away from the optical center means \tan(\alpha) = \frac{1}{1450}, so \alpha = 0.0395°, no matter the field of view or picture resolution. stepping away 960 pixels gives an angle of 33.5°… and half the width is half the hFoV, so the full width of 1920 pixels has a hFoV of 67°.

for the same fx=1450, if your picture were 640 pixels wide, that’d result in a hFoV of ~24.9° (it’s a crop).

if you had 640 pixels for the same hFoV of 67°, you’d get fx=483 (picture looks downscaled).