# Focus Estimation Methods for Use in Industrial SFF Imaging Systems
## 2 Materials and Methods
### Measurement Stand  
The tests were carried out on images recorded on the dedicated stand. It provided repeatable mounting and illumination conditions. The used camera has the On-Semi Python5000 P1 sensor. The sensor parameters most relevant for SFF imaging are shown in Table 1. The used sensor allows image acquisition with a 5.1 MPx resolution. The increased resolution, compared to solutions in the literature, enables imaging with higher measurement resolution and an increased field of view of the vision system. Increasing the camera resolution negatively affects the computation time required for focus assessment and processing into a point cloud. The selected sensor has a pixel size of 4.8 \(\mu\)m. The pixel size affects the depth of field of the optical system, which should be kept as small as possible in the intended application. The global shutter allows moving objects to be imaged without the image distortion typical of rolling shutter apertures. The sensor can acquire images at more than 50 frames per second (FPS). The bandwidth of the camera communication interface limits the image acquisition frequency to 22 FPS. The sensor with the chosen parameters has a diagonal dimension of 1\({}^{\prime\prime}\). This allows the use of c-mount lenses without the occurrence of the negative vignetting phenomenon. A liquid lens was used to collect a stack of images recorded at different positions of the image plane. The operating principle of the lens is presented in Figure 4. Changing the image plane position is performed by changing the focusing power of the lens \(P\). This is the equivalent of changing the lens focal length (\(f\)). The distance between the lens and the sensor (\(v\)) remains constant. In order to obtain an in-focus image of the element, it is necessary to position the imaging plane on the element. When imaging a plane distant from the vision system by \(u\), it is necessary to adjust the focusing power of the optical system to a value of \(P\) according to the formula:  
\[P=\frac{1}{f}=\frac{1}{u}+\frac{1}{v} \tag{1}\]  
Figure 4a shows the layout after aligning the image plane with the green arrow (\(u=u_{1}\)). The green arrow will be captured on the sensor in focus. The red arrow, on the other hand, will be significantly blurred in the image. The tipping point of the arrow is \begin{table}
\begin{tabular}{l c} \hline \hline
**Sensor Parameter** & **Value** \\ \hline Pixel Size & 4.8 \(\mu\)m \\ Resolution & 2592 \(\times\) 2048 \\ Shutter type & Global \\ Max. FPS & 51.8 FPS \\ Sensor size & 1\({}^{\prime\prime}\) \\ \hline \hline \end{tabular}
\end{table} 
Table 1: List of camera sensor parameters. Figure 3: Image of the surfaces used taken with a dome light illuminator: (**a**) metallic surface, (**b**) plastic surface, (**c**) wooden surface. being focused before the camera sensor. In the digital image, the red arrow tip will be blurred on the surface of a circle of confusion with diameter \(\varepsilon_{1}\). A focused image of the red arrow is obtained by changing the optical power of the lens (\(f=f_{2}\)). This causes a change in the position of the image plane (\(u=u_{2}\)). In this case, the green arrow becomes blurred (Figure 4b). The green arrow tip is focused behind the sensor. As a result, it is projected onto the sensor surface as a circle of confusion with diameter \(\varepsilon_{2}\). An EL-16-40-TC liquid lens was used to control the optical power of the optical system. The used lens allows the optical power to vary by \(\pm 3\) D.  
A fixed focal length lens was also used in the optical system. The parameters of the lens are listed in the Table 2. The lens was selected to reduce the depth of field. A fujinon HF50 XA-5M lens was selected with a focal length of 50 mm. The lens brightness was set manually to F#2.4. The fixed focal length lens has a minimum object distance of 200 mm, but when combined with the tunable liquid lens, this value was reduced to 50 mm. The system is designed for use with sensors up to 1.1\({}^{\prime\prime}\), so it is compatible with the used camera.