# A High Precision Laser-Based Autofocus Method Using Biased Image Plane for Microscopy

Authors: Chao-Chen Gu; Hao Cheng; Kai-Jie Wu; Liang-Jun Zhang; Xin-Ping Guan
Journal: Journal of Sensors
 (2018)

---

## Abstract

This study designs and accomplishes a high precision and robust laser-based autofocusing system, in which a biased image plane is applied. In accordance to the designed optics, a cluster-based circle fitting algorithm is proposed to calculate the radius of the detecting spot from the reflected laser beam as an essential factor to obtain the defocus value. The experiment conduct on the experiment device achieved novel performance of high precision and robustness. Furthermore, the low demand of assembly accuracy makes the proposed method a low-cost and realizable solution for autofocusing technique.


---

## Body

## 1. Introduction

Autofocus is an important function of an autoscanning microscope. There have been countless camera-based products with autofocusing function, but most of these instruments adopt the image sharpness-based method to estimate the focal position. These methods are rather time-consuming since the prefocus process is a searching process over the whole focusing range with steps of different intervals [1, 2]. The focusing accuracy is often limited by the image content in the microscopic view [3]. Recent years, new methods have been developed with ingenious imaging skills and illumination designs. Chang et al. [4] proposed a defocus detection method using a bevel-axis imaging sensor, which stretches defocus images at the tilting direction. Liao et al. [5] developed a novel focus map surveying method using additional LED illumination and autocorrelation image analysis, which promised a turnkey solution for the most whole slide imaging (WSI) system.Distinguished from the image-based methods, optic-based autofocus methods adopt auxiliary optical paths for defocus detection, which have also been widely researched [6–11]. Hsu’s team developed a laser-based autofocus system that had fast response characteristics [6]. The autofocus microscope system embedded an astigmatic lens to convert focus error signal to differential laser intensity on a four-quadrant photodiode. Rhee et al. improved the astigmatism method using two cylindrical lenses to enhance the astigmatic imaging and a circuitry controller for larger detection range and higher speed performance [7]. Laser-based method is less sensitive to contents in the field of view, but requires high reflective surface, which means it is more suitable for industrial inspections, such as glass surface and TFT-LCD inspection.Liu et al. [8–11] proposed a laser-based autofocusing method using geometric optics to achieve fast and precise autofocus performance. In Liu et al.’s method, a knife was used to bisect the detecting laser beam for bidirectional defocus detection. The shortage of the bisected laser-based autofocusing method is that when the defocus is small, serious diffraction effects make the detected laser spot an irregular round spot. Liu et al. developed a centroid-based algorithm to weaken the diffraction effects. However, high precise assembly is still preferred to obtain a high linear accuracy near the neighborhood of focal position, which means high cost is required.In the bisected laser-based autofocusing method, when defocus value varies from “inner focus,” “outer focus,” and “in focus,” the semicircular laser spot can theoretically image in three different states as illustrated in Figure1. However, there are distortions and diffractions on the knife edge, which means a perfect semicircle can never be obtained. The diffraction effects seriously intensify when the defocus is near to zero. As a result, the laser spot will never be an ideal point. The linearity decreases when the scanning plane is near the ideal focal plane, which means low precision and bad performance. High cost is needed to improve the diffraction effects for high precision assembly and calibration.Figure 1
Schematic representation of laser spot on focusing CD according to different defocuses [8].To overcome the shortages of bisected laser-based autofocusing method, we modified the optical structure of the laser-based autofocus system and developed a high robust image processing method to achieve high precision autofocus performance. The remaining of the paper is organized as follows: Section2 introduces characterized structure of the laser-based autofocus system, as well as the improved optical path using biased image plane adopted in this paper, Section 3 presents a laser spot processing algorithm using the laser spot radius for defocus value measurement, and Section 4 provides experiments of the proposed method.


## 2. The Proposed Method

Figure2 illustrates the basic structure of the proposed autofocus system. Compared with the bisected laser-based autofocusing method, the knife used to blank the beam is removed to ensure that the beam image on the CCD is a complete circular spot. Apart from that, image plane of the focusing CCD does not have to be set on the focal plane but with an offset distance. Different from the conventional method, the spot is a complete round with different radiuses according to different defocuses as shown in Figure 3.Figure 2
Basic structure of the laser-based autofocusing method using biased image plane.Figure 3
Schematic representation of laser spot on focusing CCD at different defocuses.According to the geometric principle of the optical path illustrated in Figure4, the following mathematical relationship in (1) can be obtained:
(1)L1′=f1+2δ,1L1+1L1′=1f1,L2′=L1−S,1L2−1L2′=1f2,tanU1′=Rf1,L1×tanU1=L1′×tanU1′,L2×tanU2=L2′×tanU′,where f1 is focal length of the objective lens, f2 is the focal length of tube lens, δ is the defocus distance, L1′ and L1 are equivalent object distance and image distance of the objective system, L2′ and L2 are equivalent object distance and image distance of the tube lens system, U1′, U1, U2′, and U2 are related maximum angles of incidence and emergence of the laser beam, R is the radius of the laser beam, and S is the optic axis distance between objective lens and tube lens.Figure 4
Schematic diagram of the optical path of the proposed autofocusing method.Then, an equation about the laser spot on image plane of focusing CCD can be obtained as follows:(2)r=l×tanU2=2Rf1f2f1+df1+Sdf1f2+df2δ+Rdf2=C1δ+C2,where r is the radius of the laser spot, l=f2+d−L2, d is the offset distance between image plane and focal plane, C1=2R/f1f2/f1+d/f1+Sd/f1f2+d/f2, and C2=Rd/f2=r0, r0 is the radius of the laser spot when the sample is in focus. Notably, C1 and C2 are both constant values, which are only determined by optic parameters when the defocus value δ is small.


## 3. Laser Spot Processing Algorithm

The proposed optics provides a promising linear relationship between defocus valueδ and radius of the detected laser spot. However, processing of the laser spot is still an important issue that has impact on autofocus performances, because of the image noise, nonuniform lighting, assembly tolerances, and optical interferometry. In this section, a robust and high-speed laser spot processing algorithm is proposed.As shown in Figure5, there are several steps, from raw image to the result radius, including channel selection, binarization, border point extraction, triad point matching, radius calculation, and result clustering. Channel selection, binarization, and border point extraction could be taken as raw image preprocessing procedures in calculation of the radius of the laser spot; triad point matching and radius calculation compute a serial of spot radiuses from perspective of triangle circumcircle radius problem; and result clustering eliminates noise results with K-means clustering.Figure 5
Procedures of the proposed laser spot processing algorithm.


### 3.1. Raw Image Preprocessing

Filtering: use the median filter to remove some isolated points at the edge of the spot.Binarization: converting the laser to a black and white image using the Otsu’s algorithm. When the light intensity distribution of the laser spot or the background is uneven, gamma correction could be used to obtain a balanced laser spot and background.Border point extraction: retrieving the border points of the laser spot using a traversal method.


### 3.2. Triangle Circumcircle Radius Problem

Triad point matching: construct a series of triangles with the border points as shown in Figure 5. Note that the triangles should approximate equilateral triangle to weaken the noise sensitivity of side length, since the border points are not ideally distributed on the circumcircle. Hence, trisection intervals are preferred in triad point matching as illustrated in Figure 6, which means the matched triad points could be expressed with a triple as follows:
(3)TPi=Xi,Yi,Xi+n/3,Yi+n/3,Xi+2n/3,Yi+2n/3,where i≤n/3, n is the total number of the border point list. In this research, a systematic sampling method is applied to reduce the computational cost.Figure 6
Triad point matching.Radius calculation: for each matched point triangle TPi=P1i,P2i,P3i, in which P1i=Xi,Yi, P2i=Xi+n/3,Yi+n/3, and P3i=Xi+2n/3,Yi+2n/3; the following equation can be obtained using circumradius formula of triangle:
(4)CRi=Hl1i,l2i,l3i=l1il2il3il1i+l2i+l3i×l1i+l2i−l3i×l1i+l3i−l2i×l2i+l3i−l1i,where CRi is the circumradius value obtained from TPi, which is also the radius of the laser spot, l1i=norm2P1i,P2i, l2i=norm2P2i,P3i, and l3i=norm2P1i,P3i.Then, a group of radiuses for the laser spot can be obtained, denoted withCR=CRi∣i=1,2,3,…, in which most are around the real value of laser spot’s radiuses. However, there are still some odd values in CR that far from statistics. Hence, the following section presents a K-means-based clustering method to eliminate these odd values.


### 3.3. K-Means-Based Result Denoising

Based on the assumption that there are totally three kinds of distribution of border points extracted from the raw image, that is, outer border, on border and inner border, which lead to the spot results smaller, approximate, and larger than real spot radius, we apply three clusters in K-means-based result denoising and adopt medium cluster to filter the large deviation results. A brief description of K-means-based denoising is as follows:(1)
Initialize 3 cluster centroids from data setCR, μ1,μ2,μ3∈CR1,CR2,…,CRk, where k is the total number of CR, μ1<μ2<μ3, and the corresponding clusters are named as C1, C2, and C3.
(2)
Repeat until convergence:
{
For each spot radius resultCRi, set CRi∈Cj.
(5)j=argminxCRi−μx2,x=1,2,3.
For eachj, set
(6)μj=∑CRiCardCj,CRi∈Cj.
}
(3)
The denoised laser spot radiusr=μ2, the centroid of C2.Figure7 illustrates the effect of K-means-based result denoising, in which noise in the results that obviously offset from the final results has been eliminated, leaving only blue points in the diagram effective results.Figure 7
K-means-based result denoising.


## 3.1. Raw Image Preprocessing

Filtering: use the median filter to remove some isolated points at the edge of the spot.Binarization: converting the laser to a black and white image using the Otsu’s algorithm. When the light intensity distribution of the laser spot or the background is uneven, gamma correction could be used to obtain a balanced laser spot and background.Border point extraction: retrieving the border points of the laser spot using a traversal method.


## 3.2. Triangle Circumcircle Radius Problem

Triad point matching: construct a series of triangles with the border points as shown in Figure 5. Note that the triangles should approximate equilateral triangle to weaken the noise sensitivity of side length, since the border points are not ideally distributed on the circumcircle. Hence, trisection intervals are preferred in triad point matching as illustrated in Figure 6, which means the matched triad points could be expressed with a triple as follows:
(3)TPi=Xi,Yi,Xi+n/3,Yi+n/3,Xi+2n/3,Yi+2n/3,where i≤n/3, n is the total number of the border point list. In this research, a systematic sampling method is applied to reduce the computational cost.Figure 6
Triad point matching.Radius calculation: for each matched point triangle TPi=P1i,P2i,P3i, in which P1i=Xi,Yi, P2i=Xi+n/3,Yi+n/3, and P3i=Xi+2n/3,Yi+2n/3; the following equation can be obtained using circumradius formula of triangle:
(4)CRi=Hl1i,l2i,l3i=l1il2il3il1i+l2i+l3i×l1i+l2i−l3i×l1i+l3i−l2i×l2i+l3i−l1i,where CRi is the circumradius value obtained from TPi, which is also the radius of the laser spot, l1i=norm2P1i,P2i, l2i=norm2P2i,P3i, and l3i=norm2P1i,P3i.Then, a group of radiuses for the laser spot can be obtained, denoted withCR=CRi∣i=1,2,3,…, in which most are around the real value of laser spot’s radiuses. However, there are still some odd values in CR that far from statistics. Hence, the following section presents a K-means-based clustering method to eliminate these odd values.


## 3.3. K-Means-Based Result Denoising

