Calibration of 2D Cameras for 3D Inspection
- Created: Wednesday, 01 May 2013
In many applications, 2D cameras are used to produce 3D imaging for general purpose inspections. There are numerous 3D inspection applications. Some of them include reverse engineering, electronics inspection, food inspection, auto parts inspection, and recreational simulation.
There are several ways to use 2D cameras for 3D inspections:
• Laser triangulation using a 2D camera
with a laser and dedicated hardware;
• Stereoscopy using two 2D cameras;
• Interferometer using a 2D camera and several optical devices;
• Scanners using a 2D camera;
• 3D dedicated software using a grey level image to obtain 3D measurements.
In this article we will concentrate on one of the most used techniques — laser triangulation.
Laser triangulation often uses a laser line or laser pattern and a 2D camera mounted at an angle to produce a 3D vertical measurement obtained from a flat 2D image. How is this possible?
In Figure 1, the basic principle of optical triangulation is illustrated by a 2D image of a laser line being captured by a camera mounted at an angle. This technique gives a 3D representation of an object on a 2D image. Figure 2 shows how the camera visualizes the laser line with its two dimensional perspective.
What is 3D Calibration?
What is 3D calibration and how do we obtain real 3D measurements from a 2D image?
First we have to mention that a good calibration will not only produce accurate 3D measurements but also correct or compensate for many optical problems. Let’s take a quick look at some of them.
The main optical problems in laser triangulation systems are lens issues, camera rotation and baseline correction.
• Vignetting: The lens must be large
enough to not vignette the image, that
is, it should not block the edges of the
image. Even if it is large enough, you
may get some intensity decrease (also
called vignette) at the edges of the
image. The laser line also decreases
towards the end, so we need to test the
combination of lens and laser to make
sure the intensity of the image is
enough after vignetting and laser line
• Optical distortion: All lenses have some optical distortion which can sometimes be seen as making a straight line into a curved line in the image. Optical distortion generally increases with shorter focal lengths. For example, with a lens focal length of 8 mm, grid lines (horizontal and vertical) appear to curve outward in the center of the camera’s image and be closer to the edges of the image, looking something like an old-fashioned wooden barrel’s staves and bindings — so this is called “barrel distortion.” C-mount lenses with focal lengths less than 25 mm generally have enough barrel distortion to cause depth measurement problems.
• Camera rotation: Even with good mechanical design, the camera’s sensor will usually be slightly rotated from the laser line. For example, a horizontal laser line will appear to be tilted by a fraction of a degree in the image. This rotation comes from not being able to exactly align the laser and camera and not being able to exactly align the sensor within the camera body. The usual way to deal with rotation is to take an image of the “baseline” (the conveyer belt or whatever the 3D objects will rest on), compute the rotation of that line, and factor it out in the height measurements. So camera rotation correction is part of most 3D calibrations.
• Baseline correction: Let’s say we have a conveyer belt with a 3D object on it. All 3D calibrations must take a measure of the baseline and subtract it (after accounting for laser to camera rotation) from the height measures. Some baselines, such as conveyer belts, will tend to vibrate slightly and this can change the apparent height. The cure for this problem is to always measure the baseline, so you should have your laser line view be wider than the 3D object, and then subtract the baseline height changes to remove the vibrations.
If we knew the exact distances and angles between the laser and the “baseline” (whatever the 3D object is resting on) and the laser and the camera’s focal point, then calibration could be done by trigonometry. However, the camera’s focal point is difficult to measure — it can be internal to the lens or behind the lens and, in addition, there are many other factors that confound calibration. Therefore, it is usually easier (and better) to calibrate using some calibrated standard heights rather than trying to measure the imaging geometry and compute out confounding factors.