#### Abstract

Microscope vision analysis is applied in many fields. The traditional way is to use the human eye to observe and manually focus to obtain the image of the observed object. However, with the observation object becoming more and more subtle, the magnification of the microscope is required to be larger and larger. The method of manual focusing cannot guarantee the best focusing position of the microscope in use. Therefore, in this paper, we are studying the existing autofocusing technology and the autofocusing method of microscope based on image processing, which is different from the traditional manual focusing method. The autofocusing method of microscope based on image processing does not need the information such as the target position and the focal length of optical system, to directly focus the collected image. First of all, in order to solve the problem of large computation and difficult real time of traditional wavelet based image sharpness evaluation algorithm, this paper proposes an improved wavelet based image sharpness evaluation algorithm; secondly, in view of the situation that the window selected by traditional focusing window selection method is fixed, this paper adopts an adaptive focusing window selection method to increase the focusing window. Finally, this paper studies the extremum search strategy. In order to avoid the interference of the local extremum in the focusing curve, this paper proposes an improved hill-climbing algorithm to achieve the accuracy of focusing search. The simulation results show that the improved wavelet transform image definition evaluation algorithm can improve the definition evaluation performance, and the improved mountain climbing algorithm can reduce the impact of local extremum and improve the accuracy of the search algorithm. All in all, it can be concluded that the method based on image processing proposed in this paper has a good focusing effect, which can meet the needs of anti-interference and extreme value search of microscope autofocus.

#### 1. Introduction

Optical microscope [1, 2] plays an important role in human observation and understanding of the micro world. In recent years, with the continuous improvement of computer processing ability and the development of microimaging technology, the computer vision automatic detection system of optical microscope, which is built by computer, micro camera, and optical microscope, has been widely used in various fields, including military, medicine, and biology. The development of this automatic detection system can greatly reduce the workload, improve the detection efficiency and accuracy, and save a lot of time. In the automatic detection system of computer vision, it is one of the key technologies to realize the automatic focusing of microscope [3]. Autofocus refers to the process in which the system automatically adjusts the mechanical structure (image distance or object distance) to make the image clear again when the image is blurred due to defocusing. It is a common task for all the subjects applying computer vision automatic detection system to realize the good autofocusing performance of optical microscope. The traditional autofocus technology is studied from the perspective of focal length measurement, and the new computer-controlled microscope autofocus based on image processing is a multidisciplinary comprehensive application combining machine vision, image processing, optimization theory, and electromechanical technology. Automatic focusing method based on image technology directly applies related image processing technology to the focusing image captured by the camera, analyzes the image quality, obtains the current focusing state of the system, and then drives the mechanism to adjust the focal length to achieve automatic focusing [4].

With the development of camera, autofocus has appeared formally. It has a history of hundreds of years. It is widely used in traditional cameras, but now it is more popular in digital cameras, and autofocus technology is more widely used. Because digital cameras are almost all digital, especially the use of high-performance microprocessors, the autofocus function is easier to be embedded, which makes the development of autofocus technology more rapid. On cameras with a higher level, autofocus has become a technical indicator. The traditional autofocus technology includes trigonometric ranging method [5], infrared ranging method [6], and ultrasonic ranging method [7]. The main function of the traditional autofocus method is to measure the distance between the object to be measured and the sensitive element. Then, the measured distance is substituted into the optical Gauss formula to calculate the object distance, and then the lens is quickly moved to the best object distance according to the calculated object distance. With the development of technology, ranging focusing mode is not suitable for short-range focusing because of the large instruments. Since the 1990s, with the rapid development of image sensor technology such as CCD and CMOS and image processing technology [8], the focusing technology based on image processing has developed rapidly. Although the research time of focusing technology based on image processing is relatively short, with the expansion of the application scope of focusing technology based on image processing, great progress has been made in the assembly of micro parts, cell operation, integrated circuit assembly, etc.

