Before you acquire images, you must set up your imaging system. Five fundamental parameters comprise an imaging system: resolution, field of view, working distance, sensor size, and depth of field. Figure 1 illustrates these concepts.
Figure 1. Fundamental Parameters of an Imaging System
- Resolution: the smallest feature size on your object that the imaging system can distinguish
- Field of view: the area of inspection that the camera can acquire
- Working distance: the distance from the front of the camera lens to the object under inspection
- Sensor size: the size of a sensor's active area
- Depth of field: the maximum object depth that remains in focus
The manner in which you set up your system depends on the type of analysis, processing, and inspection you need to do. Your imaging system should produce images with high enough quality to extract the information you need from the images. Five factors contribute to overall image quality: resolution, contrast, depth of field, perspective, and distortion.
Resolution indicates the amount of object detail that the imaging system can reproduce. You can determine the required resolution of your imaging system by measuring in real-world units the size of the smallest feature you need to detect in the image.
Figure 2 depicts a barcode. To read a barcode, you need to detect the narrowest bar in the image. The resolution of your imaging system in this case is equal to the width of the narrowest bar (w).
Figure 2. Determining the Resolution of Your Imaging System
To make accurate measurements, a minimum of two pixels should represent the smallest feature you want to detect in the digitized image. In Figure 2, the narrowest vertical bar (w) should be at least two pixels wide in the image. With this information you can use the following guidelines to select the appropriate camera and lens for your application.
1. Determine the sensor resolution of your camera.
Sensor resolution is the number of columns and rows of CCD pixels in the camera sensor. To compute the sensor resolution, you need to know the field of view (FOV). The FOV is the area under inspection that the camera can acquire. The horizontal and vertical dimensions of the inspection area determine the FOV. Make sure the FOV encloses the object you want to inspect.
Once you know the FOV, you can use the following equation to determine your required sensor resolution:
sensor resolution = (FOV/resolution) x 2
= (FOV/size of smallest feature) x 2
Use the same units for FOV and size of smallest feature. Choose the FOV value (horizontal or vertical) that corresponds to the orientation of the smallest feature. For example, you would use the horizontal FOV value to calculate the sensor resolution for Figure 2.
Cameras are manufactured with a limited number of standard sensor resolutions. The table below shows some typical camera sensors available and their approximate costs.
|Number of CCD Pixel
|640 x 480
|768 x 572
|1280 x 1024
|2048 x 2048
|3072 x 2048
If your required sensor resolution does not correspond to a standard sensor resolution, choose a camera whose sensor resolution is larger than you require or use multiple cameras. Be aware of camera prices as sensor sizes increase.
By determining the sensor resolution you need, you narrow down the number of camera options that meet your application needs. Another important factor that affects you camera choice is the physical size of the sensor, known as the sensor size. Figure 3 shows the sensor size dimensions for standard 1/3 Inch, 1/2 Inch, and 2/3 Inch sensors. Notice that the names of the sensors do not reflect the actual sensor dimensions.
Figure 3. Common Sensor Sizes and Their Actual Dimensions
In most cases, the sensor size is fixed for a given sensor resolution. If you find cameras with the same resolution but different sensor sizes, you can determine the sensor size you need based on the next guideline.
2. Determine the focal length of your lens.
A lens is primarily defined by its focal length. Figure 4 illustrates the relationship between the focal length of the lens, field of view, sensor size, and working distance.
Figure 4. Relationship Between Focal Length, FOV, Sensor Size, and Working Distance
The working distance is the distance from the front of the lens to the object under inspection.
If you know the FOV, sensor size, and working distance, you can compute the focal length of the lens you need using the following formula:
focal length = sensor size x working distance / FOV
Lenses are manufactured with a limited number of standard focal lengths. Common lens focal lengths include 6 mm, 8 mm, 12.5 mm, 25 mm, and 50 mm. Once you choose a lens whose focal length is closest to the focal length required by your imaging system, you need to adjust the working distance to get object under inspection in focus.
Lenses with short focal lengths (less than 12 mm) produce images with a significant amount of distortion. If your application is sensitive to image distortion, try to increase the working distance and use a lens with a higher focal length. If you cannot change the working distance, you are somewhat limited in choosing your lens.
Note: As you are setting up your system, you need to fine tune the various parameters of the focal length equation until you achieve the right combination of components that match your inspection needs and meet your cost requirements.
Resolution and contrast are closely related factors contributing to image quality. Contrast defines the differences in intensity values between the object under inspection and the background. Your imaging system should have enough contrast to distinguish objects from the background. Proper lighting techniques can enhance the contrast of your system.
Depth of Field
The depth of field of a lens is its ability to keep in focus objects of varying heights or objects located at various distances from the camera. If you need to inspect objects with various heights, choose a lens that can maintain the image quality you need as the objects move closer to and further from the lens. You can increase the depth of field by closing the iris of the lens and providing more powerful lighting.
Telecentric lenses work with a wide depth of field. With a telecentric lens, you can image objects of different distances from the lens and the objects stay in focus.
Visit one of National Instruments' lens partners for more information about lenses.
Perspective errors occur when the camera axis is not perpendicular to the object under inspection. Figure 5a shows an ideal camera position. Figure 5b shows a camera imaging an object from an angle.
Figure 5. Camera Angle Relative to the Object Under Inspection
Figure 6a shows a grid of dots. Figure 6b illustrates perspective errors caused by a camera imaging the grid from an angle.
Figure 6. Perspective and Distortion Errors
Try to position your camera perpendicular to the object under inspection to reduce perspective errors. Integration constraints may prevent you from mounting the camera perpendicular to the scene. Under these constraints, you can still take precise measurements by correcting the perspective errors with spatial calibration techniques.
Nonlinear distortion is a geometric aberration caused by optical errors in the camera lens. A typical camera lens introduces radial distortion. This causes points that are away from the lens's optical center to appear further away from the center than they really are. Figure 4c illustrates the effect of distortion on a grid of dots. When distortion occurs, information in the image is misplaced relative to the center of the field of view, but the information is not necessarily lost. Therefore, you can undistort your image through spatial calibration.