Camera calibration is the mechanism for estimating the parameters of the lens and image sensor of a camera. These parameters are known as intrinsics and extrinsics. These parameters can be used to measure the size of an object in real-world units, correct lens distortion, or determine the location of the camera in a specific frame of reference. Camera calibration is not necessary, but when provided will significantly improve the functionality of Vuforia Engine. Vuforia Engine uses the intrinsics and the distortion parameters to improve performance of detection and tracking.
- Print calibration template file
- Capture camera frames
- Process camera frames in Camera Calibration Toolbox
- Update the custom driver with calibration results
- Your preferred Camera calibration tool
- A method of capturing Frames from the camera or device
- A way to print a PDF file – preferably with stiff backing
This procedure will require a Camera calibration tool. There are various tools available for use. Below are some options for camera calibration tools:
This document shows how to obtain calibration data using the GML Camera Calibration Toolbox.
This outlines the procedure to calibrate an external camera for the Vuforia Engine Driver Framework. The External Camera feature requires the following parameters to be obtained through the calibration process.
- Frame size, 2 integer numbers for width and height in pixels
- Focal length, 2 floating point numbers for x and y distance between focal point and the image plane in pixels
- Principal point, 2 floating point numbers for x and y center of the image in pixels
- Distortion values, 2-8 floating point numbers representing radial and tangential distortion in camera frame
For more information, please refer to the
CameraIntrinsics structure section below.
Print calibration template
A calibration template must be printed in order to perform the calibration. Please refer to the specific calibration tool instructions for information on which template to use. The following instructions use the checkerboard template with the GML Camera Calibration Toolbox.
- Template size should be at least A4
- Print the template on a rigid foam board or mount the printout on a flat, rigid surface such as a sheet of glass, foamboard, an aluminum sheet or a plexiglass sheet. Take care not to introduce kinks, ripples or distortions
In order to calibrate the camera, images need to be captured using the camera. Capture software which is supplied with your camera can be used to capture frames. Images can be captured using compressed formats such as JPG, but ensure that the images look sharp and do not contain excessive amount of compression artefacts.
Examples of capture software:
Capturing Calibration Frames
- Specify the camera frame size in the application used to capture the images. Different frame sizes will have different camera parameters; therefore, the specified frame size used in the calibration process must be the same frame size that will be used by the Driver in Vuforia Engine.
- Capture 20 or more images of the checkerboard from different distances and angles as shown below. For best results during calibration, ensure the following when capturing the images:
- The template goes right into the corners of the image in some views.
- The template is completely visible in every image and has a white border.
- The calibration area is well lit and without spectral reflections from the environment or the template target. A light level of 600 lux is recommended.
- The template corners are distributed to all positions in the image frame especially the corners and sides of the image frame.
- Capture at least 20 images from different angles and distances. Capturing upwards of 30 images can produce better calibration results.
Example image captures:
Process Camera Frames
Once calibration frames are captured, the frames must be processed in the tool of choice. The following Instructions continue use GML Camera Calibration Toolbox on Windows.
Follow any setup steps as instructed by the tool:
After completing the camera calibration, the frame size, focal length, principal point and distortion parameters are reported. These values are used from within the Driver.
Providing the Camera Intrinsics
Once the calibration data has been obtained, the Driver needs to be updated and provide the camera intrinsics to Vuforia Engine through the
CameraIntrinsics structure. The
CameraIntrinsics structure is a value in the
CameraFrame structure which is provided every frame through the
CameraCallBack::onNewCameraFrame(frame) function. For more information on building a custom driver, please refer to Creating a Custom Driver.
focalLengthX– First Focal Length result from calibration procedure
focalLengthY– Second Focal Length result from calibration procedure
principalPointX– First Principal Point result from calibration procedure
principalPointY– Second Principal Point result from calibration procedure
distortionCoefficients– Values in the Distortion result from calibration procedure from left-to-right order. Unavailable values should be set to 0. Distortion coefficients are in the following form (r: radial, t:tangential): [r0, r1, t0, t1, r2, r3, r4, r5]
NOTE: If the Camera Calibration tool reports values with +/- error values, be sure to ignore them. The distortionCoefficients requires 8 values. If the tool does not provide them, use a value of 0.
For more details on the mathematical details behind camera calibration and more understanding of the intrinsics and distortion models, see the OpenCV Camera Calibration Tutorial.