Automatic focusing based on image processing is to process the sequence image collected by image sensor in real time, obtain the evaluation value that can represent the image clarity, judge whether the image is clear according to the evaluation value, and give the corresponding feedback signal to drive the motor to control the lens movement until the clearest image is obtained and complete the automatic focusing. It can be seen from the above discussion that the key of autofocus technology based on image processing is to obtain the evaluation value of image clarity, so the definition evaluation function is the key research object of autofocus technology based on image processing [9]. The selection of focusing window and focusing search strategy are also important factors that affect the effectiveness of autofocusing. People have done a lot of research on these two aspects. Autofocusing based on image processing has its own characteristics: First, the selection of focusing criteria is flexible and diverse. In digital image processing, there are many methods to describe and extract image features, so autofocusing based on image processing can select different focusing criteria according to the needs of the imaging system, which is conducive to improving the intelligence of focusing. Second, the driving circuit and moving mechanism of the autofocus system are greatly simplified, which is easy to control the speed of focus and is conducive to the improvement of real-time performance. In addition, because the automatic focusing based on image processing is judged according to the characteristics of the acquired image, compared with the traditional focusing mode, without additional auxiliary equipment, it can reduce the cost, more conducive to the integration and miniaturization of the module, and has a wide application prospect. In this paper, the microscope autofocus method based on image processing is of great significance to the development of microscope and medicine.

Based on the above background, this article uses image processing technology to achieve automatic focusing of the microscope. Unlike traditional methods, microscope autofocus technology based on image processing can directly collect images for autofocusing. The selected focusing standards are flexible and diverse, simplifying the structure of the focusing system and improving the real-time focusing of the microscope. In this method, we improved and optimized the image sharpness evaluation algorithm and the autofocus extreme value search algorithm, which are the most important part of the microscope autofocus technology based on image processing, and designed a more effective microscope-based. The autofocus method is in image processing. Aiming at the shortcomings of traditional wavelet transform image definition evaluation algorithms, this algorithm proposes an improved wavelet transform image definition evaluation algorithm, which can well improve the disadvantages of traditional methods that are large in calculation and difficult to realize. In addition, in view of the fact that the window selected by the traditional focus window selection method is fixed, this paper adopts the adaptive focus window selection method to increase the versatility of the focus window selection. In order to avoid the interference of the local extremum on the focus curve on the autofocus, an improved climbing algorithm is proposed to realize the precise search of the microscope autofocus. The simulation results show that this method has a good effect in the field of microscope autofocus and can meet the needs of microscope autofocus [10].

#### 2. Principle and Method of Autofocus

##### 2.1. Basic Principle of Autofocus

In the early imaging systems, most of them use manual way to complete the focusing process. Manual focusing depends on the subjective judgment of human beings, so it cannot guarantee the accuracy of focusing, and the efficiency of focusing is low, which cannot meet the requirements of optical imaging system to capture instant pictures. In the late 1960s, with the rapid development of microelectronics technology, focusing can be automatically completed by computer or intelligent chip control, which is called autofocusing. Good autofocusing control strategy can meet the requirements of modern optical imaging system for focusing accuracy and speed.

Simply put, the principle of autofocusing is that the image detector receives the reflected light from the object and converts it into the corresponding signal and then processes it through the intelligent chip or computer according to a certain algorithm to drive the focusing device to adjust the optical system to complete the focusing process. An autofocus system mainly has two function modules, analysis module and control module. The analysis module determines whether to focus by analyzing the input image. If it is defocused, the defocusing degree of the image is calculated, and the relevant information is provided for the control module. The control module adjusts the lens through the driving device, so that the image is in the focusing state. This article looks at the principle of autofocus to see if it can be used on a microscope.

##### 2.2. Autofocusing Method Based on Image Processing

###### 2.2.1. Depth from Defocus

Depth from Defocus (DFD) method [11–13] is a method to obtain the depth information of the focus target through the defocused image so as to complete the autofocus. DFD method needs to obtain 2-3 frames of images with different defocusing degrees. Through the analysis and processing of the local area of the image, the fuzzy degree and defocusing depth information of the image is obtained, and then the focus position is determined, the lens motion is continuously driven, and the autofocus is completed. There are two main DFD methods: one is based on image restoration. In this method, the point spread function of the imaging system is estimated by some information, which can represent the important features of the image, and then the original image of the image is restored by the inversion of the image degradation model. This method needs to get representative information in the image, which is not effective for any target, and has limitations. The other is based on fuzzy analysis, which is obtained by analyzing the size of fuzzy circle. This method analyzes and processes 2-3 frames of images obtained under different lens imaging parameters and determines the relationship between the size of blur circle and lens imaging parameters according to the principle of geometric optics and finds the focus position. In this method, the size of fuzzy circle is in pixels, and rounding error will be introduced.

