# How to Choose a Variable Magnification Lens

This is **Section 7.5** of the Imaging Resource Guide

In order to choose an imaging lens, the fundamental system parameters of the imaging system must be known (see 6 Fundamental Parameters of an Imaging System for more details). At a minimum, the working distance, field of view, and resolution are required constraints before the proper selection of a lens can occur.

For this discussion, fixed focal length lenses, zoom lenses, and macro lenses can be assumed to operate on the same principles and can be chosen in the same fashion. This assumes that zoom lenses are being specified at individual focal lengths and that their zoom functionality has been locked down.

All variable magnification lenses come to focus based upon Equation 1.

**(1)**$$ \frac{1}{z'} = \frac{1}{z} + \frac{1}{f} $$

where z’ is the image distance (which can be thought of as the distance between the image plane and the last element), z is the object distance (or the distance between the object being focused on and the front lens element), and f is the focal length of the lens. This is an approximate equation that assumes that the lens has no thickness; it is included here to show the relationship between image and object distances. For a given focal length, as the object distance (working distance) increases, the image distance will decrease.

For a single lens element, such as a plano-convex or bi-convex lens, this equation is useful in determining which focal length is proper given an object and image distance. However, in a machine vision system that utilizes objectives with many elements (such as those in Figure 1), the equation falls short in several ways: it does not describe the field of view, and since measuring the image distance in a machine vision lens is impractical, solving for focal length becomes impossible.

Using the equation for magnification, Equation 2,

**(2)**$$ m = \frac{z'}{z} = \frac{h'}{h} $$

where h’ and h are the size of the image plane (most often a sensor size) and field of view, respectively, Equation 1 can be rearranged into a more useful form, shown in Equation 3.

**(3)**$$ h = h' \left( \frac{z}{f} - 1 \right) $$

Equation 3 provides a quick and easy way to solve for which focal length lens is required to solve an application, given fundamental parameters such as field of view and sensor size.

Figures 1 and 2 show Equation 3 plotted for several lenses with different focal lengths on different sensors (corresponding to separate y-axes).

**Figure 1: **Lenses of different focal lengths and their fields of view on 1/3” and 1/1.8” sensors.

**Figure 2: **Lenses of different focal lengths and their fields of view on 2/3” and 1” sensors.

These plots are useful in determining the proper focal length for a machine vision lens if a camera has already been chosen: simply follow along the x-axis to the required working distance and using the corresponding y-axis (depending on the sensor that is being used), find where the points meet on the coordinate plane. The closest lens to the intersecting points describes the best *starting point* of investigation for which lens to use and considerably narrows the large field of lenses from which to choose.

Additionally, these plots also illustrate several important points about fixed focal length lenses in machine vision. First, longer focal length lenses have longer minimum working distances, which is a consequence of their optical designs. Minimum working distance can be shortened by adding spacers between the lens and camera, but image quality will eventually suffer (see Lens Spacers, Shims and Focal Length Extenders for more information). Second, larger sensors provide a larger field of view with the same focal length lens. For example, at a working distance of 350mm, a 12mm lens on a 2/3” sensor will have a field of view of about 370mm, but on a 1” sensor at the same working distance, the field of view is approximately 530mm - an increase of 43%. Lastly, there are gaps in the plots, indicative that a standard off-the-shelf fixed focal length lens does not exist. For example, it is impossible to achieve a 525mm field of view at a 600mm working distance with a 2/3” sensor with available focal lengths. The closest lens that exists is an 8.5mm focal length, which would need to be used at a working distance of about 510mm to achieve that field of view.

These plots should only be used as the first step in narrowing down which lens is the best for an application. They do not answer questions about image quality, distortion, relative illumination, or any other important qualities of an imaging lens; they merely address field of view relative to sensor size. See Lens Selection Based on Resolution for more details on selecting lenses based on resolution.