Camera calibration¶
The camera calibration module is a base module which is available on every rc_visard.
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 module is responsible for checking calibration and recalibrating.
Self-calibration¶
The camera calibration module 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 module’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 page under the Configuration 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¶
The quality of camera calibration heavily depends on the quality of the calibration grid. Calibration grids for the rc_visard can be obtained from Roboception.
The Camera calibration module has to be selected in the Web GUI under the Configuration tab to verify or perform camera calibration. In the first step, the calibration grid must be specified. 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 bad lighting conditions, or a damaged grid.
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 below 0.2 pixels. If the error is in this range, 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. In case you use a custom calibration grid, 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. 55.
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. 55. However, please be aware that increasing their size too much may result in slightly lower 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. 56.
Note
Calibration might appear cumbersome as it involves holding the grid in certain predefined poses. However, these poses are required to ensure an unbiased, high-quality calibration result.
Monocalibration¶
Full calibration consists of calibrating each camera individually (monocalibration) 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 the next Section 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. 57.
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 that the algorithm accepted the pose.
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 that the algorithm accepted the pose.
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 indicated result is the mean reprojection error of all calibration points. It is given in pixels and typically has a value below 0.2.
Pressing Save Calibration applies the calibration and saves it to the sensor.
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.
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 module is called rc_stereocalib
in the REST-API.
Note
The camera calibration module’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 module’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.