Optics technical overview
The focal length of a lens is the distance between its effective centre and the point at which light from infinity will be focused to a single point. The sensor of the camera needs to be positioned behind this point on what is called the image plane.
Field of view or magnification
The magnification ß' of a lens describes the ratio between image size and object size and has a direct connection to the focal length f' of the lens and the working distance a. The following diagram shows how to calculate the ratio between object size, working distance and focal length of the lens.
ß' = magnification a = object distance (working distance) a' = image distance f' = image-sided focal length f = object-sided focal length F = focal point (object-sided) F' = focal point (image-sided)
The ratio between working distance, image distance and focal length is calculated as follows:
Note: for ease of use this formula is based on a thin lens and not on a complex lens system, therefore results are only approximate. As the working distance for macro, microscopy or telecentric lenses is normally fixed without focus adjustment, these lenses are not defined by their focal length, but by magnification, as this is fixed and is more helpful when selecting the correct component.
F-number and depth of field
The F-number or numerical aperture defines the amount of light that can pass through the lens set-up. It is calculated by dividing the focal length of the lens by its effective aperture. Lenses are always quoted with their maximum aperture (smallest F-number) which can be reduced by closing down a diaphragm inside the lens known as an iris.
TIP: To ease the use of this formula why not download our lensSENSOR app available on the apple and android play store which simplifies selecting the right lens. You can find more information here.
The adjustable iris inside most lenses normally uses standard increments including 1.0, 1.4, 2.0, 2.8, 4, 5.6, 8, 11, 16, 22. Each increment represents a reduction in the amount of light passing through the lens by 50 %.
Depth of field (or depth of focus) is a measure of the range of object distances within which the image appears to be sharp and focused. It is a function of many things, but principally the lens iris size. The smaller the aperture, the larger is the depth of field.
Once an iris is reduced below F8.0, the sharpness of the image produced starts to be limited by diffraction. If it were not for diffraction you could reduce the iris to increase depth of focus. However, around this point the depth of field is limited by natural physical conditions.
In addition, it is also limited by the pixel size of the sensor, as the circle of confusion (COC) should not exceed 2 pixels. Another major influence is the magnification. Contrary to popular belief, it is not the focal length which limits the DoF, but the magnification. The same focal length and the same object can have different DoFs with different image sizes. But if only the focal length is changed in an application, while the working distance is adopted to match the same magnification, the DoF will remain the same.
For a rough estimation of the range of the depth of field, the following formula can be used:
Depth of field = 1/ß' mm where ß' (beta) = MAG = y'/y (image size / object size)
Aperture / iris control
As mentioned above changing the aperture changes the amount of light reaching the sensor. Standard lenses normally have a manual iris that is set and fixed however there are times when there is a need to change the iris. In the CCTV world lenses feature a motorised auto iris which take the video signal from the camera and changes the iris to achieve the same intensity. These are termed DC or video auto iris lenses.
In the majority of machine vision applications the video from the camera is not constant as the camera only takes an image on a trigger which makes these lenses unsuitable. For applications that do require iris control with non continuous videos P-Iris or precision iris can be used. Using direct control from some machine vision cameras or using a separate controller, the iris can be directly controlled from the application, making it suitable for machine vision applications.
Working distance and use of extension tubes
The working distance defines the free space between the object and the leading edge of the lens. Standard lenses are generally designed to focus objects ranging from infinity to a minimum object distance (MOD) in front of the lens. If the distance between lens and camera sensor is increased, the MOD can be reduced. It is possible to focus a lens closer than the MOD by using extension tubes which are positioned between the camera and the lens mount, thus increasing the flange focal length. Using this method also narrows the field of view (FOV) and enlarges the magnification.
The following diagram shows the effect that using an extension tube has on an image.
Extension tubes may be used with standard lenses to vary the image scale and to achieve a specific FOV, but there are a number of factors that have to be considered:
Any lens using extension tubes cannot focus to infinity
Less light reaches the sensor, as the image circle is widened and only a smaller part of the image circle is captured by the sensor
Using extension tubes results in higher magnification and a decreased depth of field
Extension tubes can be very useful, but should only be used when absolutely necessary. It is preferable to use lenses designed to work with shorter working distances and stable image quality.