简体   繁体   中英

C++ Opencv Calibration of the camera with different resolution

My camera has different resolutions 1280*480 640*240 320*120

I have used the algorithm of Opencv3 to calibrate the camera with the resolution of 1280*480 and I have got the camera matrix (fx fy cx cy)and the distortion matrix (k1 k2 p1 p2 k3)for this resolution.

But now I want to use these camera matrix and distortion matrix to calibrate the camera with the resolution of 320*120. I don't know how to apply these two matrix of the resolution 1280*480 to the resolution of 320*120. PS I haven't calibrated the camera with the resolution of 320*120 directly because the image is too small and the algorithm of Opencv can't find the chessboard.

I want to know how the camera matrix (fx fy cx cy)and the distortion matrix (k1 k2 p1 p2 k3) will change if i change the resolution 1280*480 to 320*120.

The algorithm of opencv is the following one: http://docs.opencv.org/3.0-beta/doc/tutorials/calib3d/camera_calibration/camera_calibration.html

You don't need to change the distortion matrix. As for the camera matrix (the one containing fx, fy, cx, cy ), you just need to divide them by 4 in your case. The general formula is:

fx' = (dimx' / dimx) * fx 
fy' = (dimy' / dimy) * fy

fx' is the value for your new resolution, fx is the value you already have for your original resolution, dimx' is the new resolution along the x axis, dimx is the original one. The same applies to fy .

cx and cy are calculated analogically because all these values are expressed in pixel coordinates.

As per the OpenCV docs regarding the camera matrix:

if an image from the camera is scaled by a factor, all of these parameters should be scaled (multiplied/divided, respectively) by the same factor.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM