Image auto-focusing method and focusing device

By employing an adaptive image autofocus method, combined with a sharpness evaluation function and a modified LAPV function, the problem of focal length variation caused by material deformation in microscopic DIC experiments was solved, thereby improving measurement accuracy and focusing precision.

CN120529178BActive Publication Date: 2026-02-27DONGGUAN UNIV OF TECH
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510965662.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-14
Publication Date
2026-02-27
Estimated Expiration
2045-07-14

AI Technical Summary

Technical Problem

In microscopic DIC experiments on small-scale samples, material deformation causes changes in the focal length between the lens and the sample surface, resulting in microscope defocusing and affecting measurement accuracy.

Method used

An adaptive image autofocus method is adopted, including coarse focusing and fine focusing. The image sharpness score is calculated through a sharpness evaluation function. The focus area is dynamically adjusted by combining global search and function approximation methods. A modified LAPV evaluation function is used to evaluate sharpness.

Benefits of technology

It effectively avoids focal length changes caused by material deformation, improves the measurement accuracy and focusing accuracy of the microscope, adapts to changes in target position, and reduces the risk of focusing failure.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120529178B_ABST
    Figure CN120529178B_ABST
Patent Text Reader

Abstract

The application belongs to the technical field of material detection, and provides an image automatic focusing method and a focusing device, which comprises coarse focusing and fine focusing.The coarse focusing is as follows: moving in the direction of approaching the material at a first speed from a position far from the material, taking a plurality of images in real time at a fixed frame rate, calculating the definition score of each image, taking the definition score of the image as a temporary extreme value, and ending the coarse focusing until the definition score of the acquired image is lower than a threshold value.The fine focusing is as follows: moving from above the shooting position corresponding to the temporary extreme value at a second speed and taking a plurality of images in real time at a fixed frame rate, calculating the definition score of each image, fitting all the definition scores with a function, and calculating the maximum extreme value of the function, wherein the coordinate corresponding to the maximum extreme value is the accurate focusing point.The application can avoid the change of focal length caused by material deformation, avoid the defocus of the microscope, make the collected image clear, and improve the measurement accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of material detection, and provides an image automatic focusing method and a focusing device. BACKGROUND

[0002] Currently, the non-contact optical measurement method used in the field of measuring material deformation is mainly the DIC technology, i.e., the digital image correlation method. The basic principle of the DIC method is to match nodes through image gray information, and the image gray information depends on the speckle pattern of the measured surface. The randomly distributed speckle on the surface serves as a carrier of deformation information, and deforms together with the surface of the test piece. The speckle can be naturally generated or artificially made. Especially in the microscopic DIC experiment of a small-scale sample, since the focal plane of the sample surface and the working distance of the lens are determined, but the deformation of the material will change the focal length between them, so that the microscope is out of focus, the collected image becomes blurred, and finally the measurement accuracy is affected. SUMMARY

[0003] In order to solve the above technical problems, the application provides an image automatic focusing method and a focusing device, which can be self-adaptively adjusted to avoid the change of focal length caused by material deformation, so that the microscope is out of focus, the collected image becomes blurred, and finally the measurement accuracy is affected.

[0004] The technical scheme of the application comprises:

[0005] Coarse focusing: moving in the direction of approaching the material at a first speed from a position far away from the material, real-time shooting a plurality of images of the surface of the material at a fixed frame rate, and calculating the sharpness score of each image through a sharpness evaluation function. When the sharpness score of an image is greater than the sharpness score of the previous image, the sharpness score of the image is taken as a temporary extreme value, and the shooting position coordinates of the image are saved, until the sharpness score of the obtained image is lower than eighty percent of the temporary extreme value, and the coarse focusing is ended.

[0006] Fine focusing: moving in the direction of approaching the material at a second speed from a position at least one depth of field above the shooting position corresponding to the temporary extreme value, real-time shooting a plurality of images of the surface of the material at a fixed frame rate, until shooting to a position at least one depth of field below the shooting position corresponding to the temporary extreme value, calculating the sharpness score of each image through a sharpness evaluation function, fitting all the sharpness scores into a function, and calculating the maximum extreme value of the function. The coordinates corresponding to the maximum extreme value are the focusing accurate point.

[0007] The first speed is greater than the second speed.

[0008] Further, before coarse focusing, an image of the material surface is acquired at a position far from the material, the image is divided into several regions, the center positions of multiple regions are selected, the clarity scores of the selected multiple regions are calculated by the clarity evaluation function, and the region with the highest score is selected as the focusing region.

[0009] Further, the method for calculating the clarity score by the clarity evaluation function is: Gaussian blur is used for smoothing the image to reduce noise; a function in Laplace operator is called to calculate the standard deviation of the smoothed image; the standard deviation of the image is calculated by the variance function to obtain the variance value of the image; and the clarity score is obtained by the standard deviation and the variance value.

[0010] Further, in the coarse focusing, when the clarity of the acquired image is lower than 80% of the temporary extreme value, at least 30 images are continuously captured, and the clarity scores of the 30 images are all lower than 80% of the temporary extreme value, the coarse focusing is ended.

[0011] Further, the second speed is one fifth to one half of the first speed.

[0012] Further, the first speed is between 3 mm / s and 5 mm / s.

[0013] Further, the frame rate of the fixed frame rate is between 70 frames and 75 frames.

[0014] The application also provides an image automatic focusing device, comprising:

[0015] The height adjusting assembly comprises a guide rail, a fixed plate and a locking piece, the guide rail is arranged along the height direction, the fixed plate is slidably connected with the guide rail, and the locking piece is fixed on the fixed plate to limit the sliding of the fixed plate.

[0016] The lifting assembly comprises a slide rail, a stepping motor, a screw rod assembly and a connecting piece, one end of the slide rail is vertically connected to the fixed plate, the stepping motor is fixedly connected to the other end of the slide rail, the screw rod of the screw rod assembly is connected to the output end of the stepping motor, the nut of the screw rod assembly is connected to the connecting piece, the connecting piece is slidably connected to the slide rail, and the connecting piece is used for fixing the microscope.

[0017] The horizontal displacement assembly comprises a fixed seat, a supporting shell, a placing plate, an X-axis adjusting piece and a Y-axis adjusting piece, the supporting shell is connected with the fixed seat, the X-axis adjusting piece and the Y-axis adjusting piece are both fixed on the supporting shell, the placing plate is connected with the X-axis adjusting piece and the Y-axis adjusting piece respectively, and the placing plate is placed on the supporting shell, the X-axis adjusting piece and the Y-axis adjusting piece adjust the X-axis and Y-axis displacement distances of the placing plate, and the placing plate is used for placing the material.

[0018] A controller is in communication connection with the stepper motor, the X-axis adjusting member and the Y-axis adjusting member.

[0019] Further, the X-axis tilt adjusting member and the Y-axis tilt adjusting member are further included, and are fixed on the fixing base, and the X-axis tilt adjusting member and the Y-axis tilt adjusting member are connected with the supporting shell, the X-axis tilt adjusting member adjusts the tilt angle of the supporting shell in the X-axis direction, and the Y-axis tilt adjusting member adjusts the tilt angle of the supporting shell in the Y-axis direction.

[0020] Further, a grating is further included, and is fixed on the microscope, and is used for detecting the displacement distance of the microscope.

[0021] Compared with the prior art, the technical scheme provided by the embodiment of the present application has the following advantages:

[0022] Coarse focusing: moving away from the material at a first speed in the direction of approaching the material, taking a plurality of images of the surface of the material in real time at a fixed frame rate, and calculating the sharpness score of each image through a sharpness evaluation function, when the sharpness score of an image is greater than the sharpness score of the previous image, taking the sharpness score of the image as a temporary extreme value, and saving the shooting position coordinates of the image, until the sharpness of the obtained image is less than eighty percent of the temporary extreme value, and the coarse focusing is ended. Fine focusing: moving from a position at least one depth of field above the shooting position corresponding to the temporary extreme value to the direction of approaching the material at a second speed, taking a plurality of images of the surface of the material in real time at a fixed frame rate, until the shooting position at least one depth of field below the shooting position corresponding to the temporary extreme value is reached, and calculating the sharpness score of each image through a sharpness evaluation function, fitting all the sharpness scores into a function, and calculating the maximum extreme value of the function, and the coordinates corresponding to the maximum extreme value are the focusing accurate point. Compared with the prior art, the present application can adaptively adjust, avoid the change of focal length caused by material deformation, so that the microscope is out of focus, the collected image becomes blurred, and finally affects the measurement accuracy.