DFD method only needs 2-3 frames of images with different defocusing degrees to complete autofocusing, greatly reducing the amount of image acquisition and the time required to drive the motor, so it has a faster focusing speed. In order to use DFD method to focus, it is necessary to know all kinds of parameters of the imaging system and establish the mathematical model of the imaging system in advance, so as to calculate the defocusing depth and judge the focusing position according to a small number of images. However, in practical application, the mathematical model of the imaging system cannot be accurately determined in theory, and a small number of images are used with less information, so DFD method may lead to large focusing error and its accuracy and stability. At present, DFD method is still in theoretical research and experimental application.

###### 2.2.2. Depth from Focus

Depth from Focus (DFF) [14–16] method is an autofocusing method based on focusing search mechanism. DFF method uses a certain definition evaluation function to calculate the definition evaluation function values (evaluation values) of images with different defocusing degrees. According to the characteristics of the maximum image evaluation value when focusing accurately, the focusing search algorithm is used to control the lens to move towards the direction with the maximum evaluation value until the accurate focusing position is found. The theoretical premise of DFF method is that the curve of autofocusing evaluation function is unimodal, and the focusing curve is strictly monotonous on both sides of the peak value. The position where the peak value is obtained is the focusing position, and the image of this position is the clearest. In order to obtain the focusing position, the focusing curve should be unimodal and monotonic, so the interference of noise should be minimized; otherwise the local extremum caused by noise will affect the reliability of focusing and even lead to focusing failure. The above method provides a theoretical basis for the autofocus method in this article.

The analysis module analyzes and evaluates the defocusing degree of the target image, and the control module adjusts the lens position according to the relevant information provided by the analysis and evaluation module until the target image on the image detector is the clearest and finally stores and outputs the clear image.

#### 3. Method of Autofocusing Microscope

##### 3.1. Image Definition Evaluation Method

In the research of image definition evaluation method, this paper designs image definition evaluation method based on lifting wavelet transform, aiming at the problems of traditional wavelet transform, such as large computation and being difficult to realize. Compared with the traditional wavelet transform, the lifting wavelet transform has the following advantages: (1) It has all the advantages of the first generation of wavelet. (2) It completely gets rid of the Fourier transform, abandons the conditions of binary translation and expansion, and completes the construction of wavelet function in the time domain. (3) It improves the speed of wavelet transform, and the operation speed tends to be twice that of traditional wavelet transform. (4) Standard operation, which takes up less memory, can save storage resources [17].

The wavelet lifting scheme realizes the separation of high- and low-frequency signals through three steps: splitting, prediction, and updating.(1)Split In the splitting process, the original signal is divided into two subsets, which are usually split by parity. The even set contains the values of all even positions of the original signal, and the odd set contains the values of all odd positions of the original signal, as shown in(2)Predict Because of the correlation between the data, the even part can be used to predict the odd part. In the prediction process, is used as the prediction value of odd sequence, and then the difference between the actual value and the prediction value of odd sequence is calculated to get the residual signal , which corresponds to the high-frequency part of the original signal after wavelet transform, as shown in the following formula:(3)Update Some properties of the split subset are different from the original signal, so it needs to be updated. In the update process, the update operator acts on the residual signal obtained in the prediction process to generate a subset consistent with the original data, as shown in the following formula: In the formula, corresponds to the low-frequency part after wavelet transform; is the update operator. If multilevel wavelet transform is needed, repeat the above steps for .

The process of improving wavelet transform is as follows: Firstly, line transform is carried out, the image is temporarily divided into two bands, the left band is low-frequency band, and the right band is high-frequency band. Then, the two frequency bands are transformed in columns, and the image is divided into four frequency bands: one low-frequency subband (upper left corner) and three high-frequency subbands (upper right corner), (lower left corner), and (lower right corner). , , and , respectively, correspond to the high-frequency components in horizontal, vertical and diagonal directions after the first level lifting wavelet decomposition. Repeat the above process for to realize the two-level decomposition of lifting wavelet transform. One low-frequency subband () and three high-frequency subbands (, , and ) can be obtained.

Using the energy of high-frequency coefficients of wavelet transform to construct image definition evaluation function is one of the commonly used methods. From this point of view, this paper designs the definition evaluation function based on lifting wavelet transform. It can be seen from the above introduction that the larger the defocusing amount, the more blurred the image, the more serious the loss of image details, and the less the corresponding high-frequency components. Because of the energy invariability of orthogonal wavelet transform, the energy of the high-frequency coefficient corresponding to the focus image is large, and the energy of the high-frequency coefficient corresponding to the defocused image is small, while the energy of the low-frequency coefficient is opposite. Therefore, the definition evaluation function combining the characteristics of the two changes is proposed as follows:

