Understanding Lens Specifications
Resolution is a measurement of an imaging system’s ability to reproduce object detail, and can be influenced by factors such as the type of lighting used, the pixel size of the sensor, or the capabilities of the optics. The smaller the object detail, the higher the required resolution.
Dividing the number of horizontal or vertical pixels on a sensor into the size of the object one wishes to observe will indicate how much space each pixel covers on the object and can be used to estimate resolution. However, this does not truly determine if the information on the pixel is distinguishable from the information on any other pixel.
As a starting point, it is important to understand what can actually limit system resolution. An example can be shown in Figure 1: a pair of squares on a white background. If the squares are imaged onto neighboring pixels on the camera sensor, then they will appear to be one larger rectangle in the image (a) rather than two separate squares (b). In order to distinguish the squares, a certain amount of space is needed between them, at least one pixel. This minimum distance is the limiting resolution of the system. The absolute limitation is defined by the size of the pixels on the sensor as well as the number of pixels on the sensor.
The Line Pair and Sensor Limitations
The relationship between alternating black and white squares is often described as a line pair. Typically, the resolution is defined by the frequency measured in line pairs per millimeter (lp/mm). A lens’s resolution is unfortunately not an absolute number. At a given resolution, the ability to see the two squares as separate entities will be dependent on grey scale level. The bigger the separation in the grey scale between the squares and space between them (Figure 1b), the more robust is the ability to resolve the squares. This grey scale separation is known as contrast (at a specified frequency). The spatial frequency is given in lp/mm. For this reason, calculating resolution in terms of lp/mm is extremely useful when comparing lenses and for determining the best choice for given sensors and applications. See also details on Contrast later described in the whitepaper.
The sensor is where the system resolution calculation begins. By starting with the sensor, it is easier to determine what lens performance is required to match the sensor or other application requirements. The highest frequency which can be resolved by a sensor, the Nyquist frequency, is effectively two pixels or one line pair.
Figure 1: Resolving two squares. If the space between the squares is too small (a) the camera sensor will be unable to resolve them as separate objects.
Table 1 shows the Nyquist limit associated with pixel sizes found on some highly used sensors. The resolution of the sensor, also referred to as the image space resolution for the system, can be calculated by multiplying the pixel size in µm by 2 (to create a pair), and dividing that into 1,000 to convert to mm:
Sensors with larger pixels will have lower limiting resolutions. Sensors with smaller pixels will have higher limiting resolutions. How this information is used to determine necessary lens performance can be found in the part about resolution. With this information, the limiting resolution on the object to be viewed can be calculated. In order to do so, the relationships between the sensor size, the field of view, and the number of pixels on the sensor need to be understood.
Sensor size refers to the size of a camera sensor’s active area, typically specified by the sensor format size. However, the exact sensor proportions will vary depending on the aspect ratio, and the nominal sensor formats should be used only as a guideline, especially for telecentric lenses and high magnification objectives. The sensor size can be directly calculated from the pixel size and the number of active pixels on the sensor.
Table 1: As pixel sizes get smaller the associated Nyquist limit in lp/mm rises proportionally.
In order to determine the absolute minimum resolvable spot that can be seen on the object, the ratio of the field of view to the sensor size needs to be calculated. This is also known as the Primary Magnification (PMAG) of the system.
The ratio associated with system PMAG allows for the scaling of the imaging space resolution which tells us the resolution of the object.
Generally when developing an application, a system’s resolution requirement is not given in lp/mm, but rather in microns (µm) or fractions of an inch.
There are two ways to make this conversion:
While one can quickly jump to the limiting resolution on the object by using the last formula, it is very helpful to determine the imaging space resolution and PMAG to simplify lens selection. It is also important to keep in mind that there are many additional factors involved, and this limitation is often much lower than what can be easily calculated using the equations.
Contrast describes how well black can be distinguished from white at a given resolution on an object. For an image to appear well defined, the black details need to appear black and the white details must appear white (See Figure 2). The more the black and white information trend into the intermediate greys, the lower the contrast at that frequency. The greater the difference in intensity between a light and dark line, the better the contrast. While this may appear obvious, it is critically important.
The contrast at a given frequency can be calculated in the shown Equation, where Imax is the maximum intensity (usually in pixel greyscale values, if a camera is being used) and Imin is the minimum intensity:
The lens, sensor, and illumination all play key roles in determining the resulting image contrast. Each one can detract from the overall contrast of a system at a given resolution if not applied correctly and in concert with one another.
Figure 2: Transition from black to white is high contrast while intermediate greys indicate lower contrast.
Lenses and Contrast Limitations
Lens contrast is typically defined in terms of the percentage of the object contrast that is reproduced when assuming ideal illumination. Resolution is actually somewhat meaningless unless defined at a specific contrast. In the section about resolution, the example assumed perfect reproduction on the object, including sharp transitions at the edge of the object on the pixel. However, in reality this is never the case. Because of the nature of light, even a perfectly designed and manufactured lens cannot fully reproduce an object’s resolution and contrast. Even when the lens is operating at the diffraction limit, the edges of the dots in Figure 3 will be blurred in the image. This is where calculating a system’s resolution by simply counting pixels loses accuracy, and can even become completely ineffective.
Consider two dots close to each other being imaged through a lens, as in Figure 3. When the spots are far apart (in other words, at a low frequency), the dots are distinct, though both somewhat blurry at the edges. As they approach each other, the blurs overlap until the dots can no longer be distinguished as separate entities. The system’s actual resolving power depends on the imaging system’s ability to detect the space between the dots. Even if there are ample pixels between the spots, if the spots blend together due to lack of contrast, they will not easily be resolved as two separate details. Therefore, the resolution of the system depends on many things, including blur caused by diffraction and other optical errors, the dot spacing, and the sensors ability to detect contrast.
Figure 3: Two spots being imaged by the same lens. The top lens is imaging objects at a low frequency, the bottom lens is imaging objects at a higher frequency.
f/# (Lens Iris/Apperture Setting)
The f/# setting on a lens controls many of the lens’s parameters: overall light throughput, depth of field, and the ability to produce contrast at a given resolution. Fundamentally, f/# is the ratio of the effective focal length (EFL) of the lens to the effective aperture diameter (DEP):
In most lenses, the f/# is set by the turning the iris adjusting ring, thereby opening and closing the iris diaphragm inside. The numbers labeling the ring denote light throughput with its associated aperture diameter. The numbers usually increase by multiples of √2. Increasing the f/# by a factor of √2 will halve the area of the aperture, effectively decreasing the light throughput of the lens by a factor of 2. Lenses with lower f/#s are considered fast and allow more light to pass through the system, while lenses of higher f/#s are considered slow and feature reduced light throughput.
Table 2 shows an example of f/#, aperture diameters, and effective opening size for a 25mm focal length lens. Notice that from the setting of f/1 to f/2, and again for f/4 to f/8, the lens aperture is reduced by half and the effective area is reduced by a factor of 4 at each interval. This illustrates the reduction in throughput associated with increasing a lens’s f/#.
Table 2: The relationship between f/# and effective area for a 25mm singlet lens. As the f/# increases, the area decreases, leading to a slower system with less light throughput.
f/# and Effects on a Lens’s Theoretical Resolution, Contrast, and DOF:
The f/# impacts more than just light throughput. Specifically, f/# is directly related to the theoretical resolution and contrast limits and the Depth of Field (DOF) and depth of focus of the lens. Additionally, it will influence the aberrations of a specific lens design.
As pixels continue to decrease in size, f/# becomes one of the most important limiting factors of a system’s performance because its effects on DOF and resolution move in opposite directions. As shown in Table 3, the requirements are often in direct conflict and compromises must be made.
Table 3: Lens performance changes as the f/# varies.
f/# Changes with Working Distance Change: – ADVANCED
The definition of f/# in the shown equation is limited in the sense that it is defined at an infinite working distance where the magnification is effectively zero. Most often in machine vision applications, the object is located much closer to the lens than an infinite distance away, and f/# is more accurately represented by the working f/#, as noted below:
In the equation for working f/#, m represents the paraxial magnification (ratio of image to object height) of the objective. Note that as m approaches zero (as the object approaches infinity), the working f/# is equal to the infinite f/#. It is especially important to keep working f/# in mind at smaller working distances. For example, an f/2.8, 25mm focal length lens operating with a magnification of -0.5X will have an effective working f/# of f/4.2. This impacts image quality as well as the lens’s ability to collect light.
f/# and Numerical Aperture (NA) – ADVANCED
It can often be easier to talk about overall light throughput in a lens in terms of the cone angle, or the numerical aperture (NA), of a lens. The numerical aperture of a lens is defined as the sine of the marginal ray angle in image space, and is shown in Figure 4.
Figure 4: Visual representation of f/#, both for a simple lens (a) and a real-world system (b).
It is important to remember that f/# and NA are inversely related.
Table 4 shows both a typical f/# layout on a lens (each successive figure increasing by a factor of √2) along with its relationship with numerical aperture.
Table 4: Relationship between f/# and numerical aperture.
Notation in terms of numerical aperture as opposed to f/# is especially common in microscopy, but it is important to keep in mind that the NA values that are specified for microscope objectives are specified in object space, since light collection is often more easily thought of there. The other interesting parallel is that infinite conjugate microscope objectives can be thought of as machine vision objectives (focused at infinity) in reverse.