Relate Object Dimensions to Lens Focal Lengths
Two equations help you select the lens with the right focal length.
Gene Hill, Cohu, Electronics Div., San Diego, CA -- Test & Measurement World, 12/1/2000
When you’re building a machine-vision system, you must ensure that the lens you choose will properly capture an image that includes everything you want to inspect. Two simple formulas let you quickly relate the size of the camera’s internal image sensor, the dimensions of the object you want to inspect, the distance to the object, and the focal length of the lens you need. You can algebraically rearrange these equations to suit your needs:
Eq. 1
Eq. 2
f
=
focal length of the lens (mm)
H = horizontal dimension of the object
V = vertical dimension of the object
L = distance between the lens and object
X = image sensor width (mm), Table 1
Y = image sensor height (mm), Table 1
The illustration in Figure 1 shows how the H, V, and L dimensions relate to the camera and the object you want to inspect. You obtain the X and Y values for an image sensor from Table 1. Check your camera’s specifications for the size of the sensor it provides. You can use any convenient length units for H, V, and L, as long as all three use the same units: feet, meters, centimeters, or so on.
Here’s an example of show to use the equations. Suppose you’re using a camera with a 1/2-in. sensor. The desired horizontal field of view (H) is 25 in., and the distance from the camera (L) is 100 in. Because you have the H and L values, use Eq. 1. Insert the X value for a 1/2-in. sensor, and rearrange to solve for f:
![]()
| Table 1. Dimensions of Image Sensor Used in Cameras | |||
| Sensor Size (inches) |
Width, X (mm) | Height, Y (mm) | Diagonal (mm) |
| 1 | 12.8 | 9.6 | 16 |
| 2/3 | 8.8 | 6.6 | 11 |
| 1/2 | 6.4 | 4.8 | 8 |
| 1/3 | 4.8 | 3.6 | 6 |
| 1/4 | 3.6 | 2.7 | 4.5 |
To obtain the necessary horizontal field-of-view for this object, you’ll have to buy a lens that fits the camera and that has a 25.6-mm focal length. Such a lens does not exist, but you can choose a 25-mm, focal-length lens that will work well. If you get a focal length that falls between standard values offered by lens suppliers, use the next lower standard value. So if the equation specifies a lens with a 40-mm focal length, and a manufacturer offers 25-mm, 35-mm, 50-mm, and 75-mm lenses, choose the 35-mm focal-length lens for your application. If the equation produces a value just under the focal length for a standard lens, you could test the lens with the closest focal length and adjust the position of the camera slightly to try to get the entire object in the image area. Thus, for a calculated focal length of 48 mm, you could first use a 50-mm focal-length lens. If that lens doesn’t work, you’ll have to move to the 35-mm focal-length lens. Be sure to check the lens datasheet to ensure the lens offers the minimum focusing distance you require.
When both horizontal and vertical field-of-view dimensions are critical, say for a 4x6-in. PCB, align the long dimension with the camera’s horizontal, or long, axis. Then, use both equations to calculate the lens focal length. For this PCB, assuming a 30-in. separation between the lens and the PCB, you’ll get focal lengths of 32 mm and 36 mm. To view the entire PCB, you must choose a lens with a focal length equal to or less than the smaller value. Remember, you can also use the equations to calculate the proper distance between the camera and the object for a given lens and field-of-view requirement. T&MW
Gene Hill is a sales engineer in Nevada and Arizona. He works on imaging applications ranging from inspecting small parts to monitoring processes. E-mail c/o tmw@cahners.com.


















