This is an old revision of the document!
Camera Calibration
To calibrate a camera some calibration pattern is required, traditionally this is a checkerboard which can be generated with the help of the code in the following link.
OpenCV
This approach is based on the opencv documentation for camera calibration in the following link. The repository in the following link implements camera calibration with as well as picture taking with realsense cameras. This repository was written by Pontus Rosqvist, Josefin Gustafsson, Markus Nagy and Martin Lyrå.
The code for camera calibration expects images of checkerboards taken with the camera for which we need to compute the instrinsic camera parameters. The size of the checkerboard needs to be supplied since the opencv function findChessboardCorners needs to know how many points it is looking for and the entire chessboard needs to be visible in every image. The height and width of the chessboard which needs to be specified is not the height and width of the chessboard in squares but rather the heigth and width of the inner corners (points between squares). For example a normal chessboard is 8 by 8 if you count the squares but if we count the inner corners it is 7 by 7 so we would supply 7 by 7 to the function.
Ideally the calibration algorithm is supplied many different images of the checkeboard in many different positions and angles in all areas of the image to ensure a good estimate but it is quite sensitive to noise so it is important to visually inspect the images to verify that the corners can be estimated correctly and accurately.