This value should ideally be in the center of the image but is typically slightly off center. The principal point is the point on the image which is directly below the center of the The intrinsic matrix in a 3x3 matrix which contains information about theįocal length (position 0,0 and 1,1 in the matrix) and the principal point (position 2,0 and 2,1). You can abort the program by hitting the esc button.įor the camera calibration there are two important datasets, the intrinsic matrix and the distortion coefficients. The video will run until either the videoĮnds or the number of calibration images listed above are collected. Press the spacebar to save the video frames for calibration. Once the script is set-up, run the program. If you change the resolution or the FOV settings on the camera, it will change the distortion model and should be recalibrated. Your recording at a different resolution. Check the dimensions of the checkerboard squares and adjust the board_dim value. If you are using theĬheckerboard provided then the board_w and board_h should be all set. Next check the rest of the parameters and change as needed. If the file is in the same folder as the script then the name will suffice, if not then you need to add Here you need to direct the script to the calibration video file, named 'filename'.
Feel free to move the pattern forward and back, rotation of the pattern is not a problem. Periphery since this is where the distort is most pronounced. Make sure to put the pattern in at least 20 unique positions, try to get the You want to beĪble to pull video frames with the pattern in many different positions around the field of view of the camera. Move the pattern slowly, any motion blur will reduce the accuracy of the calibration. Pattern right and left, up and down to position it in many different locations. Since I normally cannot see the video, I slowly move the Recording place the calibration pattern a minimum of ~2 feet away from the camera and move the pattern around the field of view. To record the video make sure the camera is on a stable platform so it remains still. However, I typically do it with just myself. With a GoPro this can be a touch difficult without two people and LCD backpack because youĬannot see what you are filming. This video and you will have the ability to save images of the pattern to use in the calibration. Next, we need to create a video of the calibration pattern. Anything rigid will work, we just don't want the calibration pattern to deform. I typically print out this pattern on a standard 8.5" x 11" sheet of paper and tape it to a piece of We will then undistort the images or videos based on these values.įor this script we will use a checkboard pattern which can be downloaded above. This will allow us to model the distortion in the image throughout the field of view and calculate the distortion parameters of the camera. Pattern in the image to the real life dimensions. This script will collect images of this pattern and compare the dimensions of the This script has been tested on a GoPro Hero 2 and GoPro Hero 3 black.Ĭalibrating a camera system relies on collecting images of a calibration pattern of known dimensions. While this projectįocuses on calibrating GoPro cameras, any camera can be calibrated with some minor adjustments to the code. There are several on-line resources for camera calibration including a great Matlab toolbox and a Python/OpenCV tutorial, which this program is based on. If we want to take any quantitative measurementsįrom the image we must first remove the distortion so that the image exemplifies the real-world. Related math you can check out these books: Multiple View Geometry inĭue to the distortion imparted on the image, the geometry, shape and scale of objects in the image are modified compared to the real-world. For more a in-depth explanation of the camera geometry and
There is a second form of distortion called translationalĭistortion which derives from the fact that the lens is typically not perfectly centered above and parallel to the imaging sensor. The fisheye lens used in GoPro cameras causes increased distortion as you move away from the center of the image. This is mostly due to the shape of the lens and is typically called radialĭistortion. Which are supposed to be straight (red lines), like the door frame and cabinets are curved in the image. The image on the right was taken from a GoPro Hero 3.
Every camera, with the exception of high end models, imparts some form of distortion on an image.