In the above formula, and are the high-frequency subbands after level wavelet decomposition and represents the low-frequency subbands after level wavelet decomposition.

##### 3.2. Selection Method of the Focusing Window

In order to adaptively select the target image as the focusing window, the best segmentation threshold of the target and background is obtained according to some image segmentation algorithm, and the binary image is obtained by using the threshold segmentation; then the edge is extracted and the “center of gravity” of the edge image is calculated, and the area with rich edge is obtained as the focusing window. In this paper, the criterion of maximum variance between classes is used to get the best segmentation threshold of target and background, and the fast searching ability of genetic algorithm is used to search the global best segmentation threshold. Using these two methods can reduce the error.

###### 3.2.1. Maximum Variance between Classes’ Criteria

The total number of pixels of is , the gray level is , the total number of pixels with the gray value of , and the probability of their occurrence is and , respectively,

Suppose that the gray value is the threshold value of target and background segmentation; then the gray value range of background area is , and the gray value range of target area is , and the proportion of the two is, respectively,

If the average gray value of the image is , then can be obtained from the average gray value of the background area and the average gray value of the target area, that is, . According to the definition of variance, the variance between the two groups is obtained as follows:

with the maximum value of is the best segmentation threshold of target and background.

###### 3.2.2. Genetic Algorithm

The essence of genetic algorithm (GA) [18–20] is to simulate the evolution process of nature. In the evolution process of nature, species must compete with other species in order to survive and reproduce, and excellent populations will survive to adapt to the changes of environment. GA combines the survival rules of the fittest in nature with the random information exchange system of the chromosome in the population and gives full play to the advantages of the survival of the fittest. It is a highly parallel, random, and adaptive global optimization search algorithm. It has strong robustness and global search ability, can improve the image search ability of autofocus, and is easy to combine other algorithms. In addition, it also includes the most important concept: fitness function. The fitness function is determined by the goal of the problem. The fitness value represents the reproduction probability of each individual. The larger its value is, the better the individual is and, on the contrary, the worse the individual is. The main process is as follows:(1)*Chromosome Coding*. The genetic object of genetic algorithm is gene string, so it is necessary to encode the data of problem decision space into gene string structure data. For individuals, the coding can be binary or real. Binary encoding is used in GA.(2)*Generation of Initial Population*. The operation of genetic algorithm is population operation, which needs to generate initial population randomly before genetic operation. According to the coding mode of chromosomes, chromosomes are randomly generated, each chromosome represents an individual, and GA iteratively evolves with the initial data of this individual.(3)*Fitness Evaluation*. Fitness is an important data to evaluate the quality of individuals and guide the genetic operation smoothly.(4)*Genetic Manipulation, Including Selection, Crossover, and Variation*. Among them, the selection operation is replication, according to the size of fitness value to select the individuals who enter the cross-mutation operation. The crossover operation will make two individuals selected from the population exchange part of genes with a larger crossover probability according to single-point consistent crossover or other crossover strategies and produces offspring; the mutation operation will make some genes of individuals mutate according to a certain mutation probability (generally small), and the gene in GA will mutate into its allele.(5)*Termination Conditions*. The condition of the end of genetic operation cycle in GA is to set the maximum evolution algebra or to converge to the required precision.

###### 3.2.3. Adaptive Focusing Window Selection

(1)Set the relevant parameters of genetic algorithm, and take the maximum as the fitness function.(2)The evaluation fitness function values are calculated and sorted.(3)After the cross mutation, the historical optimal individuals and the current optimal individuals of the population are preserved, and the population is updated.(4)Termination algorithm: when the maximum number of iterations or the optimal individual remains unchanged for a long time, it indicates that the optimal individual has been found, and stop searching; otherwise return to step (2).(5)According to the best segmentation threshold obtained by searching, the original image is segmented to get the binary image, and then the edge image is obtained by edge extraction. The “center of gravity” of the edge image is calculated by equation (8), and the size area is taken as the focusing window with this point as the center. In this paper, , , and and represent the numbers of rows and columns of the image, respectively, and the symbol represents rounding.When the image contains noise or the gray edge of the image is not uniform, the location of the “center of gravity” of the image will deviate. Therefore, before calculating the “center of gravity” of the image, the edge image can be divided into several size areas. If the number of edge points in the area is less than the number of global average edge points, the gray value of the pixels in the area is set to 0 to eliminate the influence of individual edge points or noise points on the “center of gravity” of the calculated image.

##### 3.3. Extreme Search Strategy

###### 3.3.1. Mountain Climbing Search Algorithm

