Camera Calibration
The Track framework requires your camera device to be calibrated properly before any tracking. The goal of camera calibration is to find the physical characteristics of your camera, lens and sensor. A correct calibration enables accurate tracking results.
The resolution parameter defined in the calibration file determines the input resolution of the Track framework.
The standard resolution for the Track framework is 640 x 480
.
Supported resolutions
Track supports different input resolutions, yet not all features support all resolutions. If you intend to use Track with a non-standard resolution, please refer to this compatibility table:
Resolution | Image | SHAPE | QR code | CAD | MAP |
---|---|---|---|---|---|
640 x 360 |
✔️ | ✔️ | ✔️ | ||
640 x 480 |
✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
1280 x 720 |
✔️ | ✔️ | ✔️ | ||
1280 x 960 |
✔️ | ✔️ | ✔️ |
Since each camera has different properties, the calibration needs to be known for every camera intended to be used for AR tracking. If camera parameters change due to zooming, using a different resolution or changing the lens, the calibration needs to be performed again. If the camera calibration data does not correspond with the lenses used in reality, the tracked pose might be offset, or the tracking might fail.
Format
The Track framework requires the following calibration information for each camera:
- Resolution (rx, ry)
- Camera resolution used during calibration
- Determines the frameworks processing resolution (see above)
- Intrinsic parameters (fx, fy, cx, cy)
- fx and fy refer to the camera's focal lengths
- cx and cy refer to the principal points
- Distortion coefficients (k1, k2, p1, p2, k3)
- k1, k2, and k3 refer to the radial distortions of the camera lens
- p1 and p2 refer to the tangential distortions of the camera lens
- If the camera calibration software does not provide any, or less than 5 distortion coefficients, define the missing values as 0.
To be compatible with our calibration reader tool, the calibration parameters need to be saved in the following format. This format can reflect multiple cameras with multiple resolutions:
- The main section always has the key
Intrinsic
- Cameras are addressed by their ID where the naming should follow the convention
cam0
,cam1
, ... - The specific resolution parameters are identified via a key that reflects the resolution.
E.g.
640x480
.
For a list of supported resolution please refer to the table above.
calibration.json
{
"Intrinsic": {
"cam0": {
"640x360": {
"Resolution": [640.0, 360.0],
"FocalLength": [600.0, 600.0],
"PrincipalPoint": [320.0, 180.0],
"Distortion": [0.0, 0.0, 0.0, 0.0, 0.0]
},
"640x480": {
"Resolution": [640, 480],
"FocalLength": [600.0, 600.0],
"PrincipalPoint": [320.0, 240.0],
"Distortion": [0.0, 0.0, 0.0, 0.0, 0.0]
}
},
"cam1": {
"640x360": {
"Resolution": [640.0, 360.0],
"FocalLength": [600.0, 600.0],
"PrincipalPoint": [320.0, 180.0],
"Distortion": [0.0, 0.0, 0.0, 0.0, 0.0]
}
}
}
}
Performing calibration for your camera
To calibrate the camera, the following are required:
- Calibration board
- Camera to calibrate
- Camera calibration software
Calibration board
The calibration board usually is made of a checkerboard pattern, in which the square sizes on each longitudinal and lateral direction are equal.
A sample checkerboard calibration board with a 8x11
20mm square pattern can be downloaded here.
For accurate results, the calibration pattern needs to be completely flat. To keep the pattern flat, attach it to a flat surface such as a table, board or wall.
Camera
Prepare the camera whose calibration data you want to determine:
- Deactivate autofocus to fix the focal length at the desired tracking distance
- Set the resolution to the intended processing resolution. (see above)
Tip
If your default Camera App does not include the required settings download the OpenCamera App.
Take at least 15~20 pictures of the calibration board from various viewpoints, as shown below:
- Avoid similar calibration image, it might cause inaccurate calculation of the calibration parameters
- Try to avoid image blur by keeping the camera and the calibration board steady
Calibration software
To calculate the calibration parameters, you need to use camera calibration software. You may pick one of these tools: