Implementation and Optimization of a Dual-confocal Autofocusing System

This paper describes the implementation and optimization of a dual-confocal autofocusing system that can easily describe a real-time position by measuring the response signal (i.e., intensity) of the front and the rear focal points of the system. This is a new and systematic design strategy that would make it possible to use this system for other applications while retrieving their characteristic curves experimentally; there is even a good chance of this technique becoming the gold standard for optimizing these dual-confocal configurations. We adopt two indexes to predict our system performance and discover that the rear focal position and its physical design are major factors. A laboratory-built prototype was constructed and demonstrated to ensure that its optimization was valid. The experimental results showed that a total optical difference from 150 to 400 mm significantly affected the effective volume of our designed autofocusing system. The results also showed that the sensitivity of the dual-confocal autofocusing system is affected more by the position of the rear focal point than the position of the front focal point. The final optimizing setup indicated that the rear focal length and the front focal length should be set at 200 and 100 mm, respectively. In addition, the characteristic curve between the focus error signal and its position could successfully define the exact position by a polynomial equation of the sixth order, meaning that the system can be straightforwardly applied to an accurate micro-optical auto-focusing system.


Introduction
Due to its good reliability, high throughput, and relatively low cost, machine vision systems are an attractive solution for the inspection process in automated mass production lines. In practice, such systems always need a highly precise autofocusing capability to obtain sufficiently sharp images of the object of interest [1][2][3][4]. Autofocusing systems have been widely applied in recent decades in a variety of industrial manufacturing and measurement fields, such as in cellphone camera modules, automatically available optical inspection, and dynamic tracking systems [4]. In brief, many autofocusing systems have been developed, and these autofocusing systems can be broadly classified as image-based methods [5][6][7][8][9][10][11][12][13][14][15][16] and optics-based methods [17][18][19][20][21][22][23][24][25][26][27][28][29][30]. Both need to be driven by moving motors to achieve the function of autofocusing, which limits the possibility of their direct implementation for in-line inspection.
In an image-based autofocusing system, the position of the focusing objective lens is determined by capturing real images through a Charge-coupled Device (CCD) or Complementary Metal-Oxide-Semiconductor (CMOS) device with the use of complex image processing. The performance of the image-based autofocusing system depends on the sharpness of the captured images or the image spatial frequency function, which is used to calculate the focus value (FV) in the system. By hill-climbing searching, determining the peak value can help to determine the required focus based on a simple configuration, which is easy to handle and stable but rather time-consuming and has a very limited effective depth of focus. We have found that many research articles [31][32][33][34][35][36][37] have investigated the improvement of the algorithm using software and tried to make the application of the technique to the product line possible.
In the optics-based autofocusing method, the triangle geometric and dual-confocal configurations are widely used in the system. The triangle geometric technologies are well-known optical methods which are applied in many inspection instruments [38][39][40]. Our research group has published many methods to improve the focusing accuracy and response of the optics-based autofocusing systems with triangle geometric technologies [27][28][29][30].
Accordingly, we claim to have developed a novel and easily constructed autofocusing system by adopting a dual-confocal configuration. By utilizing a differential mode, we deal with the spatial optical intensity distribution from the rear and the front focal planes, retrieving two focus error signals. Furthermore, our system can directly retrieve the location of the specific focal plane. Meanwhile, we focus on an implementation in this paper in combination with an optimization method based on the optical autofocusing system. The commercially available software (ZEMAX) was used to verify our experimental setup. The system has the significant benefit of high accuracy, a fast response time, and the retrieval of the exact moving direction while tracking the front and rear focal planes, and there is tremendous potential for applying our system in mini-optomechanics with the required rapid autofocusing technique. Overall, we not only demonstrate the laboratory-built prototype in our study, but also show numerical analyses employed to determine the optimal design parameters of our proposed dual-confocal autofocusing system.