The ideal focusing function curve is approximately parabola shape, the peak value corresponds to the best imaging position, and the curve on both sides of the peak point is monotonous. The specific process of mountain climbing search algorithm is as follows.

The stepper motor drives the lens to move forward in equal steps from left to right. In each step, one frame of image is collected and the sharpness of the image is calculated. If the sharpness of the current image is greater than that of the previous frame, it is considered that the lens has been moving towards the focus direction. When the sharpness of the image decreases for the first time, it is considered that the lens has passed the focus position. At this time, the motor reverses, the step size becomes smaller, and the lens is driven to move to the left. Similarly, when the image clarity is reduced again, it means that the lens can cross the peak position. When the motor reverses at this time, the step size decreases compared with the last time, and the driving lens moves to the right so repeatedly until the step size is less than a certain limit value.

In theory, the mountain climbing search algorithm is an ideal extremum search strategy. However, in practical application, the focus function curve changes smoothly in the area far away from the quasi-focus position, and the motor will run for a long time in these areas. Moreover, only through the comparison of the clarity of the two images before and after can it judge the focus direction, which is easy to be interfered by the local extremum, causing misfocus. In addition, in the hill climbing search algorithm, the motor frequently changes direction, which affects the service life of the focusing mechanism.

###### 3.3.2. The Improvement of Mountain Climbing Search Algorithm

The main factors that affect the search process are image data acquisition, processing, and motor operation. In contrast, the operation time of motor is much longer than that of image acquisition and processing. Therefore, a good search algorithm should minimize redundant motor motion. Considering the focusing speed and accuracy of the system, this paper explores an optimized hill-climbing search algorithm. Firstly, the algorithm traverses the whole focusing stroke and determines the fine-tuning interval. Then, the hill-climbing algorithm is used to search for the best imaging position in the fine-tuning interval.(1)Large step traversal: set a large step as the driving wheel rotates a circle, the motor drives the lens to start from the starting position, and the large step traverses the whole focusing stroke. In each step of the lens, a frame of image is collected to calculate the definition of the current image. After traversing the whole process, the maximum value of focusing evaluation function and lens position can be obtained.(2)The motor drives the lens to move in reverse direction and brings the lens back to the previous sampling point at the maximum value of the focusing evaluation function, which is the starting point of the fine-tuning interval.(3)Small step climbing search in fine-tuning section: at the starting point of fine-tuning section, the motor driving lens rotates a tooth with the minimum step, that is, the driving wheel, and the climbing method is used to search the quasi-focus position. When four evaluation function values decrease continuously, the curve is determined to be the descending direction. It indicates that the focus position has been crossed. At this time, the motor reverses and drives the lens to move to the position of the first point among the four consecutive descent points, which is the best focus position.

#### 4. Results and Discussion

In the research of automatic focusing method of microscope based on image processing, the three key technologies are image definition evaluation method, focusing window selection, and search strategy. Therefore, this paper puts forward corresponding improvements for the problems of the three technologies. Firstly, in the image definition evaluation method, aiming at the problem that the traditional image definition evaluation algorithm based on wavelet transform has a large amount of computation and is difficult to realize, this paper proposes an improved image definition evaluation algorithm based on wavelet transform. In order to verify the performance of the articulation evaluation algorithm proposed in this paper, the present algorithm of focusing image sharpness evaluation is compared with that of the algorithm. The algorithm of image sharpness evaluation includes the algorithm of image sharpness evaluation based on wavelet transform, Brenner evaluation function, and Tenengrad evaluation function. Four evaluation algorithms are compared and analyzed under the background of noise, and the comparison results are shown in Figure 1. It can be seen from Figure 1 that the curve of the image definition evaluation algorithm proposed in this paper is the sharpest. The sharpness can reflect the sharpness of the image, and the side lobe value is far lower than the other three methods, which shows that the algorithm in this paper has the best sharpness, which shows that, under the background of noise, the algorithm in this paper has better definition evaluation performance and better anti-noise performance and sensitivity.

In order to further illustrate the effect of the improved wavelet transform, this paper compares the performance of the improved image definition evaluation algorithm with and without noise, and the results are shown in Figure 2. It can be seen from the figure that, in the background of no noise, the improvement effect of wavelet transform in this paper is not obvious, and there is no obvious advantage. With the addition of noise, whether the wavelet transform is improved or not, the curves of both have a certain degree of floating up, but, in this paper, the curve floating up degree of the improved algorithm of wavelet transform is not high, the side lobe value rising is not serious, and the traditional wavelet transform floating up degree is more serious; the side lobe value rising is far more than the improved algorithm. This phenomenon shows that the improvement of wavelet transform in this paper can improve the antinoise performance of the algorithm, which is conducive to its application in image definition evaluation. Furthermore, it can be effectively used in autofocusing microscopes.