[0023] Other advantages, objects, and features of the application will be understood by those skilled in the art from the following description, and will be appreciated by those skilled in the art from the following description. BRIEF DESCRIPTION OF DRAWINGS

[0024] In order to more clearly illustrate the technical scheme in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiment or the prior art description. Obviously, the drawings in the following description are only some embodiments of the present application, and those skilled in the art can obtain other drawings according to these drawings without creating any creative labor.

[0025] Figure 1The schematic diagram of the whole focusing process of one embodiment of the present application;

[0026] Figure 2 The schematic diagram of the real-time focusing process of one embodiment of the present application;

[0027] Figure 3 The schematic diagram of the window segmentation of one embodiment of the present application;

[0028] Figure 4 The schematic diagram of the focusing distance and evaluation function value coordinates of one embodiment of the present application; Figure 3 The display diagram of multiple areas in part A of the present application;

[0029] Figure 5 The schematic diagram of the focusing distance and evaluation function value coordinates of one embodiment of the present application; Figure 1 ;

[0030] Figure 6 The schematic diagram of the focusing distance and evaluation function value coordinates of one embodiment of the present application; Figure 2 ;

[0031] Figure 7 The schematic diagram of the focusing distance and evaluation function value coordinates of one embodiment of the present application; Figure 3 ;

[0032] Figure 8 The schematic diagram of the focusing distance and evaluation function value coordinates of one embodiment of the present application; Figure 4 ;

[0033] Figure 9 The schematic diagram of the simulated focusing speckle pattern of one embodiment of the present application;

[0034] Figure 10 The data normalized image of one embodiment of the present application;

[0035] Figure 11 The comparison diagram of the calculation time of five functions of one embodiment of the present application;

[0036] Figure 12 The comparison result diagram of the experimental position and the ideal focusing plane position of one embodiment of the present application;

[0037] Figure 13 The schematic diagram of the whole structure of the focusing device of one embodiment of the present application;

[0038] Figure 14 The schematic diagram of the whole structure of the lifting assembly of one embodiment of the present application;

[0039] Figure 15 The schematic diagram of the whole structure of the horizontal displacement assembly of one embodiment of the present application.

[0040] Reference signs:

[0041] 1, guide rail; 2, fixed plate; 3, slide rail; 4, stepper motor; 5, screw assembly; 6, connecting piece; 7, fixed seat; 8, support shell; 9, placing plate; 10, X-axis adjusting piece; 11, Y-axis adjusting piece; 12, X-axis tilt adjusting piece; 13, Y-axis tilt adjusting piece; 14, microscope. DETAILED DESCRIPTION

[0042] One specific embodiment of the present application will be described in detail below with reference to the accompanying drawings, but it should be understood that the scope of protection of the present application is not limited by the specific embodiment.

[0043] In the description of the present application, it should be understood that the terms "center", "longitudinal", "transverse", "length", "width", "thickness", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", "axial", "radial", "circumferential" and the like indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the technical solutions of the present application and simplifying the description, and therefore cannot be understood as indicating or implying that the devices or elements referred to must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as limiting the present application.

[0044] In the description of the embodiments of the present application, the meaning of "a plurality of" is two or more, unless otherwise specified.

[0045] In the description of the embodiments of the present application, the depth of field refers to the range within which the camera can form relatively clear images before and after the focus point. The subject within this range will exhibit a higher degree of clarity, while the areas outside the depth of field range will gradually exhibit a blur effect. It should be particularly noted that the "focus point" we refer to is not an absolute geometric point, but a clear imaging area centered on the focusing plane and extending forward and backward.

[0046] For example, Figure 1 For example, Figure 2As shown, the present application provides an image automatic focusing method, which uses an automatic focusing algorithm based on image processing to assist users in observing and obtaining clear sample images during experiments. Since the deformation of the sample during the DIC experiment will change the working distance between the lens and the sample surface, and if the deformation is too large, the sample will be out of the depth of field range and cause defocusing, at this time, the continuous focusing function is needed to adjust the focus. Before continuous focusing, calibration is performed first, the ROI area (region of interest) is determined by the focusing window selection algorithm, and after calibration, continuous focusing is started, the defocusing detection function isInFocus() in the sharpWorkerThread thread is used for defocusing detection, and when the defocusing threshold DFThreshold is exceeded, the continuous focusing function is called to search for focus. The initial direction is to search downward by default, when the evaluation value decreases, the search direction is changed and the search step is reduced, and when the step is less than the set minimum step, it indicates that the focal plane is found, the focusing is ended, and the defocusing detection threshold is updated.

[0047] Specifically, it includes the following two parts:

[0048] Coarse focusing: first, an image of the material surface is obtained at a position far from the material, the image is divided into several regions, a plurality of regions at the center position are selected, and the sharpness evaluation function is used to calculate the sharpness scores of the selected plurality of regions, the region with the highest score is selected as the focusing region, then the first speed (3-5 mm / s) is used to move towards the material, a plurality of images of the material surface are captured in real time at a fixed frame rate (select one of 70-75 frames), and the sharpness evaluation function is used to calculate the sharpness score of each image, when the sharpness score of an image is greater than that of the previous image, the sharpness score of the image is taken as a temporary extreme value, and the shooting position coordinates of the image are saved, until the sharpness of the obtained image is lower than eighty percent of the temporary extreme value, and the coarse focusing is ended.

[0049] Fine focusing: from a position at least one depth of field above the temporary extreme value corresponding shooting position, move towards the material at a second speed (the second speed is one fifth to one half of the first speed), capture a plurality of images of the material surface in real time at a fixed frame rate, until the position at least one depth of field below the temporary extreme value corresponding shooting position is reached, calculate the sharpness score of each image by the sharpness evaluation function, fit all the sharpness scores with a function, and calculate the maximum extreme value of the function, the coordinates corresponding to the maximum extreme value are the accurate focusing point.

[0050] Wherein, the first speed is greater than the second speed.

[0051] Specifically, the position far from the material is to prevent the initial position of the lens from being in the overfocus state.

[0052] Specifically, conventional focusing search algorithms, such as hill climbing, global traversal, and function approximation, have their advantages and disadvantages. Hill climbing is susceptible to local extrema, leading to the inability to find a global optimal solution. Global search can traverse all possible focusing positions, but the search process is relatively slow. Function approximation relies on the characteristics of the focusing curve, but it can produce large errors when the image is out of focus. The present application proposes an improved search algorithm that combines global search and function approximation, aiming to improve the accuracy and efficiency of focusing, as shown in Figures 5 to 8 The specific search steps are as follows:

[0053] First, coarse focusing is performed by moving the microscope at a speed of 4 mm / s, and the frame rate of the microscope is 75 frames per second, i.e., 75 photos can be taken in one second. Therefore, during the movement of the microscope, the microscope collects images in real time and calculates the evaluation function value of the images. If the evaluation function value of the image during the search process is greater than that of the previous image, the value and its corresponding Z-axis (height direction) coordinate are stored as a temporary extreme value, which is updated if the same situation occurs subsequently. For example, point a in Figure 5 When the evaluation function value decreases and is less than 10% of the temporary extreme value, it is considered to be over-focused, as shown by point b in Figure 5 At this time, the microscope is driven to return to the temporary extreme value position and then to a distance of one depth of field, as shown by point c in Figure 6 Now, the second stage of fine focusing begins, and the microscope moves at a smaller speed of 2 mm / s for global search within a certain interval. When reaching the boundary position of the interval, as shown by point d in Figure 7 When the microscope returns to the fitted extreme value point, as shown by point e in Figure 8 This position is used as the accurate focusing point, and the search ends.

[0054] The improved method first uses global search to locate the point with the highest clarity, i.e., to find the area closest to the focal plane. Global search calculates the clarity evaluation value of each position by traversing all possible focusing positions, and finally selects the point with the highest clarity as the preliminary focusing position. This process can effectively avoid the influence of local extrema and ensure that the focusing search covers all possible focusing areas. Subsequently, the motor adjusts the lens in the opposite direction from the preliminary positioning point by a certain distance, and performs global search again within that area. This reverse process helps to break through local extrema, further refining the focusing position. By performing local search near the focal plane, the best focusing position can be more accurately determined, avoiding the possible loss of the best focusing position caused by single global search.

[0055] Finally, for the obtained definition evaluation value, a function approximation method is applied to fit the search result, the position of the focal plane is accurately determined by solving the extreme point of the quadratic curve obtained by fitting the local area of the definition evaluation function, and the function approximation method can quickly converge to the global optimal solution in the case of knowing the extreme point of the evaluation function, thereby greatly improving the focusing accuracy.

[0056] In the focusing process, the selection of the focusing area is crucial for focusing accuracy and efficiency. Although the traditional static window method is simple and efficient, it cannot adapt to changes in the target position and is prone to focusing failure when the target deviates from the image center. In the embodiments provided in the present application, before coarse focusing, an image of the material surface is obtained at a position far from the material, the image is evenly divided into several areas, a plurality of areas at the center position are selected, and the definition scores of the selected plurality of areas are calculated by the definition evaluation function, and the area with the highest score is selected as the focusing area.

[0057] Through this method, the focusing window can be dynamically adjusted according to the definition changes of different areas in the image, so that the main target can be captured more accurately, and the focusing failure problem that may occur when the target position changes in the fixed window method is avoided. As shown in FIGS. 1 and 2, the image is first evenly divided into 30 small blocks, and the definition scores of the 12 central areas are calculated. Figure 3 and Figure 4

[0058] This method combines the advantages of static window and dynamic window. The static window method ensures the efficiency of calculation, and the dynamic window adjusts the focusing area adaptively according to the definition evaluation, so as to better adapt to the position change of the target scene. This method can effectively improve the focusing accuracy of the image, especially when the target object is not located in the center of the image, it shows good adaptability and robustness. Compared with the traditional static window method, the improved method can more accurately select the focusing area during the focusing process, avoid the interference of too much background information, and also improve the adaptability to the target object deviating from the center. When the target object is small or far away, this method can still maintain good focusing performance, thereby improving the overall performance and stability.

[0059] In the embodiments provided in the present application, the method for calculating the definition score by the definition evaluation function is: Gaussian blur is used for smoothing the image to reduce noise; a function in the Laplace operator is called to calculate the standard deviation of the smoothed image; the standard deviation of the image is calculated by the variance function to obtain the variance value of the image; and the definition score of the image is obtained by calculating the standard deviation and the variance value of the image.

[0060] ​Specifically, in order to improve the accuracy of image sharpness evaluation, the Laplacian function is combined with the Variance function to form a LAPV function. This function aims to comprehensively consider the edge information and gray distribution characteristics of the image, so as to more comprehensively reflect the focusing degree of the image, including:

[0061] First, Gaussian blur is applied to smooth the original image, reducing the impact of noise.

[0062] Second, the Laplacian operator is called to perform second-order differential operation on the smoothed image, thereby highlighting the edge information of the image. The Laplacian operator can effectively capture the regions of gray level change in the image, i.e. the edge part of the image, thereby helping to evaluate the sharpness of the image.

[0063] Finally, the standard deviation of the Laplacian operator result is calculated to further quantify the sharpness of the image.

[0064] In the image, the greater the change in gray level, the clearer the image, so the image with larger standard deviation usually has better focusing effect.

[0065] The variance of the image is measured by the square of the standard deviation, thereby evaluating the sharpness score F of the image, defined as follows:

[0066]

[0067] Where M and N are the width and height of the image, μ L is the variance value of the Laplacian transform result, and L(x,y) is the standard deviation of the Laplacian transform result.

[0068] By combining the variance function with the Laplacian function, the LAPV evaluation function can consider the overall gray level change of the image while capturing the edge features of the image. This combination method not only retains the sensitivity of the variance function to image details, but also increases the evaluation of image edge sharpness, making the evaluation result more comprehensive and accurate.

[0069] In the embodiments provided by the present application, in the coarse focusing, when the sharpness of the obtained image is lower than eighty percent of the temporary extreme value, at least 30 images are continuously taken, and the sharpness scores of the 30 images are all lower than eighty percent of the temporary extreme value, the coarse focusing is ended.

[0070] The autofocus microscopy system studied in this invention is mainly used for capturing speckle images of microscopic discretization (DIC). It acquires images at different working distances using speckle images that conform to the experiment, evaluates the sharpness of the acquired images, and finally conducts further research and analysis on the simulation results of five evaluation functions: Laplacin, Tenengrad, Brenner, Variance, and LAPV.

