Generally, lenses have fixed focal lengths. Also, it is common that the working distance is flexible, so for simple calculations start out with a ratio of working distance to focal length. This will allow you to use specific lens focal lengths to determine the working distance needed. If the working distance is limited, then, by inverting this ratio, we get the ratio of focal length to working distance. This will allow you to use a range of working distance options to get a focal length range. Then once a lens is selected you can recalculate the exact working distance needed.
These calculations are based on the following equation:
Calculate Focal Length:
- Example 4 (Using Flexible working distance): My FOV is 508mm x 381mm, my sensor size is 8.47mm (diagonal). The ratio of working distance to focal length is 381mm/6.06mm = 45:1. So, if I choose a focal length of 25mm (which is about 1") then a working distance of about 1140mm (45") is required. If the maximum working distance available is 889mm (35"), then inverting the ratio (1:45) gives the maximum focal length of 35/45 = 19.76mm (7/9") so a focal length of 16mm will do. Reversing the calculation gives a required working distance of about 711.2mm (28").
- Example 5 (Using Fixed working distance): My FOV is 609.6mm x 609.6mm, my sensor format is 12.7mm (diagonal) and my working distance is 1016mm. In order to be exact in solving for focal length, you would need to know the aspect ratio of the sensor. If exact is not necessary the diagonal will do. Solving the equation above for focal length will be (12.7X1016)/609.6 = 21.2mm. This is not a common lens focal length so either the working distance would need to be adjusted or a non-standard lens that allows the user to vary the focal length is required.
Lenses are manufactured with a limited number of standard focal lengths. Common lens focal lengths include 6 mm, 8 mm, 12.5 mm, 25 mm, and 50 mm. Once you choose a lens whose focal length is closest to the focal length required by your imaging system, you need to adjust the working distance to get the object under inspection in focus.
Note: Lenses with short focal lengths (less than 12 mm) produce images with a significant amount of distortion. If your application is sensitive to image distortion, try to increase the working distance and use a lens with a higher focal length. If you cannot change the working distance, you are somewhat limited in choosing a lens.
For your Basler camera feel free to use the Basler Lens Selector tool.