In the research of automatic focusing algorithm of microscope, aiming at the problem of focusing window selection, this paper proposes an adaptive focusing window selection algorithm, which is used to select focusing window. In order to illustrate the performance of the focusing window selection algorithm designed in this paper, the window selection algorithm designed in this paper is compared with the method of selecting the whole image as a window, and the comparison evaluation curve is shown in Figure 3. It can be seen from the figure that the performance difference between the selection algorithm designed in this paper and the method of selecting the whole image as a window is not significant under the background of no noise. The method designed in this paper is slightly better than the method of selecting the whole image as a window. With the introduction of Gaussian noise, the performance of the method with the whole image as the window drops sharply, and the evaluation curve floats up seriously. However, the floatation degree of the method in this paper is far lower than that of the method with the whole image as the window. This is because the method used in this paper is to replace the whole image with a small area to evaluate the sharpness of the image, which reduces the amount of calculation and can well select the area with less noise interference, so as to effectively suppress the interference of noise on the evaluation of image sharpness.

In order to illustrate the application effect of the algorithm in the focus accuracy and time efficiency of the microscope autofocus, this paper uses the microscope to observe and collect the forehead mouse cells and uses the algorithm designed in this paper to realize the automatic focusing of microscope. After the focusing is completed, professionals are invited to judge the accuracy of the automatic focusing. In 50 automatic focusing experiments, the accuracy and time consumption of the automatic focusing of microscope are shown in Figure 4. It can be seen from the figure that the accuracy of the automatic focusing algorithm of microscope based on image processing designed in this paper is over 87%. In 50 observation cells, the lowest accuracy is 87.6% and the highest is 91.3%. In the time efficiency analysis, the time consumption of the algorithm in this paper is less than 44 ms, 43.3 ms at most, and 36.5 ms at least. These results can show that the algorithm designed in this paper has good accuracy and real time, which can meet the research needs of medical personnel.

#### 5. Conclusions

Nowadays, the application of microscope is more and more extensive, especially in the field of medicine, which brings about great convenience to the research of medical personnel. But, in the process of microscope observation, medical personnel used to focus manually according to their own experience. This method of focusing tests the professional ability of medical personnel and is difficult to achieve the best focusing position quickly and accurately. Therefore, an automatic focusing technology of microscope plays an important role for medical researchers. Consequently, based on the advantages of image processing, this paper studies an automatic focusing method of microscope based on image processing. In the research, this paper focuses on three aspects of image definition evaluation algorithm, focusing window selection, and search strategy. Aiming at the problems of traditional methods, corresponding improvements are proposed, including improved wavelet transform image definition evaluation algorithm, adaptive focusing window selection method, and improved hill-climbing algorithm search strategy, which realizes the automatic focusing of microscope. In the simulation analysis, this paper analyzes the performance of the improved wavelet transform image definition evaluation algorithm. The evaluation curve results show that the improved wavelet transform image definition evaluation algorithm has better sensitivity and antinoise performance than before. In the further analysis of the performance of the adaptive focusing window selection method, the results also show that the adaptive focusing window selection method designed in this paper can effectively suppress the interference of noise on image definition evaluation. Finally, this paper analyzes the accuracy and timeliness of the designed automatic focusing method of microscope. The results show that the automatic focusing method designed in this paper has good accuracy and timeliness, which can meet the needs of medical personnel in the research of microscope application. Although the research in this article does not have a deep understanding of image processing technology, the research results in this article still have strong practical significance for the future of microscope field.

#### Data Availability

The data that support the findings of this study are available from the corresponding author upon reasonable request.

#### Conflicts of Interest

The authors declare that they have no conflicts of interest.

#### Acknowledgments

This work was supported by the Fundamental Research Funds for the Central Universities, fund project: Science and Technology Project of Wuzhou Science and Technology Bureau in 2019 (201902039); Wuzhou High-Tech Zone and Wuzhou University’s Industry-Academia-Research Project in 2019 (20190007); 2019 University Level Key Educational Reform Project of Wuzhou University (Wyjg2019A017); 2017 National Natural Science Foundation of China (51765060); and 2016 Guangxi Natural Science Foundation of China (2016GXNSFAA380321).