Methods
The image-based autofocusing system, which captures real images through CCD or CMOS devices with the cooperation of complex image processing, is a classic and well-known technique. Calculating the sharpness of captured images or the FV independently of the image spatial frequency function in the system can indicate the position of the focusing objective lens while in-focus. Chen et al. [7] first discussed an image-based autofocusing system and determined the peak value, which could help to determine focusing based on a simple configuration by hill-climbing searching, which is easy to handle and stable; however, it is rather time-consuming and has a very limited effective depth of focus. They adopted the discrete wavelet transform (DWT) method to perform the sharpness measurement and for further validation.
The fully digital autofocusing (FDAF) method was shown by Jeon et al. [31] to obtain a fast and precise autofocusing module by searching the focusing area automatically in cooperation with the point spread function (PSF). In 2011, Koh et al. claimed a configuration adopting two low-pass filters and double apertures based on the capture of two monochromic images to be able to denoise and distinguish its defocus direction and position through the variance of gradient magnitude (VGM) [32].
In 1993, Yamada et al. [33] developed a patent including a new configuration which was able to resolve the problem of distinguishing the rear focusing beam from the front one under a high-power zoom lens based on the creation of an optical difference by utilizing a switch device and a prism. They only needed to capture these two images to obtain sufficient information, while the exact focal plane was located between the front focusing beam and the rear focusing beam. This represented almost the first concept of the dual-confocal autofocusing system and easily handled the determination of the focusing position and its moving direction.
The optical-based configuration includes photodetectors (e.g., CCD, CMOS, photomultiplier tube (PMT)) as information detection systems to determine the shape of a laser spot and its intensity to estimate focusing, which is highly precise and quick to perform based on the position error signal (or Sensors 2020, 20, 3479 3 of 12 focus error signal). In 2010, Wang et al. developed a femtosecond laser machining system by adopting the autofocusing module in combination with the dual-confocal system, as shown in Figure 1. The results of their simulations and experiments demonstrated that the values of positioning accuracy and repeatability are both less than ±1.5 µm within the measuring range of ±200 µm based on the respective response intensity of dual near-focusing position [41]. This is also an example of the above-mentioned dual-confocal system configuration being applied for an autofocusing function.
Sensors 2020, 20, x FOR PEER REVIEW 3 of 13 1. The results of their simulations and experiments demonstrated that the values of positioning accuracy and repeatability are both less than ±1.5 μm within the measuring range of ±200 μm based on the respective response intensity of dual near-focusing position [41]. This is also an example of the above-mentioned dual-confocal system configuration being applied for an autofocusing function. Figure 1. The schematic diagram of the dual-confocal system [41].
Using the dual-confocal configuration, we propose an optics-based autofocusing system scheme in this paper, as shown in Figure 2a. Meanwhile, the response intensity of the focusing or defocusing position is able to be obtained by two photodetector (PD) signals of the front and rear focal planes, which could be used to calibrate and determine the exact focusing position and its direction. Moreover, we provide a characteristic curve of the focus error signal obtained by the two differential PD signals. Therefore, this optics-based autofocusing system simply utilizes the well-set PDs to retrieve the real-time intensity signal near the focal plane, which can directly indicate the focusing position by simultaneously calculating the merit function of the intensity distribution. Our proposed optics-based autofocusing system has the advantages of being highly precise and having a rapid response time, enabling the module to be easily imported to the production line. Compared with the conventional confocal system, our proposed system can obtain the moving direction information only by retrieving the intensity near the focal plane, i.e., at the exact positions indicated. According to the light intensity distribution of Gaussian focusing, the two parts of the original signal (i.e., intensity) detected from the PDs at the different focal positions will indicate two characteristic curves. The location of the focal plane is indicated by comparing the intersection of the two spatial optical intensity distribution curves with the rear and front defocus distance, respectively, as shown in Figure 2b. Thus, we can obtain the position of the focal plane accompanied with its moving direction, and we only need to calculate the exact optical difference between two light beams for the front focusing and rear focusing. In brief, we propose a novel dual-confocal configuration for an opticsbased autofocusing microscope, to be used instead of a conventional confocal system or a centroid knife-edge method. This configuration boasts a simple scheme without redundant moving by trial and error; it has several significant characteristics enabling fast scanning, precise position tracking, and a low cost. Key points related to the above-mentioned methods are shown in Table 1. Using the dual-confocal configuration, we propose an optics-based autofocusing system scheme in this paper, as shown in Figure 2a. Meanwhile, the response intensity of the focusing or defocusing position is able to be obtained by two photodetector (PD) signals of the front and rear focal planes, which could be used to calibrate and determine the exact focusing position and its direction. Moreover, we provide a characteristic curve of the focus error signal obtained by the two differential PD signals. Therefore, this optics-based autofocusing system simply utilizes the well-set PDs to retrieve the real-time intensity signal near the focal plane, which can directly indicate the focusing position by simultaneously calculating the merit function of the intensity distribution. Our proposed optics-based autofocusing system has the advantages of being highly precise and having a rapid response time, enabling the module to be easily imported to the production line. Compared with the conventional confocal system, our proposed system can obtain the moving direction information only by retrieving the intensity near the focal plane, i.e., at the exact positions indicated. According to the light intensity distribution of Gaussian focusing, the two parts of the original signal (i.e., intensity) detected from the PDs at the different focal positions will indicate two characteristic curves. The location of the focal plane is indicated by comparing the intersection of the two spatial optical intensity distribution curves with the rear and front defocus distance, respectively, as shown in Figure 2b. Thus, we can obtain the position of the focal plane accompanied with its moving direction, and we only need to calculate the exact optical difference between two light beams for the front focusing and rear focusing. In brief, we propose a novel dual-confocal configuration for an optics-based autofocusing microscope, to be used instead of a conventional confocal system or a centroid knife-edge method. This configuration boasts a simple scheme without redundant moving by trial and error; it has several significant characteristics enabling fast scanning, precise position tracking, and a low cost. Key points related to the above-mentioned methods are shown in Table 1.    Figure 3 illustrates the brief configuration of our proposed system, including a laser diode, a collimator, the first beam splitter (BS), a microscope module, the second BS, and two pinholes (which Sensors 2020, 20, 3479 5 of 12 set at the front focal plane and at the rear focal plane) that cooperate with the photodetectors (PDs). The light source we adopted was a laser diode (wavelength of 633 nm) made by Thorlabs (HL6501MG). The microscope module we utilized had an objective of 10× (Olympus Co., f = 18 mm) and can cover the scanning area of about 2 mm × 2 mm, which is sufficient an for optics-based autofocusing system with single-point scan application. Table 2 thus shows all key modules adopted in our proposed dual-confocal microscopic system. For comparison with the simulation results (considering the total optical difference from 150 to 400 mm while comparing with the objective of the microscope module), we constructed a prototype of the dual-confocal configuration with a rear focal length of 100 mm and a front focal length of 200 mm. Furthermore, the characteristic curve between focus error signal (FES) and its position can successfully define the exact focusing position by a sixth-order polynomial equation.

