With the help of camera calibration, radial and tangential distortion of the images can be corrected or greatly reduced.
The radial distortion in images can be recognized when straight lines are curved (convex or concave) in the image. An extreme example is fisheye lenses (fisheye lenses are not recommended for contour tracing). Although these allow a wide field of view, straight lines that do not pass through the center of the image are displayed in a curved shape and the image is strongly barrel-shaped.
The tangential distortion occurs because the camera lens is not aligned perfectly parallel to the image plane. Therefore some areas in the image may look closer than expected.
When is a camera calibration useful?¶
When image distortion affects the result of contour detection.
When many objects are photographed consecutively with one camera and lens setting.
When lenses that produce significant distortion are used, such as fisheye lenses.
When is a camera calibration not useful?¶
If the image distortion is not visible or does not affect the contour detection result.
If the camera settings have to be changed constantly, e.g. to be able to photograph objects with very different sizes.
When a lens with very low distortion is used, for example, a telecentric lens.
When using a mobile phone or smartphone to take the photos, the camera calibration will not work properly in most cases! This is because the smartphones apply their own distortion correction and other algorithms to the generated image. Thus the image will be significantly improved. A further camera calibration on an already changed image does not lead to the desired result.
Instructions for camera calibration in ContourTrace¶
Download and print the Chessboard Pattern on DIN A4 paper or cardboard. Make sure that no scaling is applied to the image during printing.
Fix or glue the chessboard pattern on a solid and flat surface, e.g. on a plastic or wooden board. Make sure that the chessboard pattern has no unevenness, waves or kinks.
Adjust your camera and lens settings so that you can fully and optimally capture the objects to be imaged and the chessboard pattern. The settings cannot be changed during or after calibration. The settings should be saved e.g. in the name of the calibration file. This allows the settings in the camera and lens to be restored manually later when the calibration file is called up.
If available, use a camera tripod. The camera can be mounted in the tripod e.g. overhead.
Create at least 10 different photos of the chessboard pattern. You can move, rotate, tilt the chessboard pattern or change the distance to the lens. The generated images of the chessboard pattern should cover the entire field of view of the camera. However, make sure that the chessboard pattern is always fully visible.
Open ContourTrace and click on Camera Calibration. Add the created images to the list of Calibration Pictures. Click on Create calibration file … to start the calibration and save the calibration file. Wait until the calibration is finished. Once the calibration file has been successfully created, close the Camera Calibration window.
To use the calibration file in ContourTrace, click on the tab Camera and add the created calibration file under Calibartion File.
As long as a calibration file is used in ContourTrace, only the images generated with the camera and the camera settings for this calibration file may be processed. Otherwise the distortion correction of the images is not correct!