This article was originally published at Basler's website. It is reprinted here with the permission of Basler.
In order to get a good, sharp image, you not only need a good camera, but also the right lens for the camera. Right from the beginning the sheer unlimited selection of possible lenses is apparent. For digital compact cameras there is usually a permanently installed lens; for reflex cameras you can work with exchangeable lenses in order to get the best possible image in many different situations. The individual lenses vary not only in their resolution, angle width, and size, but also in their construction. This is also a "problem" with machine vision cameras and the lenses that are appropriate for them. Which lens is the correct choice for which conditions will be explained in the following article.
What Types of Lenses are There?
Before we explain what to look for when selecting a lens, you should first consider the various types of lenses available. In general there are entocentric or telecentric lenses, as well as wide-angle and fish-eye lenses. Additionally, there are also special lenses for near infrared.
Here, however, we will concentrate exclusively on entocentric lenses as they are primarily found in machine vision applications. Normal entocentric lenses have a fixed–angle aperture for the lenses as well as for the sensor. The aperture angle is similar to the human eye. Far distant objects appear smaller and closer objects appear larger. The most commonly available entocentric lens is found in the human eye.
Which Factors Should I Consider When Selecting a Lens?
1. Sensor Size and Image Circle
The sensor size is a decisive factor in selecting the correct lens. High resolution area scan and line scan cameras in particular have larger sensors than cameras with lesser resolution. The dimensions of sensors are not determined by any standard, but are defined by the resolution and the pixel size of the sensor. Theoretically, anything is possible here, it is only a question of price.
The sensor size is given in inches, but corresponds to a sensor diagonal of 1 inch per 16 mm and not 25.4 mm. There are historical reasons for this.
Different sensor sizes
The interface between the camera body and the lens is called the mount. Mounts come in standard sizes and are labeled according to the screw-threaded type of the camera body.
A C mount, which is the most widely available type of mount for machine vision cameras, is appropriate for a sensor diagonal of c. 20 mm – corresponding to 1.5 inches. For larger sensors a F mount or and F bayonet is generally used, though this type is seldom used in industrial applications. For these applications, CS and S mount lenses, which are suitable for small sensors, are more commonly used. S mount lenses are used for a sensor size of 1/2″, 1/3″ or smaller. To mount a C mount lens on a CS mount body, a 5 mm adapter ring is necessary. This procedure will not work the other way around? A CS mount lens cannot be mounted on a C mount camera.
By Hustvedt (Own work) [GFDL or CC BY-SA 3.0], via Wikimedia Commons
1.2 Image Circle Diameter
The mount of a lens relative to the mount size only conditionally allows for an inference to the image circle. The term “image circle” describes the surface of the sensor that is irradiated by the transmitted light of a lens without any shading on the edge and the process is called “vignetting”.
Similar to the sensor size, the image circle diameter is given in inches. Ideally a 1/3″ C mount lens should be mounted on a camera with a 1/3″ large sensor. The available image circle is then optimally used. If we were then to attach the same lens on the camera body with a 1/2″ sized sensor, we would experience vignetting.
Assuming that we use a 2/3″ lens with the same focal length and a 1/3″ sensor, then we won't have any problem at all with vignetting. However, the angle of view would change. In principle, this is even an advantage as by using the larger lens, a larger image circle is created, which means that the sharpness of the image remains consistent from the center to the edge
In this case a large portion of the image circle is not used, which is a waste of money. It doesn't matter then how large the lens is, the size of the figure is determined by the sensor size. The larger the lens, the more expensive it is. For a smaller sensor you should use an appropriately smaller lens.
Conclusion: The image circle diameter must fit or be larger than the sensor size!
2. Resolution and Pixel Size
A high resolution image can only be created if a high resolution lens is used.
In order to get a really good high resolution image, more is required than a high megapixel count. The lens must also be capable of resolving the pixel size. The resolution of a lens is given in line pairs per millimeter and specifies how many lines on a millimeter appear as separate from one another. The more line pairs that appear as differentiated, the better the resolution of the lens.
With the MTF curve (modulation transfer function) the resolution capacity of a lens from the image center to the border is described. You can ask the manufacturer about these curves. The reference for calculating the MTF curve is a test chart with black and white bars in which the structures become increasingly finer so that the maximum resolution can be read in lp/mm.
The lens resolution is given in line pairs per millimeter (lp/mm).
The lens resolution helps to determine how large the pixels may be in order to still be able to resolve them. Most of the time the resolvable megapixels are directly specified for the lenses.
For a sensor with a 5 MP resolution, that is with 5 million image points, we would need a lens which is able to resolve the entire count of 5 MP.
Typical resolution test chart
Conclusion: The resolution of the lens must match the pixel size of the sensor.
Side note: Megapixel
Many manufacturers of consumer cameras or smartphones advertise the especially high megapixel count of their devices. This suggests to the consumer that more megapixels means more resolution and produces the best image. But the high mega pixel count doesn't in fact help if the lens does not fit. Good quality lenses are expensive, so many manufacturers try to save costs here. As an example, a smartphone with a camera resolution of 20 MP already produces a blurry image; a sensor with such a high pixel count will only enlarge the blur.
However, a compact camera with a 5 MP resolution and a high quality lens will produce noticeably sharper images, despite the purportedly lesser resolution.
For industrial image processing, sensors with resolutions of between VGA (0.3 MP) and 5MPp are generally offered. Higher resolutions would not make much sense at least for C mount cameras, because the individual pixel is much too small and the noise would be much too great to execute the demanding measuring and inspection tasks.
3. Interaction of Focal Length & Sensor Size
We designate the distance between the optical center of the lens and the focal point as the focal length. All the light rays of the parallel incident light intersect in the focal point. The focal length f of the lens is thereby dependent on the refractive power of the lenses and is expressed in millimeters.
The larger the focal length, the larger the telephoto characteristics of the lens. The giant lens that we may recognize from sports photographers and paparazzi clearly have larger focal lengths than the lenses of consumer cameras. Wide-angle and fish-eye lenses have correspondingly smaller focal lengths.
The focal length is determined by the sensor width, the object lens width, and the operating distance. Most lens suppliers offer calculation tools on their websites with which you can calculate the focal length.
Example images for various focal lengths
Conclusion: The focal length must match the sensor size and the application architecture.
4. Aperture & Lighting Conditions
The selection of the camera aperture has a direct impact on the image quality and the brightness. The F number (or F-stop) is the ratio of the focal length over the diameter of the aperture and specifies how wide the aperture is opened.
A high F number means that the aperture is smaller and thereby less light falls on the sensor. When the aperture is wide open, more light falls on the sensor and less additional light is needed to get a good image.
For poor lighting conditions, a wide-open aperture is thus beneficial.
A smaller aperture can have both advantages and disadvantages. Undesired effects such as vignetting and other aberrations are reduced and the focal depth is increased. However, care should be taken not to fade out too much. With a too small aperture, diffraction blur is created. Then the incident light on the edge of the aperture are deflected, which then negatively effects the quality of the image.
Therefore, there is an optimal F number for each lens which in effect is nothing more than the compromise between the least diffraction blur and the largest depth of field.
A small F number can increase the depth of field, but leads to strong fade out to diffraction blur. Therefore, you should find a good compromise.
Conclusion: The aperture must be appropriate for the light conditions in your application.
When you have understood the previous discussion, you should then ask the following questions:
- Lens mount: Does your lens have the same mount as your camera, for example, C mount?
- Resolution: Does the lens resolution fit the sensor resolution?
- Focal length: Is the focal length appropriate for the sensor size and the application?
- Image circle: Does the image circle diameter correspond at least to the sensor size?
- Aperture: Does the aperture match the predominant light conditions in your application?
Have you answered all the questions in this check list with "yes"? Congratulations, you have found the right lens for your camera and your application!