Keywords

1 Introduction

Automatic image focusing technology is very important in digital image processing. If the level of automatic image focusing technology is low, the function of digital image processing system will also be greatly reduced. Only by improving the sensitivity of automatic image focusing technology, reducing its complexity and dispersion, can it really play the role of digital image processing system.

2 Principle of Automatic Image Focusing for Digital Image Processing

  1. (i)

    Principle of imaging

    Although automatic image focusing technology is advanced, its imaging principle is basically the same as that of convex lens imaging. The formula of convex lens imaging principle is as follows:

    $$\frac{1}{u}+\frac{1}{v}=\frac{1}{f}$$
    (1)

    The meaning of each index in formula (1) is as follows: the meaning of u is the distance between convex lens and object; the meaning of v is the distance between convex lens and imaging plane; the meaning of f is the focal length of convex lens. According to the principle of convex lens imaging, the convex lens imaging model can be obtained as shown in Fig. 1:

    Figure 1 u, v, f, D, p, R refer to object distance, image distance, focus, convex lens diameter, object position, imaging radius, respectively. When the digital image processing system defocuss, the distance between the imaging and the convex lens will gradually decrease from s to v, object imaging will leave a fuzzy image on the image detector. The distance between the focus plane and the convex lens is s-v.. The distance between the focus plane and the convex lens is If the value of the s-v continues to increase, the image on the image detector will be more blurred. According to the similar triangles in Fig. 1, the imaging scaling factor formula can be obtained as follows:

    $$q=\frac{2R}{D}=\frac{s-v}{v}=(\frac{1}{v}-\frac{1}{s})$$
    (2)

    Formula (2) q refers to the imaging scaling factor. The following formula can be obtained from the convex lens imaging formula and the imaging scaling factor formula:

    $$R=q\frac{D}{2}=S\frac{D}{2}(\frac{1}{f}-\frac{1}{u}-\frac{1}{s})$$
    (3)

    The formula (3) shows that when the q > is 0 and s > v, the imaging surface is Rs > v 0, and when the Rs > vq > is 0 and Rs > vq > q > v, the imaging surface is 0, and the imaging surface is in front of the positive focus position. Therefore, digital image processing can realize auto-focusing according to formula (3) principle [1].

    Fig. 1.
    figure 1

    Image model of convex lens

  2. (ii)

    Principle of focusing

    The development process of digital image processing is divided into two stages. The first stage mainly adopts the traditional image automatic focusing system, and the second stage mainly adopts the automatic image focusing system. The traditional image automatic focusing principle first adjusts the lens to include the target and then enters the PC machine or embedded system by the CCD/CMOS camera. The embedded system determines whether the lens is readjusted through the motor control module according to the image definition. The auto-image focusing system is divided into two situations: focusing depth and defocusing depth. In focusing depth, the search algorithm is used to focus, then the image processing module is used to determine whether the image is clear or not. Finally, the defocusing depth is calculated by collecting defocusing image parameter information or defocusing image degradation model and fuzzy graphics. Finally, the image definition can be adjusted to the best [2].