System Implementation
Sensors 2020, 20, x FOR PEER REVIEW 5 of 13 Figure 3 illustrates the brief configuration of our proposed system, including a laser diode, a collimator, the first beam splitter (BS), a microscope module, the second BS, and two pinholes (which set at the front focal plane and at the rear focal plane) that cooperate with the photodetectors (PDs). The light source we adopted was a laser diode (wavelength of 633 nm) made by Thorlabs (HL6501MG). The microscope module we utilized had an objective of 10× (Olympus Co., f = 18 mm) and can cover the scanning area of about 2 mm × 2 mm, which is sufficient an for optics-based autofocusing system with single-point scan application. Table 2 thus shows all key modules adopted in our proposed dual-confocal microscopic system. For comparison with the simulation results (considering the total optical difference from 150 to 400 mm while comparing with the objective of the microscope module), we constructed a prototype of the dual-confocal configuration with a rear focal length of 100 mm and a front focal length of 200 mm. Furthermore, the characteristic curve between focus error signal (FES) and its position can successfully define the exact focusing position by a sixth-order polynomial equation.

Results
Our proposed configuration was characterized numerically by using the commercially available software (ZEMAX), and then it was verified experimentally using a laboratory-built prototype, as shown in Figure 4. Figure 5 shows the simulation data obtained by the two PDs, which means optical intensity retrieved at the front site and rear site of the focal planes in our proposed system. The both sites setup were chosen on the basis of the similarly symmetrical curves while obtaining single optical intensity distribution versus the defocus distance. The optimal parameters included the four Sensors 2020, 20, 3479 6 of 12 independent parameters, with the primary importance being placed on the rear focal point. The maximum error of our autofocusing system could be evaluated on the basis of several tests (see Table 3). The FES, which can be determined by differential modes of two signals, should be directly be directly dependent on the focusing position, as shown in Figure 6. We constructed an approximation formula refereed to the results obtained from the FES and focusing position. More specifically, the raw data obtained from the PDs can be easily used to calculate and indicate the exact position real-time.
Our proposed configuration was characterized numerically by using the commercially available software (ZEMAX), and then it was verified experimentally using a laboratory-built prototype, as shown in Figure 4. Figure 5 shows the simulation data obtained by the two PDs, which means optical intensity retrieved at the front site and rear site of the focal planes in our proposed system. The both sites setup were chosen on the basis of the similarly symmetrical curves while obtaining single optical intensity distribution versus the defocus distance. The optimal parameters included the four independent parameters, with the primary importance being placed on the rear focal point. The maximum error of our autofocusing system could be evaluated on the basis of several tests (see Table  3). The FES, which can be determined by differential modes of two signals, should be directly be directly dependent on the focusing position, as shown in Figure 6. We constructed an approximation formula refereed to the results obtained from the FES and focusing position. More specifically, the raw data a obtained from the PDs can be easily used to calculate and indicate the exact position realtime.  Sensors 2020, 20, x FOR PEER REVIEW 7 of 13 Figure 5. Simulation of the intensity signals from the two photodetectors. Figure 5. Simulation of the intensity signals from the two photodetectors. We demonstrated that the FES calculation can indicate the position through measuring the intensity by two PDs because of the theoretically predictive intensity distribution. Considering the signal variability near the focal position and far away from the focal plane, the minimum FES would be 1.6 µm under the available signal limitation (as shown in Figure 7). Furthermore, the data retrieval performance at the rear focal point is better than at the front one, so we discuss how the relationships between the signal variability (µm) and several parameters (e.g., pinhole position, pinhole size, and effective focal length (EFL)) can be determined by the characteristic curves of the front and rear focal points (as shown in Figure 8). Here, we define the slope and error position as the two set indexes of the characteristic curve, as shown in Figure 9, which represent the signal transfer error and its available linear sensitivity. A low ∆X index when considering the minimum electric signal error is indicative of the potential of our focusing system for highly precise positioning. The slope index values (Slope1 & 2) can be determined from the characteristic curve near the focal plane and away from the focal position, which indicated the linear transformation from the FES calculation well.       Table 3 shows our simulation data, including thirty-one sets of the above-mentioned indexes, and the optimal parameters of the rear focal point that we chose in our system. Finally, the optimal pinhole size is 75 μm, the optimal pinhole distance from the objective is 113.5 mm, and the optimal rear focal length is about 100 mm (as shown in Figure 10). Accordingly, the results shown in Figure  10 demonstrate that the measuring sensitivity of the rear focal point is better than that of the front focal point. We determined the optimal setup of the rear focal point first in order to retrieve the ΔX1 and ΔX2 indexes. Furthermore, we also adopted the following optimal parameters for the front focal point: pinhole size of 400 μm, pinhole distance from the objective of 35.6 mm, and rear focal length of about 200 mm. According to Figure 6, a mirror-like curve is constructed with opposite the x-axis and the y-axis, which is similar to the curve of the rear focal point; this allows the FES to be calculated and its position to be indicated directly.  Table 3 shows our simulation data, including thirty-one sets of the above-mentioned indexes, and the optimal parameters of the rear focal point that we chose in our system. Finally, the optimal pinhole size is 75 µm, the optimal pinhole distance from the objective is 113.5 mm, and the optimal rear focal length is about 100 mm (as shown in Figure 10). Accordingly, the results shown in Figure 10 demonstrate that the measuring sensitivity of the rear focal point is better than that of the front focal point. We determined the optimal setup of the rear focal point first in order to retrieve the ∆X1 and ∆X2 indexes. Furthermore, we also adopted the following optimal parameters for the front focal point: pinhole size of 400 µm, pinhole distance from the objective of 35.6 mm, and rear focal length of about 200 mm. According to Figure 6, a mirror-like curve is constructed with opposite the x-axis and the y-axis, which is similar to the curve of the rear focal point; this allows the FES to be calculated and its position to be indicated directly.
focal point. We determined the optimal setup of the rear focal point first in order to retrieve the ΔX1 and ΔX2 indexes. Furthermore, we also adopted the following optimal parameters for the front focal point: pinhole size of 400 μm, pinhole distance from the objective of 35.6 mm, and rear focal length of about 200 mm. According to Figure 6, a mirror-like curve is constructed with opposite the x-axis and the y-axis, which is similar to the curve of the rear focal point; this allows the FES to be calculated and its position to be indicated directly.  Our proposed optical configuration was suitably designed and constructed to retrieve an FES from the rear focal plane and another FES from the front focal plane. To indicate the location of the specific focal plane, the relationship between the FES and the defocus distance is adopted and its spatial optical intensity distribution is calculated. In this manuscript, we have proposed and developed a novel and easily constructed autofocusing system.

Conclusions
This paper successfully describes a new design rule for choosing the optimal system parameters for obtaining the lowest signal variability. For the front and rear focal points, we defined the values of the focal length, pinhole position, and pinhole size in a step-by-step process. Our results also showed how the total optical difference from 150 to 400 mm significantly affected the effective volume of our designed autofocusing system. This finding should be considered carefully when integrating this module into the whole system. We adopted two indexes to predict our system performance and discovered that the rear focal position and its physical design are major factors that directly affect the accuracy of an autofocusing system based on dual-confocal configuration accompanied with sufficient dynamic range.