[0071] To verify the effectiveness of the evaluation function studied in this invention, a series of qualitative tests were conducted. During the experiment, the sample speckle image was placed on the experimental platform, and the test began after the light source was turned on and the system was initialized. The experiment was set to start from a relatively far out-of-focus position, moving in a specific direction with a step size of 2μm. One image was acquired for each step, resulting in 200 speckle images of 3376×2704 pixels, covering the entire process from out-of-focus to near-focus and back to out-of-focus. The optimal focus position was the 106th image. Figure 9 As shown, image a is the initial image at the out-of-focus position, while images b and c are 20μm and 40μm away from the initial position, respectively, representing a distance of 10 steps. Visual observation of images a and b reveals little change in sharpness, both remaining in a significant out-of-focus state. Image c, however, is noticeably sharper than the previous two images. This demonstrates that in a significant out-of-focus state, small steps are unlikely to produce a noticeable change in sharpness, while large steps allow for rapid perception of the change, saving considerable focusing time.

[0072] exist Figure 9 In the diagram: (a) 1 indicates that image a is the first image in a set of 200 images; the others (b) 20; (c) 40; (d) 100; (e) 105; (f) 110; (g) 160; (h) 180; (i) 200 similarly indicate which image is which.

[0073] The middle images d, e, and f are near the focal plane, corresponding to images 100, 105, and 110 respectively. In this range, the differences between images are difficult to discern with the naked eye. This is partly due to subjective judgment errors and partly because the changes in image sharpness within the depth of field are not significant. Therefore, a function sensitive to changes in sharpness is needed for image evaluation, combined with a small step size search to determine the focal plane. The final images g, h, and i are images 160, 180, and 200 respectively, indicating an over-focus state. The changes become more pronounced as the images progress, showing a positive correlation with the out-of-focus state.

[0074] Two hundred images were imported into a sharpness algorithm testing program. The evaluation values ​​were then normalized after testing five different focus evaluation functions. Figure 10The five evaluation functions are shown in FIG. 1. It is observed that they can all effectively complete the focusing task and obtain clear images. In particular, near the 105th image, the image clarity observed by the naked eye reaches the highest, which is consistent with the results of the evaluation curve, thereby verifying the effectiveness of the evaluation function. It is observed that the maximum values of the five evaluation functions are near the peak, indicating that they can all effectively find the focal plane. However, the Tenengrad function and the Variance function do not conform to the sharpness of the extreme value, and the sensitivity near the focal plane is not high. The Laplacian function and the Brenner function have better convergence near the extreme value, but they have local extreme values in the focusing process, and the anti-interference ability is weak. The improved LAPV function in this paper has the peak convergence of the Laplacian function and the robustness of the Variance function. That is, it can reduce the interference of noise in the focusing process, has high sensitivity to extreme points, and has very high convergence near the focal plane.

[0075] In addition to the comparative analysis of focusing accuracy, the time required for focusing is also considered. The improved window selection algorithm is used to select the focusing area, and the time required for each function to process 200 images is counted. The calculation time of the five evaluation functions is compared, and the results are shown in FIG. 2. Figure 11 The results show that the calculation time of the Variance function, the Brenner function, and the LAPV function is similar, and the processing time of a single image is about 0.002 seconds, showing high calculation efficiency. The calculation time of the Tenengrad function and the Laplacian function is relatively long, and the processing time of a single image is more than 0.002 seconds. Although these two may provide more accurate edge detection in some cases, their high calculation complexity limits their application in real-time automatic focusing systems. Therefore, in application scenarios that require a balance between calculation efficiency and focusing accuracy, the LAPV function is more suitable.

[0076] This test uses the standard speckle sample of the laboratory and the DIC image acquisition software Vic-Snap for focusing evaluation. Before the experiment, the autofocus function is used for focusing, and after reaching the focal plane, the Vic-Snap software is switched to adjust the exposure and focusing.

[0077] The movement of the Z-axis camera is controlled by using the auto-focusing software to continuously adjust the focal length, and the focal plane position is determined by observing the color change. This focusing method is to continuously adjust the position of the lens by hand to focus, which requires tedious steps and more time, and since it is determined by the observation of the human eye, it has a certain subjective error. The present application uses the auto-focusing function in the auto-focusing software to focus, and records the positions after focusing twice. Through repeated operation several times, the average position of the two successful focusing methods is taken as the ideal focusing plane position.