3 Evaluation Function of Automatic Image Focusing for Digital Image Processing

  1. (i)

    Information entropy function for images

    The formula of image information entropy function is as follows:

    $$F=-\sum {p}_{i}{log}_{b}\left(pi\right)$$
    (4)

    The meaning of each index in formula (4) is as follows: the meaning of pi is the probability of characterizing information; the value of b is 2. In digital image processing, the gray level of auto-focusing image is independent, so the probability of representation information of each gray value is different. Based on this, the probability of gray value in gray histogram can be calculated [3].

  2. (ii)

    Grayscale gradient function

    The change of gray scale fluctuation and absolute change of gray scale have a certain function relation with the gray value of a certain point in the image and the pixel of image scale, while the gradient vector mode square function is also related to the change of gray scale fluctuation and absolute change of gray scale. Therefore, the gray gradient vector mode function can be obtained according to gray fluctuation and absolute change:

    $$F=\sum_{x}^{M}\sum_{y}^{N}{\left\{{\left[g\left(x+1,y\right)-g\left(x,y\right)\right]}^{2}+{\left[g\left(x,y+1\right)-g\left(x,y\right)\right]}^{2}\right\}}^{1/2}$$
    (5)

    The meaning of each index in formula (5) is as follows: the meaning of M*N is image scale pixel;(x,y) is a point in image; the meaning of g (x,y) is the gray value of a point in image.

  3. (iii)

    Frequency domain evaluation function

    Based on Fourier transform, the frequency domain evaluation function can be obtained as follows:

    $$F=\sum_{X}^{M}\sum_{Y}^{N}\left(\sum_{X}^{M}\sum_{Y}^{N}g\left(x,y\right){W}_{MN}^{xyXY}\right)-\varphi $$
    (6)

    After comparing the sensitivity, precision, deviation, complexity, signal-to-noise ratio, time and other parameters of each function, the following conclusions can be obtained: the image information entropy function has long focus time, poor focus position, short focus time, high focus dispersion, and strong focus sensitivity of frequency domain evaluation function. Therefore, the most suitable function for automatic focusing of digital image processing is the frequency domain evaluation function, but the function obtained from Fourier transform is not good in terms of the complexity of the function. Frequency domain evaluation functions need to be further optimized or explored for other functions, such as wavelet analysis, which are also obtained by Fourier transform.

4 Area Selection and Focus Search Algorithm for Digital Image Processing Window

The deeper the depth of field and focal depth of the digital image processing window, the more blurred the image is, the larger the depth of field of the camera window is, the smaller the aperture is, the distance, focusing parameters and imaging clarity will be affected [4].

  1. 1.

    Blind Mountain Climbing Algorithm

    The principle of blind mountain climbing algorithm is to judge the position of mountain peak during mountain climbing, which can determine the best focus position of image definition. The algorithm can optimize the automatic image focusing evaluation function of digital image processing, improve the image focusing speed and reduce the deviation of focusing imaging.

  2. 2.

    curve fitting algorithm

    The principle of curve fitting algorithm is to synthesize the original complex curve function into the simplest clustering evaluation function by simple function, and then the extreme point of the original curve function can be obtained by the extreme point of the near fitting function. The algorithm can improve the accuracy of the image, but it has certain requirements for the maximum value of the image data [5].

  3. 3.

    Fibonacci Search Algorithm

    Fibonacci search algorithm is a search algorithm, which can use the hypothesis principle to analyze the most suitable points in the process of auto-focusing, and then determine the best auto-focusing interval by theoretical calculation. Although the algorithm can improve the focusing speed, it is easy to appear larger focusing deviation in the process of moving direction change.

5 Conclusion

Accuracy is one of the criteria for evaluating whether the automatic image focusing evaluation function conforms to the digital image processing. If the imaging image is fuzzy, the minimum gradient value can be adjusted according to the numerical change of gradient value. This can reduce the impact of minimum gradient image definition and improve the accuracy of evaluation function.

Signal-to-noise ratio (SNR) represents the anti-noise interference ability of digital image processing auto-focusing algorithm, and the increase of SNR can reduce the probability of auto-focusing algorithm. Therefore, the image processing can directly take out most of the gradient values, and then use a simple algorithm to bring them into the gradient matrix to calculate, so that the SNR can be improved.

Conclusion: To sum up, this paper mainly analyzes and compares the image information entropy function, gray gradient function, frequency domain evaluation function, other evaluation functions and other digital image processing automatic image focusing algorithms. The image information entropy function has the disadvantages of inaccurate focus position and long focus time. Therefore, the image information entropy function and gray gradient function are not suitable for the automatic image focusing algorithm of digital image processing. Although the frequency domain evaluation function has some advantages, there are still some shortcomings in the automatic focusing time. These digital image processing automatic image focusing evaluation functions can be further improved.