Keep vision systems on target
Basic tools and techniques make machine-vision systems accurate.
Jon Titus, Editorial Director -- Test & Measurement World, 4/15/2001 2:00:00 AM
You probably know instruments need calibration every year or so, but you may not know vision systems on a production line can undergo a type of calibration at every shift change. Thankfully, you won’t have to send a vision system back to the cal lab. Instead, you can set it up and test it right where you’ll use it.
Machine-vision users employ the term calibration loosely to encompass overall setup and testing to ensure a system can make accurate measurements. I’ll apply that usage as I describe dimensioning, perspective, optical distortion, depth of view, and contrast. Complex vision systems may require you to also conduct regular tests of motors, sensors, and cameras to calibrate position and measurement accuracy, but these specific topics are beyond the scope of this article.
Before you can calibrate a machine-vision system, you must set it up exactly as it will exist in day-to-day use. It makes no sense to calibrate a vision system in a lab and then move it into a different setting. The movement will affect the settings and lead to false and inaccurate readings.
|
| Figure 1. A calibration target printed on glass provides a NIST-traceable standard you can use to calibrate dimensions for a machine-vision system.Courtesy of Edmund Industrial Optics. |
First things first
The first calibration step involves relating actual lengths to the numbers of pixels between points in a captured image. People measure distance in inches, millimeters, microns, and other units. But vision systems “see” things only in terms of pixels.
You can run a simple calibration by placing an accurate steel ruler with crisp, contrasting marks in the center of your vision system’s field of view. The ruler should rest flat on the surface and perpendicular to your camera’s center axis. Try to place the ruler parallel to the x or y axis of your camera’s pixels. Watch the image display to see how you’re doing as you position the ruler. Careful positioning will let you measure a distance along a row or column of pixels rather than diagonally across rows and columns.
After your system acquires an image of the ruler, you can use the system’s software to locate the center of the ruler’s marks at say, 1 in. and 4 in. Then, the software can count the pixels between the centers and equate it to 3 in. You don’t have to count pixels on the display. Machine-vision software should include calibration tools, or wizards, that take care of the conversion calculations after the vision system acquires an image of a standard.
Although cameras in today’s machine-vision systems provide square pixels, don’t automatically assume the length-to-pixel ratio that the software calculates for one axis holds true for the other axis. You may have an older camera that includes a sensor with different length-to-pixel ratios for each axis. Always calibrate lengths along both x and y axes.
a)
|
b)
|
| Figure 2.a) An image of coins shows the effect of distortion. b) Software can use dimension and position information saved during calibration to correct the image and properly represent viewed objects.Courtesy of National Instruments. |
|
| Figure 3. The image of a calibration target shows obvious perspective errors, and here you can see the effect of barrel distortion that slightly bows the lines of dots.Courtesy of National Instruments. |
|
| Figure 4. Depending on the lens you choose and how you set it up, you can get more or less depth of field. You need a deeper depth of field to focus components that vary significantly in height. |
Use an accurate target
Although a ruler will get your system roughly on target, you’ll obtain more accurate measurements when you use a commercial target such as the glass grid-distortion target shown in Figure 1.
This target from Edmund Industrial Optics (Barrington, NJ) provides patterns of dots you can use in several ways to calibrate your system, and it comes with a NIST certificate of accuracy. The dot diameters and the dot center-to-center spacing provide values your software can use to establish distance-to-pixel values. Additionally, you use the center coordinates of the dots to have the software correct for perspective errors or distortion caused by the lens and camera.
Perspective errors occur when a mechanical mount positions a camera at an angle slightly off the axis perpendicular to a target. As a result, the camera obtains images at an angle, and distant objects seem slightly smaller and closer together. Although the effect is usually minor, it can affect a system’s capability to make accurate gauging measurements. If you simply need to ensure the presence or absence of an object or component, however, small perspective errors shouldn’t cause a problem.
If perspective errors cause problems, in many cases, machine-vision software can correct for them. Figure 2a shows the effect of perspective. Software using a standard target image to determine perspective error can correct the image ( Figure 2b).
If your software cannot correct for perspective errors, try to adjust the camera to reduce them as much as possible. Lenses also may cause perspective errors, so ask the manufacturers to suggest alternate lens configurations or models. Be aware that a slight perspective error can appear even in what looks like a perfectly aligned system. The camera itself may cause this error because the image sensor may not perfectly align with the lens’ focal plane.
Distortion could also reveal itself in effects such as barrel distortion and pincushion distortion. For example, imagine you have captured the image of a square test pattern. Barrel distortion causes the sides of the square to push out slightly, and pincushion distortion pushes the sides in slightly.
Figure 3 shows perspective errors where you can see a slight bowing of the lines of dots caused by barrel distortion. Barrel or pincushion distortion may be so slight you don’t see it in an image unless you look very closely. Using a standard test image with your software will help overcome such errors.
Although software can overcome distortion, you may be better off buying a different lens that’s less susceptible to distortion. Reconsider camera position, too. Often, people place a camera too close to an object, which results in distorted images. If you can, increase the distance between the camera and the object you need to examine, and use a lens better suited to such a distance. The increased distance “flattens” the image and makes it less prone to the effects of distortion.
Measure depth of field
You need to measure your optical system’s depth of field, also called depth of view, to ensure it meets your inspection needs. After you focus a lens, it has a specific depth of field—a narrow range over which it offers proper focus without further adjustment. Within that range, a viewer—automated or human—can properly see or measure features. Therefore, inspection of a flat PCB with surface-mount components needs only a narrow depth of field because everything exists within a few millimeters of the PCB’s surface (Figure 4).
But when an application includes a wider range of heights or depths—for example a PCB with higher components—adjust the camera lens to provide a greater depth of field, or use a lens that offers a larger depth of field. As a general rule, always recalibrate the system when you change lenses or lens settings, or when you change any characteristic of your vision system.
A commercial target (Figure 5) will help you determine whether your optics provide the needed depth of field you need. The target supplies a long, graduated scale oriented at 45° to the camera so you can read the focus range. A series of closely spaced line pairs comes into clear focus in the depth of view and then gets blurry outside it. Your machine-vision software can plot gray-scale data for the line pairs to help you determine the actual depth of field. When the software can no longer separate line pairs—they’re out of focus and blur together—you’ve reached the limit of depth of field.
Because normal lenses can cause distortion, consider using a telecentric lens if you plan to make accurate gauging measurements. This special type of lens has no parallax, so the size of an object does not vary with distance from the lens (Figure 6). But because telecentric lenses use only parallel light rays, they cannot view an area larger than the lens aperture.
|
| Figure 5. A commercial depth-of-field target provides a graduated scale and a column of line pairs at 45° to the camera’s center axis. The range over which software can distinguish discrete line pairs defines the depth of field. Courtesy of Edmund Industrial Optics. |
|
| Figure 6. A telecentric lens will present objects at their proper size, unaffected by their distance from the lens. The lens accepts only parallel light rays, so its field is only as large as the lens aperture. |
Most vision systems must locate edges of an object for metrology, to determine position, to match a shape, or to count objects. Without proper contrast between the background and the object, the software cannot accurately locate these edges. Most of the time, you can alter contrast by changing lighting or using a filter on the camera’s lens.
In some cases, though, you may need to monitor the “grayness” of an object to determine that the proper object is where it belongs. Usually, you can use samples of your product to establish the grayness of each object. You don’t need to calibrate your system for specific gray levels. If you find an application that does require such calibration, rest assured, you can purchase gray-scale standards that specify the amount of light they transmit or reflect. These targets come with linear and logarithmic gray-level steps. T&MW
Jon Titus has written real-time software and designed embedded systems and computer/instrument interfaces. He worked in electronics for 10 years and spent nine years at EDN magazine prior to joining T&MW in 1993. He has a BS from WPI, an MS from RPI, and a PhD from VPI.
|
What’s your resolution? Before you set up a vision system, you need to know how much dimensional resolution your measurements require. Resolution describes the smallest feature dimension a vision system must detect or measure. After you determine the resolution you need, set up the system’s camera and lens to provide about 10 pixels across that distance. (Some people say you can get away with two or three pixels, but you’re safer with 10 or so.) To accurately resolve a 1-mm dimension, for example, the camera should provide about 10 pixels across 1 mm. Don’t try to get exactly 10 pixels across a 1-mm distance. Just get close. A simple ruler provides a good test object when you adjust your optics. Keep in mind that cameras provide a specific number of pixels for each axis. If a camera provides a 640x480-pixel image and you need 1-mm resolution, the camera can cover an area of 64x48 mm, or about 2.5x1.9 in. An expensive “megapixel” camera with 1024x1024 pixels can provide 1-mm resolution over a 4x4-in. PCB. If you need 1-mm resolution over a larger area, you’ll have to move the PCB under one camera and capture multiple images, or use several cameras so each images a section of the PCB.—Jon Titus Suppliers of machine-vision calibration targets Edmund Industrial Optics Barrington, NJ 856-573-6250 www.edmundoptics.com Melles Griot Irvine, CA 949-261-5600 www.mellesgriot.com |
Vision meets motion
02/01/2005Specifying a vision system
03/31/2007Sell machine vision to your boss
12/31/2002Make sense of lens specs
09/01/2005Know Your Machine Vision Components
02/28/1999
-
FLIR offers IR camera for under $3000
-
Don't let the economy compromise quality (Guest commentary)
-
Danaher speeds up restructuring, acquires life-sciences businesses
-
Agilent’s Cover-Extend technology eliminates need for physical test points for in-circuit test
-
So many combinations: Testing a switch-matrix board



























