Optics recommendations
Lens Mounts and Image Sizes
First of all we can separate between C-mount and F-mount lens standards. A C-mount has a back flange distance of 17.526mm and a thread of 1 x 32 UN2A. An F-mount has a distance of 46.5mm and typically the Nikon bayonet flange.
C-mounts can be used for image diagonals up to 1”. Please note that this unit 'inch' is not a real inch - it comes from the outer diameter of the old TV-tubes.
To avoid vignetting the inner diameter of the lens tube (C-mount about 20 mm), the lens tube should be larger than the diameter of the image. For example, a Basler line scan camera with a 1k-line is 10.24 mm, a 2k-line is 20.48 mm. This means that a 1k-line can use a C-mount, but for a 2k-line we recommend an F-mount. For an area scan camera the diagonal of the sensor has to be taken into account.
There are many different types of lens mounts, C- and F-mount are the most common ones, but V-mount, M42 x 1, M42 x 0.75 (called T2), and M39 x 1/26” are also used. In some case the flange focal distance is adapted to provide short focal lengths.
Magnification
Magnification ß is calculated by ß = y’/y, where y’ is half the image size (for example 5.12mm = ½ x 10.24mm for a 1k-line) and y is half the size of the object. Please note that full size image divided by full size object is also the magnification. The ratio of the distance from the object to the lens a and the distance from the lens to the image a’ gives the magnification ß, too.
Focal Length
The focal length f ’ (mostly the same as f, too) of a lens can be calculated in different ways, having the desired magnification and the object distance: f ’ = a / (1 + (1/ß)) or f ’ = a / (1+(y/ y’)). The basic equation is f ’ = 1 / (1/a + 1/ a’). The focal length is usually calculated by using these formulas - then you have to check the closest focal length that is offered.
Please note, that the labelled number is not the real focal length (for example, a 35mm lens could have a focal length of 33.78mm). This might change your field of view (FOV). Use the following equation for the change in object size to compare with the desired object size: y = y’ x (a/f ’ –1), with y half of the object size, y’ half of the images size, a object distance, and f ’ focal length. The equation is valid for y and y’ for full sizes, too.
F-Number (F/#) and Diffraction Limit
The f-number (F/#) gives a number for the amount of light that is able to travel through the lens. It is calculated by F/# = f ’/d, with f ’ as focal length and d as diameter of the aperture which is roughly the size of the lens itself.
F-numbers often are 22, 16, 11, 8, 5.6, 4, 2.8, 2, and 1.4. They always change by a factor of sqrt(2), meaning a factor 2 in intensity. The lower the F-number, the more light can travel through the lens, however the aberration will also increase. Best image results will appear with F/# = 4, 5.6, 8. With lower f-numbers the image is blurred by aberrations (spherical aberrations, astigmatism, field curvature, coma, distortion, and chromatic aberrations) for high f-numbers it is blurred by diffraction. The diffraction limit is given by the diameter of the Airy-disk: ØAiry = 2.44 x l x F/#, with l for the (average) wavelength. As a rule of thumb, the limit for visible light is
roughly the F-number in microns. This is in the same range as the size of the pixels. There is a trend towards smaller pixels. At about 5μm pixel size, the optics is still available to resolve single pixels, but it is getting harder for smaller ones. In the case of colour cameras with a Bayer pattern, the limit is 2.5μm pixel size because a 2 x 2 macro pixel, containing red, green, and blue
color pixels, is again 5μm x 5μm.
Spectral Ranges
Basler cameras cover a spectral range from 400 to 1000nm. This is a more than the human eye is able to see - human eyes roughly detect about 400 to 800nm. Colour cameras usually have a Bayer pattern in front of the sensor. Please note, that the effective resolution of the chip has to be divided by two in each direction. The blue channel is sensitive from 400 to 500nm, the green from 500 to 600nm, and the red for more than 600nm.
Unfortunately, the near infrared (NIR) opens all three channels for higher than 700nm. To avoid incorrect colours (e.g. green leaves appearing yellow or orange), an IR-cut filter is required. For C-mount cameras it could be mounted in front of the sensor. Some lenses are corrected for the visible range, some include correction for NIR.
Choice of Lenses
A lens (or better an objective containing several lenses) is always designed for certain parameters. It is always a compromise between magnification, FOV, F/#, spectral range, image
size, aberrations, and finally costs.
If possible, avoid zoom lenses for two reasons: First, zoom lenses have to make larger compromises than fixed focus ones. Second, usually they are moved by a small motor inside a normal (photo-) camera. Tolerances are much higher in order to use motors with less power.
Auto-iris is usually not recommended because exposure times can be handled electronically by shutter speeds.
Changing the iris varies the depth of focus (DOF). The rule of thumb for visible light is: DOF = +/- (pixel size) x F/#. The next point is the magnification. Normal lenses have the best images for ß = 1:infinity to 1:10. This is usually restricted by the minimum optical distance (MOD). Distance rings may be used between the lens and the mount in order to change the magnification, but the lens is not designed for that magnification so the image may become blurred.
For good images do not use those distance rings!
For machine vision magnifications ß = 1:20 to 1:2 are mostly used. Normal macro lenses cover a range from ß = 1:4 to 1:1. For enlarging, meaning the image is larger than the object, ß = 1:1 to 4:1 use macro lenses in reverse orientation. There is usually enough space for mounting the lenses. Normally they have special mounts.
For magnifications ß ≥ 5 (or 5x) use microscopic lenses. Normal microscopic lenses will have a maximum image of a 2/3” chip. A magnification of 10 will work, but a 20x will have two limitations. First, usually the working distance is very small. Use bright light illumination in reflection or transmission if possible. Second, a pixel size of 6.7 μm will correlate to an object size of 0.34 μm (= 340 nm). This is less than the wavelength of the visible light. Under normal conditions this
makes no sense. A necessary point is a huge aperture, meaning a very low F/#. The DOF is very small (a few hundreds of a millimeter), the alignment is difficult, and nearly impossible for line scan cameras (maximum 1k-line). It is strongly recommended to avoid line scan cameras with
microscopic lenses.
Telecentric lenses have two great advantages: First, the image is free of perspective. Second, the DOF is rather large. This is done with a lens between the object and the lens in front of the camera. The lens has to be at least as large as the object which should be inspected. This generally makes these lenses very expensive. The lens produces a virtual image (compared to a magnification lens for the human eye) and changes distance and aperture (or F-number).