Based on the assumption that there are totally three kinds of distribution of border points extracted from the raw image, that is, outer border, on border and inner border, which lead to the spot results smaller, approximate, and larger than real spot radius, we apply three clusters in K-means-based result denoising and adopt medium cluster to filter the large deviation results. A brief description of K-means-based denoising is as follows:(1)
Initialize 3 cluster centroids from data setCR, μ1,μ2,μ3∈CR1,CR2,…,CRk, where k is the total number of CR, μ1<μ2<μ3, and the corresponding clusters are named as C1, C2, and C3.
(2)
Repeat until convergence:
{
For each spot radius resultCRi, set CRi∈Cj.
(5)j=argminxCRi−μx2,x=1,2,3.
For eachj, set
(6)μj=∑CRiCardCj,CRi∈Cj.
}
(3)
The denoised laser spot radiusr=μ2, the centroid of C2.Figure7 illustrates the effect of K-means-based result denoising, in which noise in the results that obviously offset from the final results has been eliminated, leaving only blue points in the diagram effective results.Figure 7
K-means-based result denoising.


## 4. Experiment and Analysis

An experimental device is constructed to test the proposed methods. The experimental device is composed of an infinity objective lens (10x, 0.25) and imaging optical path, autofocus optical path and lens driver (0.5μm resolution), laser detection CCD (2/3″, 1360 × 1024, 20 fps), computer, and control system.A serial of experiment is designed and implemented to test the performance of the proposed method. In this experiment, image sharpness-based autofocus method is applied to obtain the focal plane of the objective lens, which is assigned to be the initial position of defocus detection. Then, lens driver is controlled to generate high accuracy displacement at an interval of about 2.5μm, leading to a high accuracy defocus that is much less than the depth of field of the objective lens (at about 3.6 μm). Raw images of the detected laser spot are captured at each defocus, and the radius value of the laser spot is calculated. Then, a relationship between laser spot diameter and defocus value can be obtained.Figure8 proposes a group of raw image data in the experiment. It is necessary to point out that the proposed method also requires high refractive surface as other laser-based methods. When the refractive surface is not flat or the surface is not perpendicular to the optical path, distortions of laser spots will occur. Figure 9 illustrates the curve of the relationship between the laser spot radius and the defocus value. Standard calibration slice and image-based autofocus method are applied to determine the in focus position and the radius of the laser spot at in focus position. The experiment results demonstrate good linear characteristics. The linear sensitivity of the experiment device is about 0.65 pixels/μm. The maximum linearity error is at about 1.46 pixel (about 0.95 μm) with a linear accuracy at about 0.37%. The linearity error distribution is shown in Figure 10, and the average detection error is 0.44 pixels (about 0.3 μm). What is more, the experiment results also propose a good performance (about 0.6 μm detection error), when the defocus is at about zero, which means influences of diffraction effects near the focal position have been effectively weakened. The image processing is implemented on a MATLAB platform, Win7 x64 environment, Intel® Core™ i7-3770 CPU; the average time cost for defocus calculation is about 21.2 ms in 400 tests. That means the proposed method can support 50 cycles of autofocus operation per second, which is much higher than the most CCD frame rate. The performance will be much better if the program is transplanted to C language.Figure 8
Demonstration graph of the variation of the spot images at different defocuses.Figure 9
Experimental results of the relationship between laser spot radius and defocus.Figure 10
Linearity error distribution of experimental results.


## 5. Conclusion

This study proposes a high precision and robust laser-based autofocusing system, in which a biased image plane is applied. Compared to the bisected laser-based autofocusing method, the laser spot used for defocus detecting is circular, since there is no knife edge in the optical path. The proposed method utilizes the radius of the circular laser spot for defocus value measurement, and the distortions and diffractions on the knife edge have been eliminated. Diffraction effects near the focal position which serious influences the autofocus accuracy is significantly weakened as well, because the laser spot has a considerable radius value when the objective is in focus. The relationship between the laser spot radius and defocus value has been presented, which shows that they are linearly correlated with each other when the defocus is small. A laser spot processing algorithm has been also proposed, in which K-means-based denoising is applied. An experimental device has been constructed. The experiment results show that the proposed method proposes good linear characteristics and requires low assembly accuracy, which means low costs and robust performances.



---

*Source: 8542680-2018-05-10.xml*