[0078] After determining the focusing plane position, set the distance interval of 1mm at the focusing plane position, due to the working distance of the lens, only consider the defocus state, so the starting position is above the ideal focusing plane position. The maximum distance is 4mm, and a group of experiments is performed every 1mm, and each group of experiments is repeated 30 times. After focusing, record the experimental position each time, if the offset between the experimental position and the ideal focusing plane is within the depth of field, it is determined that the focusing is successful. The comparison results of the experimental position and the ideal focusing plane position are shown in Figure 12 Most of the focusing experimental positions are near the focusing plane, and a small part of the experimental positions deviate greatly from the focusing plane. The specific deviation results need to be further arranged by experimental data to verify the focusing accuracy.

[0079] By querying the parameters of the microscopic equipment and the calculation formula of the depth of field, combined with the experimental environment, the depth of field under the current state is calculated as 19.2μm. As long as the deviation meets half of the depth of field (9.6μm), the experimental requirements can be met. The experimental data result analysis is shown in Table 1, and the success rate is more than 98% in more than 200 experiments, which has good stability, and the average focusing accuracy of the experiment is 3.5μm, which is lower than 9.6μm, meeting the accuracy requirements.

[0080] Table 1: Experimental data result analysis

[0081]

[0082] The present application also provides an image automatic focusing device, comprising:

[0083] The height adjusting assembly comprises a guide rail 1, a fixed plate 2 and a locking piece (not shown in the figure), the guide rail 1 is arranged in the height direction, the fixed plate 2 is slidably connected with the guide rail 1, and the locking piece is fixed on the fixed plate 2 to limit the sliding of the fixed plate 2.

[0084] The lifting assembly comprises a slide rail 3, a stepping motor 4, a screw rod assembly 5 and a connecting piece 6, one end of the slide rail 3 is connected to the fixed plate 2 perpendicularly, the stepping motor 4 is fixedly connected to the other end of the slide rail 3, the screw rod of the screw rod assembly 5 is connected to the output end of the stepping motor 4, the nut of the screw rod assembly 5 is connected to the connecting piece 6, and the connecting piece 6 is in sliding fit with the slide rail 3, and the connecting piece 6 is used for fixing the microscope 14.

[0085] The horizontal displacement assembly comprises a fixed seat 7, a supporting shell 8, a placing plate 9, an X-axis adjusting piece 10 and a Y-axis adjusting piece 11, the supporting shell 8 is connected to the fixed seat 7, the X-axis adjusting piece 10 and the Y-axis adjusting piece 11 are both fixed on the supporting shell 8, the placing plate 9 is connected to the X-axis adjusting piece 10 and the Y-axis adjusting piece 11 respectively, and the placing plate 9 is placed on the supporting shell 8, the X-axis adjusting piece 10 and the Y-axis adjusting piece 11 adjust the X-axis and Y-axis displacement distances of the placing plate 9, and the placing plate 9 is used for placing materials.

[0086] The controller is in communication connection with the stepping motor 4, the X-axis adjusting piece 10 and the Y-axis adjusting piece 11.

[0087] In the embodiments provided in the application, the X-axis tilt adjusting piece 12 and the Y-axis tilt adjusting piece 13 are further included, both are fixed on the fixed seat 7, and both are connected to the supporting shell 8, the X-axis tilt adjusting piece 12 adjusts the inclination angle of the X-axis direction of the supporting shell 8, and the Y-axis tilt adjusting piece 13 adjusts the inclination angle of the Y-axis direction of the supporting shell 8.

[0088] In the embodiments provided in the application, a grating (not shown in the figure) is further included, the grating is fixed on the connecting piece 6, and is used for detecting the displacement distance of the connecting piece 6.

[0089] It should be noted that, in this document, the terms "comprise", "comprising", or any other variant thereof are intended to cover a non-exclusive inclusion, so that a process, method, article, or apparatus that comprises a list of elements does not only include those elements, but can also include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without more limitations, an element defined by the statement "comprising a" does not exclude the existence of additional identical elements in the process, method, article, or apparatus that includes the element.

[0090] Although the embodiments of the present application have been disclosed as above, they are not limited to the applications listed in the specification and the embodiments. It can be fully applied to various fields suitable for the present application. Additional modifications can be easily realized by those skilled in the art. Therefore, the present application is not limited to specific details and the figures shown and described herein, without departing from the general concept defined by the claims and the equivalent scope.

Claims

