Choosing a lens for machine vision
Basic considerations in choosing a lens
There is a direct relationship between the sensor used in the camera and the most suitable lens. Parameters such as sensor size and pixel size are of major importance. The lens has to be able to illuminate the complete sensor area in order to avoid shading and vignetting. It also has to be able to resolve the pixel size. The better the optical resolution of a lens, the better detailed structures can be reproduced.
The optical quality of a lens is defined by the MTF (modulation transfer function) relating to resolution along with the optical distortion. In order to resolve the details of an object and to ensure definite edge detection, the detail should be reproduced across about 4 pixels. Thus the required magnification is dependent on the required object resolution and the respective pixel size. The ideal lens would produce an image which perfectly matches the object, including all details and brightness variations. In practice, this is never completely possible as lenses act as low pass filters. The amount of attenuation of any given frequency or detail is classified in terms of MTF (Figure 1) and for any lens there is a point at which the modulation is zero. This limit is generally called the resolution limit and is usually expressed in line pairs per millimetre (lp/mm). Not surprisingly, with the enormous range of sensor formats and resolutions available in machine vision cameras combined with a multitude of possible applications, there is also a very wide choice of lenses, including many very specialised lenses.
More commonly used lenses
Standard resolution lenses are the most widely used lens type for sensors with a resolution of less than about a megapixel. Generally available in standard fixed focal lengths from 4.5 – 100 mm, these lenses are optimised for focusing to infinity and are typically rated at an MTF of 70 – 90 lp/mm with low distortion and vignetting. Lenses with a shorter focal length usually produce images with ‘fisheye’ distortion.
High resolution lenses offer improved imaging performance compared to standard lenses. Typically they are available with focal lengths up to 75 mm, with an MTF in excess of 120 lp/mm and very low distortion (<0.1%). They are particularly well suited for cameras with a small pixel size or precise measurement applications.
Macro lenses are available for small fields of view that are approximately equal to the camera’s sensor size. Specified in terms of their magnification relative to the camera sensor, they are optimised for ‘close-up’ focusing. Although they have very good MTF characteristics and negligible distortion, they lack flexibility as it is not possible to change the iris or the working distance.
At the other end of the scale, large format lenses are required when a camera’s sensor exceeds that which can be accommodated with C-mount lenses. They are most commonly used in line scan applications. Large format lenses are often modular in construction with several separate components such as focusing adapters, helical mounts and spacers.
Telecentric lenses are used in specialist metrology applications to eliminate dimensional and geometric variations of images. These lenses do not suffer from distortion as they collimate the light that enters the lens. This results in images with constant magnification whatever the object distance without perspective distortion. Since the light is collimated, the front aperture of the lens needs to be at least as large as the field of view. This means that lenses for large fields of view will be comparatively expensive.
Electrically tunable liquid lenses
Electrically tunable liquid lenses are an interesting recent development. These are shape-changing lenses, based on a combination of optical fluids and a movable polymer membrane (Figure 2). Lens response times of the order of just milliseconds can be achieved by applying a control current to a diaphragm that changes the shape of the lens. They are particular useful where there is a need to rapidly change the focus of a lens, for example imaging on boxes of different heights, This unique principle enables the design of faster and more compact optical systems without complex mechanics. An impressive MTBF in excess of 1 billion movements means that they can offer a long working life as there are minimal moving parts. Applications include optical surface inspection, code reading on random distance packages, surveillance and 3D microscopy. With sophisticated new tunable lens controllers available, it is possible to provide seamless control of the lens, cameras, lighting in a single machine vision environment using conventional image processing software.
360˚ view optics
Imaging of complex image shapes frequently requires the use of more than one camera. However some novel lens designs that go under an umbrella description of 360˚ view optics have been introduced to allow viewing of every surface of an object with as few cameras as possible. Here the top and side views of an object or the bottom and inside views of an object with a hole in it, or multiple side views of an object can be captured in a single image. Applications come from a variety of market areas, such as the beverage, pharmaceutical and automotive industries.
Cylindrical objects such as bottles, jars, batteries, bolts etc can be imaged using special pericentric lenses. The specific path of the light rays through the lens means that light from the part of the object closest to the lens are imaged in the centre of the camera sensor while light from further away are imaged further out on the detector. This means that a single image can show detail from the top and the sides of the object simultaneously (Figure 3). Common applications in the beverage and pharmaceutical industries include bottle neck thread inspection, and datamatrix code reading – the code will always be correctly imaged no matter which direction it is facing. The smaller the object diameter, the larger the object height which can be inspected, while thin objects can be inspected over a larger diameter. For small objects (down to 7.5 mm diameter) catadioptric lenses are available. This lens design results in the sides of the object being inspected being observed over a wide viewing angle, approaching 45° at its maximum, which makes it possible to inspect complex object geometries under a convenient perspective.
A special range of hole inspection optics have been designed for viewing of objects containing holes, cavities and containers to allow imaging of both the bottom of a hole and its vertical walls. With a large viewing angle (>82°) and innovative optical design, these lenses are compatible with a wide range of object diameters and thicknesses. Hole inspection optics can be used to inspect a variety of different object shapes such as cylinders, cones, holes, bottles or threaded objects.
Another novel optical configuration is offered by polyview lenses. These provide eight different views of the side and top surfaces of an object. The wide perspective angle (45°) enables the inspection of the side features of an object (for example the threads of a screw or a nut) which would otherwise be impossible to acquire with a single camera. Both the external walls of an object and its top can be imaged at the same time, while internal surfaces of holed objects can be completely inspected from the outside. A combined view of the internal and external surfaces is possible and an image displaying both the inner walls and the bottom of a cavity can be obtained.
Choosing the best lens for the application
This article has highlighted just some of the multitude of optical configurations available to provide inspection solutions using machine vision. There has not been enough space to include topics such as motor control of lenses, iris control, the use of filters or lens mounting considerations. Choosing the most appropriate lens and indeed all of the other components needed for a machine vision system requires expert understanding of the application requirements and technology capabilities.
As Europe’s largest independent supplier of vision technology and services, STEMMER IMAGING can provide the world class vision expertise, advice and support needed to meet these challenges. With over 5000 products available from its optics portfolio alone, STEMMER IMAGING can supply the vision technology that’s right for the job.