While autofocus has become a standard perk in consumer cameras, the industrial imaging realm demands a touch of innovation. This article by Basler outlines various autofocus options and their tradeoffs, helping you understand how to choose the right solution for your specific application.
1. What are the possible scenarios that require autofocusing in industrial inspections?
Autofocusing is a valuable feature in industrial inspection applications where maintaining sharp focus on the object or scene is crucial for accurate analysis, measurement, and quality control. Here are some scenarios in industrial inspection where autofocusing is commonly required:
When the working distance keeps changing in dynamic environment;
When the application requires high resolution, and you need lenses with larger apertures to maintain image clarity and sharpness;
In high-speed inspection scenarios where the camera is operating in lowlight conditions or capturing rapidly moving objects;
The implementation of autofocus in these scenarios enhances the efficiency, accuracy, and reliability of industrial inspection systems. This reduces the requirement for manual adjustments, ensuring optimal image quality for subsequent analysis and decision-making processes.
2. Common autofocusing challenges in industrial settings
For clear visibility of varied heights, opt for a larger depth of field with a smaller aperture (bigger F number). However, this requires longer exposure for ample brightness. In high-speed applications, a wider aperture (smaller F number) is needed for sufficient light, but it limits depth of field, impacting focus.’
3. What are the different AF methods and their tradeoffs?
In professional imaging, autofocus methods typically fall into two categories: active and passive. Active autofocus employs tools like lasers to calculate the working distance and positions the imaging system accordingly. In contrast, passive autofocus captures multiple images as the working distance changes and selects the focused image through evaluation. Active autofocus is also known as distance-detection-based autofocus, while passive autofocus is referred to as image-based autofocus.
Both approaches are used in industrial applications, and they have their respective advantages and limitations. Let’s look at them one by one.
Active Autofocus
In an active autofocus system, a distance detection device is necessary. The most commonly used device in industrial settings is a laser, while interferometers are less common and mainly utilized in labs. In this article, we will delve into the benefits and limitations of laser autofocus.
The key advantages of a Laser AF solution include: firstly, active autofocus proves beneficial when the working distance of the application cannot be predicted. Secondly, the laser detection system excels in both speed and accuracy of distance detection.
However, it’s evident from the system diagram in Figure 2 that the hardware setup is quite complex, leading to naturally higher costs. Another significant drawback of the active autofocus approach is its low flexibility.
Passive Autofocus
There are primarily two methods for passive autofocus: phase-detection autofocus (PDAF) and contrast detection autofocus (CDAF). PDAF, designed within the camera sensor, is more commonly used in consumer cameras. However, for larger projects that allow for a customized sensor with PDAF, it can also be an option for industrial applications.
CDAF, also known as image-based autofocus, finds wider application in industrial scenarios. The key advantages of CDAF include a simpler system architecture, lower costs due to requiring less hardware, and greater flexibility. However, this approach has its limitations.
Firstly, the speed and accuracy are slightly lower compared to the laser-detection approach. Secondly, as complex image analysis and processing are involved, independently developing a solution from scratch can be resource-demanding. Thirdly, the choice of where to run the image processing becomes crucial. If executed on the CPU, it may consume more resources than desired, impacting the overall system stability. Alternatively, if run on a frame grabber, it involves additional hardware and thus additional costs.
4. How to select and develop your own autofocus solution?
In engineering, there’s typically no perfect solution that solves all problems at once; rather, it often involves shifting a problem from one area to another. The methods employed to address the problem will also change. The suitability of a solution depends on your application requirements, and a thorough professional project evaluation before initiation is always essential.
In the preceding section, we explored the advantages and limitations of both active and passive autofocus methods. When it comes to selecting the right solution for your application, there is usually no simple and straightforward answer. The following comparison chart provides a comprehensive overview of the advantages and limitations of different approaches for industrial autofocus. Four distinct autofocus methods are compared based on their re-focusing speed, result accuracy, system flexibility, complexity, and cost.
“In this chart, the speed for CDAF involves the use of a liquid lens, providing a faster re-focusing mechanism.
So, if your project demands utmost accuracy, even with the associated higher cost and system complexity, a laser-based autofocus method is the optimal choice. However, if the speed and accuracy offered by CDAF already meet your project requirements, it stands out as a more cost effective option that excels in all aspects.
Even within CDAF, you can choose either a liquid lens or a motorized lens as the key focus-changing device. If you need a fast and continuous re-focusing solution for high-speed inspection lines, a liquid lens autofocus solution is more suitable. On the other hand, when you need occasional zooming and re-focusing, a motorized lens is the better solution.
When opting for the CDAF approach, whether with a liquid lens or a motorized lens, the key challenges to overcome include:
Coordinating the control of the liquid/motorized lens with the camera.
Developing an autofocus algorithm for pre-processing and analyzing images.
Addressing CPU loading considerations.
And to solve all these problems, building a team with different skillsets and organizing necessary trainings are essential. This will enable the seamless integration of the selected lens and the development of an AF algorithm that works. These tasks don’t sound very difficult until you really dive into it. For example, managing different APIs for the re-focusing device and camera.
Additionally, developing autofocus algorithm is a very complex task, requiring in-depth understanding of industrial imaging. Some of the major challenges in refocusing include: insufficient lighting, high image noise, insufficient contrast, targets on different planes, and ill synchronization of lens and image analysis.
5. What are the available CDAF solutions in the market?
If your project timeline is tight, or it’s challenging for you to build the right team quickly, you might be looking for solutions available in the market to help you realize autofocusing. The expectations of an AF solution would be one that is able to address one or more of the challenges outlined in the previous part of this particle. Here are some of the main solutions available from Basler:
Solution 1: Liquid/motorized lens control from an industrial camera, but no AF algorithm available.
In this solution, camera manufacturers develop a feature within the camera FPGA to control the re-focusing lens. The advantage of this approach is that users only need to interact with a single camera API, eliminating the need for lens integration. However, they will still need to develop their own autofocus (AF) algorithm. Nevertheless, if your team can develop the algorithm quickly, Solution 1 may already be sufficient to meet the requirements
Solution 2: Liquid/motorized lens control and AF algorithm from a frame grabber FPGA
This solution is better suited for high-end applications involving complex image processing or the need to handle large amounts of image data. Developing both the lens control and autofocus algorithm on the frame grabber is advantageous to free up CPU load.
Solution 3: Lens control + AF algorithm from an industrial camera
Compared to the previous two solutions, this option is the most streamlined in both hardware and software. Users can achieve the best-focused image out of the box, and the integration process is as simple as incorporating a standard industrial camera. There is no additional CPU load, no need for complex programming, and no extra cost for additional hardware.
Read more about the autofocus use cases from Basler website.