1. An image autofocusing method characterized by, The method comprises the following steps: Coarse focusing: moving towards the material at a first speed from a position far away from the material to take a plurality of images of the surface of the material in real time at a fixed frame rate, and calculating the sharpness score of each image by a sharpness evaluation function, when the sharpness score of an image is greater than that of the previous image, taking the sharpness score of the image as a temporary extreme value, and saving the shooting position coordinates of the image, until the sharpness score of the obtained image is lower than a threshold value, and the coarse focusing is ended; Fine focusing: moving towards the material at a second speed from a position at least one depth of field above the shooting position corresponding to the temporary extreme value to take a plurality of images of the surface of the material in real time at a fixed frame rate, until the position at least one depth of field below the shooting position corresponding to the temporary extreme value is reached, and calculating the sharpness score of each image by a sharpness evaluation function, fitting all the sharpness scores by a function, and calculating the maximum extreme value of the function, and the coordinate corresponding to the maximum extreme value is the accurate focusing point; Wherein, the first speed is greater than the second speed; Before coarse focusing, a image of the surface of the material is obtained at a position far away from the material, the image is divided into a plurality of regions, a plurality of regions at the center position are selected, and the sharpness scores of the selected plurality of regions are calculated by a sharpness evaluation function, and the region with the highest score is selected as the focusing region; The method for calculating the sharpness score by the sharpness evaluation function is: Gaussian blur is used for smoothing the image to reduce noise; a function in Laplace operator is called to calculate the standard deviation of the smoothed image; the standard deviation of the image is calculated by a variance function to obtain the variance value of the image; and the sharpness score is obtained by the standard deviation and the variance value.

2. The method of automatically focusing an image of claim 1, wherein, The threshold value is 80% of the temporary extreme value.

3. A method of automatic focusing of an image as claimed in claim 2, characterized in that, In the coarse focusing, when the sharpness score of the obtained image is lower than 80% of the temporary extreme value, at least 30 images are continuously taken, and the sharpness scores of the 30 images are all lower than 80% of the temporary extreme value, the coarse focusing is ended.

4. The method of automatically focusing an image of claim 1 wherein, The second speed is one fifth to one half of the first speed.

5. A method of automatic focusing of an image as claimed in claim 4, characterized in that, The first speed is between 3 mm / s and 5 mm / s.

6. The method of automatically focusing an image of claim 1 wherein, The frame rate of the fixed frame rate is between 70 frames and 75 frames.

7. A focusing device for use in an image auto-focusing method as claimed in any one of claims 1 to 6, characterized in that The height adjusting assembly comprises a guide rail, a fixed plate and a locking piece, the guide rail is arranged in the height direction, the fixed plate is slidably connected with the guide rail, and the locking piece is fixed on the fixed plate to limit the sliding of the fixed plate; The lifting assembly comprises a slide rail, a stepping motor, a lead screw assembly and a connecting piece, one end of the slide rail is connected perpendicularly to the fixed plate, the stepping motor is fixedly connected to the other end of the slide rail, the screw rod of the lead screw assembly is connected to the output end of the stepping motor, the nut of the lead screw assembly is connected to the connecting piece, and the connecting piece is slidably connected with the slide rail, and the connecting piece is used for fixing the microscope. ​ The horizontal displacement assembly comprises a fixed seat, a supporting shell, a placing plate, an X-axis adjusting part and a Y-axis adjusting part, the supporting shell is connected with the fixed seat, the X-axis adjusting part and the Y-axis adjusting part are both fixed on the supporting shell, the placing plate is connected with the X-axis adjusting part and the Y-axis adjusting part respectively, and the placing plate is placed on the supporting shell, the X-axis adjusting part and the Y-axis adjusting part adjust the X-axis and Y-axis displacement distance of the placing plate, and the placing plate is used for placing materials. A controller is in communication connection with the stepping motor, the X-axis adjusting part and the Y-axis adjusting part.

8. The focusing device of claim 7, wherein, The X-axis tilt adjusting part and the Y-axis tilt adjusting part are both fixed on the fixed seat, and the X-axis tilt adjusting part and the Y-axis tilt adjusting part are both connected with the supporting shell, the X-axis tilt adjusting part adjusts the inclination angle of the supporting shell in the X-axis direction, and the Y-axis tilt adjusting part adjusts the inclination angle of the supporting shell in the Y-axis direction.

Citation Information

Patent Citations

  • Rapid focusing strategy method based on stereomicroscope

    CN119620367A