Camera calibration¶
To use the stereo camera as measuring instrument, camera parameters such as focal length, lens distortion, and the relationship of the cameras to each other must be exactly known. The parameters are determined by calibration and used for image rectification (see Planar rectification), which is the basis for all other image processing modules. The rc_visard is calibrated at production time. Nevertheless, checking calibration and recalibration might be necessary if the rc_visard was exposed to strong mechanical impact. The camera calibration component is responsible for checking calibration and recalibrating.
Self-calibration¶
The camera calibration component automatically runs in self-calibration mode at a low frequency in the background. In this mode, the rc_visard observes the alignment of image rows of both rectified images. A mechanical impact, such as one caused by dropping the rc_visard, might result in a misalignment. If a significant misalignment is detected, then it is automatically corrected. After each reboot and after each correction, the current self-calibration offset is reported in the camera component’s log file (see Downloading log files) as:
“rc_stereocalib: Current self-calibration offset is 0.00, update counter is 0”
The update counter is incremented after each automatic correction. It is reset to 0 after manual recalibration of the rc_visard.
Under normal conditions, such as the absence of mechanical impact on the rc_visard, self-calibration should never occur. Self-calibration allows the rc_visard to work normally even after misalignment is detected, since it is automatically corrected. Nevertheless, checking camera calibration manually is recommended if the update counter is not 0.
Calibration process¶
Manual calibration can be done through the Web GUI’s Camera Calibration tab. This tab provides a wizard to guide the user through the calibration process.
Note
Camera calibration is normally unnecessary since the rc_visard is calibrated at production time. Therefore, calibration is only required after strong mechanical impacts, such as occur when dropping the rc_visard.
Step 1: Calibration settings¶
An accurate calibration grid is required for calibration. The grid can be printed
and glued onto a flat surface. A template with instructions is provided here
. Please follow
the instructions very carefully as the calibration quality depends heavily on the calibration
grid’s accuracy.
The Camera calibration component has to be selected in the Web GUI to verify or perform camera calibration. In the first step, the width and height of the grid must be specified as shown in the screenshot above. The Next button proceeds to the next step.
Step 2: Verify calibration¶
In the second step, the current calibration can be verified. To perform the verification, the grid must be held such that it is simultaneously visible in both cameras. Make sure that all black squares of the grid are completely visible and not occluded. A green check mark overlays each correctly detected square. The correct detection of the grid is only possible if all of the black squares are detected. After the grid is detected, the calibration error is automatically computed, and the result is displayed on the screen.
Some of the squares not being detected, or being detected only briefly might indicate a low-quality or damaged calibration grid, or bad lighting conditions.
Note
To compute a meaningful calibration error, the grid should be held as closely as possible to the cameras. If the grid only covers a small section of the camera images, the calibration error will always be less than when the grid covers the full image.
The typical calibration error is around 0.3 pixels. If the error is less than 0.4 to 0.5 pixels, then the calibration procedure can be skipped. If the calibration error is greater, the calibration procedure should be performed to guarantee full sensor performance. The button Next starts the procedure.
Warning
A large error during verification can be due to miscalibrated cameras, an inaccurate calibration grid, or wrong grid width or height. Please make sure that the grid is accurate and the entered grid width and height are correct. Otherwise, manual calibration will actually decalibrate the cameras!
Step 3: Performing calibration¶
The camera’s exposure time should be set appropriately before starting the calibration. To achieve good calibration results, the images should be well-exposed and image noise should be avoided. Thus, the maximum auto-exposure time should be great enough to achieve a very small gain factor, ideally 0.0 dB. The gain factor is displayed below the camera images as shown in Fig. 28.
For calibration, the grid has to be held in certain poses. The arrows from the grid corners to the green areas indicate that all grid corners should be placed inside the green areas. The green areas are called sensitive areas. The Size of Sensitive Area slider can control their size to ease calibration as shown in the screen shot in Fig. 28. However, please be aware that increasing their size too much may result in slightly less calibration accuracy.
Holding the grid upside down is a common mistake made during calibration. Spotting this in this case is easy because the green lines from the grid corners into the green areas will cross each other as shown in Fig. 29.
Note
Calibration might appear cumbersome as it involves holding the grid in certain predefined poses. However, only this can ensure an unbiased, high-quality calibration result.
Monocalibration¶
Full calibration consists of calibrating each camera individually and then performing a stereo calibration to determine the relationship between them. In most cases, the intrinsic calibration of each camera does not get corrupted. For this reason, Skip Monocalibration in the Calibrate tab should be clicked to skip monocalibration during the first recalibration. Continue with the guidelines given in Stereo calibration. If stereo calibration yields an unsatisfactory calibration error, then calibration should be repeated without skipping monocalibration.
The monocalibration process involves five poses for each camera as shown in Fig. 30.
After the corners or sides of the grid are placed on top of the sensitive areas, the process automatically shows the next pose required. When the process is finished for the left camera, the same procedure is repeated for the right one.
Stereo calibration¶
After monocalibration is completed or has been skipped, the stereo calibration process is started. During stereo calibration, both cameras are calibrated to each other to find their relative rotation and translation.
First, the grid should be held closer than 40 cm from the sensor. It must be fully visible in both images and the cameras should look perpendicularly onto the grid. A green outline that stays in the image indicates the images’ acceptance.
Next, the grid should be held at least 1 m from the cameras. The small cross in the middle of the images should be inside of the grid and the cameras must look perpendicularly onto the grid. A green outline that stays in the image indicates the images’ acceptance.
Note
If the check marks on the calibration grid all vanish, then either the camera does not look perpendicularly onto the grid, the green cross in the middle of the images is not inside the grid, or the grid is too far away from the camera.
Step 4: Storing the calibration result¶
Clicking the Compute Calibration button finishes the process and displays the final result. The presented result is the mean reprojection error of all calibration points. It is given in pixels and typically has a value around 0.3.
Note
The given result is the minimum error left after calibration. The real error is definitely not less than this, but could in theory be larger. This is true for every camera-calibration algorithm and the reason why we enforce holding the grid in very specific poses. Doing so ensures that the real calibration error cannot significantly exceed the reported error.
Pressing Save Calibration applies the calibration and saves it to the sensor.
Warning
If a hand-eye calibration was stored on the rc_visard before camera calibration, the hand-eye calibration values could have become invalid. Please repeat the hand-eye calibration procedure.
Parameters¶
The component is called rc_stereocalib
in the REST-API.
Note
The camera calibration component’s available parameters and status values are for internal use only and may change in the future without further notice. Calibration should only be performed through the Web GUI as described above.
Services¶
Note
The camera calibration component’s available service calls are for internal use only and may change in the future without further notice. Calibration should only be performed through the Web GUI as described above.