Browse KB Articles
Selecting a Lens for your Camera
KB Number: 10694
Technical Application Note (TAN2010002): Selecting a Lens for your Camera
Application Note Description
This application note explains the following important factors to consider when selecting a lens for your imaging camera:
Camera Lens Mount
You must select a lens that is compatible with the lens mount of the camera. Most FLIR machine vision cameras are equipped with either a C- or CS-mount. We also provide 5 mm C-to-CS mount spacers, M12 lens mounts and CS-to-M12 adapters.
Flange Back Distance on C- and CS-mount Cameras
C- and CS-mount lenses are both threaded lens mounts found on most industrial CCD cameras and lenses. The difference between C and CS-mount equipment is the distance between the flange of the lens (the part of the case that butts up against the camera) and the focal plane of the lens (where the CCD sensor must be positioned). This is known as the flange back distance.
Diagram of typical C- or CS-mount lens
The C-mount lens specification for flange back distance is 17.53 mm, and on CS-mount lenses it is 12.53 mm. However, on Point Grey cameras, these physical distances are offset due to the presence of both a 1 mm infrared cutoff (IRC) filter and a 0.5 mm sensor package window. These two pieces of glass fit between the lens and the sensor image plane. The IRC filter is installed by Point Grey on color cameras; in monochrome cameras, the IRC is replaced with a transparent glass window. The sensor package window is installed by the sensor manufacturer. The refraction of these glass components requires an offset in the flange back distance from the nominal values.
If you have a CS-mount camera and a C-mount lens, you can add a 5mm spacer to obtain the correct focus. If, however, you have a C-mount camera and a CS-mount lens, correct focus cannot be achieved.
Compatibility with M12 Microlenses
M12 (sometimes referred to as S-mount) optics are often a popular alternative to C- or CS-mount optics due to their smaller size and lower cost. Point Grey offers a variety of M12-based products, including lens mounts (plastic or metal), lenses, a CS-to-M12 adapter, and some cameras with M12 lens mount pre-installed.
Point Grey's cast metal M12 lens holder is made of zinc alloy and is designed to fit larger format sensors such as the Sony ICX445 CCD and the Sony IMX035 CMOS. Additional features include a set screw for adjusting back focal distance, dowel pins for precise alignment of the lens holder to the camera circuit board, and an IRC filter.
Point Grey also has available a CS-to-M12 lens adapter, which is useful for attaching M12 lenses to a camera equipped with a CS-mount lens holder.
There may be some compatibility issues with
Lens Focal Length
Another important consideration when selecting a lens is its focal length. A lens with a focal length approximately equal to the diagonal size of the sensor format reproduces a perspective that generally appears normal to the human eye. Lenses with shorter than normal focal lengths, also called ‘
The focal point is the position on the optical axis where all incoming rays that are parallel to the optical axis intersect. Focus is achieved when all rays originating from the same point on the scene refract so that they intersect at exactly the same point on the image plane. This concept is illustrated in the diagram below. Note that with a symmetric lens, focal points F and F’ are equidistant from the lens. A ray that passes through F refracts so that it is parallel to the optical axis before it hits the image plane.
The relationship between the focal length, the working distance and the image distance is given by the Gaussian lens formula:
In many imaging applications, the working distance is considerably larger than the image distance. In this case, we can approximate the above equation as:
We see that the image distance is approximately equal to the focal length. A simplified ray diagram for this case is shown below where only the chief rays from the sensor edges are drawn. These rays pass through the center of the lens without a change in direction.
The approximate value of the focal length in this case is given by:
For close-up applications such as macro photography, where the working distance is not significantly larger than the focal length, we cannot approximate the image distance to be the focal length. The more accurate form of the above equation (applicable both for near and far working distances) is given by:
Many lens vendors provide lens selection calculators on their websites that produce a recommended focal length based on the approximate form of the focal length equation. If in doubt, the calculation is
For example, consider an application using a 1/2” sensor, a working distance of 100 mm, and a horizontal field of view of 50 mm. Looking at the table, the 1/2” sensor has a width of 6.4 mm, a height of 4.8 mm, and a diagonal of 8 mm. To achieve the specified horizontal field of view, we use:
or using the exact equation:
The result is a focal length of 11.3 mm using the exact formula and 12.8 mm using the approximate formula. This discrepancy increases as the working distance decreases relative to the focal length.
Once you choose a focal length that best meets your requirements, you may need to adjust your working distance to achieve the desired field of view. Also, keep in mind that lenses with shorter focal lengths often exhibit pronounced distortion. The actual amount of distortion depends on the specific lens being used and can have a considerable impact on the actual field of view. The above equations ignore distortion. If the lens distortion is large (for example > 10%), the above equations are inaccurate for predicting the focal length and should only be used as starting point. The datasheet for the lens should be consulted. Typically an angular field of view is specified for
When purchasing a lens, make sure it is compatible with the optical size of the image sensor (for example, 1/3", 2/3", and so on) used in your camera. The lens must be able to project an image that covers the whole sensor. A lens made for a larger format sensor, such as 2/3", can usually be used with a smaller format sensor, such as 1/3", although there may be a loss of resolution (see below). However, the apparent focal length seems larger by the same factor as the sensor is smaller. The effect is comparable to applying a centered region of interest on a larger sensor. A lens made for a smaller sensor, such as 1/3”, cannot be used with a larger sensor, such as 1/2”, because the lens most likely does not project a large enough image to cover the whole sensor. The image corners in this case may appear blurry, dark (vignette), or even completely black.
The following table shows the approximate width (W), height (H), and diagonal (D) of the active area for different sized sensors, and the crop factors associated with using a certain lens on a smaller sensor. For example, suppose we have a 6 mm lens paired with a 1/3” sensor and you want to know what lens achieves the same field of view on a 1/4” sensor. The crop factor of the 1/3” sensor relative to the 1/4” sensor is 1.33. Therefore you select a focal length of 6 mm / 1.33 = 4.5 mm.
Sensor Spatial Resolution and Megapixel Lenses
Another important factor when selecting a lens is the number of pixels relative to the total sensor area. This measurement is usually inversely proportional to the pixel (unit cell)
The table below shows a sample of sensors used in Point Grey cameras and whether an MP lens should be used with them. It is advisable to use an MP lens with a megapixel sensor. For multi-megapixel sensors, the MP rating of the lens should meet or exceed the MP number of the sensor. Using a regular lens on a megapixel sensor may result in blurred images since the lens may not provide a high enough resolution for the sensor. Although it is acceptable to use an MP lens with a non-megapixel sensor, it may be impractical from a cost-benefit perspective.
Ideally, the lens format should also be matched to the sensor format for best performance. For example, a 1 MP 2/3” format lens on a 1 MP 1/3” sensor likely underperforms in resolution because the sensor is only capturing a fraction of the total detail produced by the lens. The 1 MP 1/3” lens, because of the smaller sensor area, provides a higher resolution than a 1 MP 2/3” in order to capture the same 1 MP worth of image content. Sensor spatial resolution is measured in
The resolution of a lens is typically measured by imaging sets of black and white bars with different pitches (
A more systematic measure of lens resolution is the Modulation Transfer Function (MTF). The MTF measures the amplitude (contrast) of an image of a sinusoidal pattern* that smoothly cycles between black and white at a given spatial frequency in cycles/mm (
* MTF measurements can also be performed by other methods such as point spread and slanted edge analysis.