Automatic image focusing method and focusing device

Through the adaptively adjusted image autofocus method, combined with the clarity evaluation function and the improved LAPV function, the focal length change problem caused by material deformation in microscope is solved, and the focus accuracy and measurement accuracy of the microscope are improved.

CN120529178AActive Publication Date: 2025-08-22DONGGUAN UNIV OF TECH

Patent Information

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

AI Technical Summary

Technical Problem

In microscopic DIC experiments of small-scale samples, material deformation leads to changes in focal length, resulting in the microscope being out of focus, affecting measurement accuracy.

Method used

The image autofocus method with adaptive adjustment, including coarse focus and fine focus, calculate the image sharpness score through the definition evaluation function, combine global search and function approximation method, dynamically adjust the focus area, and use the improved LAPV evaluation function to evaluate the clarity.

Benefits of technology

The focus accuracy and measurement accuracy of the microscope are improved, the focal length changes caused by material deformation are avoided, the image clarity is ensured, the target position changes are adapted, and the robustness and efficiency are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120529178A_ABST
    Figure CN120529178A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of material detection, and provides an automatic image focusing method and device, and the method comprises rough focusing and fine focusing, the rough focusing comprises the steps: moving towards a direction close to a material at a first speed at a position far away from the material, shooting a plurality of images in real time at a fixed frame rate, calculating the definition score of each image, and calculating the definition score of each image; and taking the definition score of the image as a temporary extreme value until the obtained definition score of the image is lower than a threshold value, and ending rough focusing. And fine focusing: a plurality of images are shot in real time at a second speed and a fixed frame rate from the position above the shooting position corresponding to the temporary extreme value, the definition score of each image is calculated, all the definition scores are subjected to function fitting, the maximum extreme value of the function is calculated, and the coordinate corresponding to the maximum extreme value is a focusing accurate point. According to the invention, focal length change caused by material deformation can be avoided, microscope out-of-focus is avoided, the acquired image becomes clear, and the measurement precision is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of material detection and provides an image automatic focusing method and a focusing device. Background Art

[0002] Currently, the most widely used non-contact optical measurement method in the field of measuring material deformation is DIC technology, or digital image correlation. The basic principle of the DIC method is to match nodes using image grayscale information, which relies on the speckle pattern of the surface being measured. The randomly distributed speckle on the surface acts as a carrier of deformation information and deforms along with the specimen surface. The speckle can be naturally generated or artificially created. Especially when conducting microscopic DIC experiments on small-scale samples, the focal plane of the sample surface and the working distance of the lens are fixed, but the deformation of the material will cause the focal length between them to change, causing the microscope to lose focus and the captured image to become blurred, ultimately affecting the measurement accuracy. Summary of the Invention

[0003] In order to solve the above technical problems, the present invention provides an image automatic focusing method and focusing device, which can adaptively adjust to avoid changes in focal length caused by material deformation, thereby causing the microscope to lose focus and the collected image to become blurred, ultimately affecting the measurement accuracy.

[0004] The technical solution of the present invention includes: Coarse focusing: Move at a first speed from a position far away from the material towards the material, take several images of the material surface in real time at a fixed frame rate, and calculate the clarity score of each image using the clarity evaluation function. When the clarity score of an image is greater than the clarity score of the previous image, the clarity score of the image is used as a temporary extreme value, and the shooting position coordinates of the image are saved. The coarse focusing is terminated until the acquired image clarity score is lower than 80% of the temporary extreme value.

[0005] Fine focus: Move from a position at least one depth of field above the shooting position corresponding to the temporary extreme value at the second speed toward the material, and capture several images of the material surface in real time at a fixed frame rate until the position is at least one depth of field below the shooting position corresponding to the temporary extreme value. Calculate the clarity score of each image using the clarity evaluation function, perform function fitting on all clarity scores, and calculate the maximum extreme value of the function. The coordinates corresponding to the maximum extreme value are the accurate focus points.

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

[0007] Furthermore, before coarse focusing, an image of the material surface is first obtained at a position far away from the material, the image is divided into several areas, multiple areas at the center position are selected, and the clarity scores of the selected multiple areas are calculated respectively by the clarity evaluation function, and the area with the highest score is selected as the focus area.

[0008] Furthermore, the method for calculating the clarity score of the clarity evaluation function is as follows: Gaussian blur is used to smooth the image to reduce noise; the 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 clarity score is obtained by the standard deviation and variance value.

[0009] Furthermore, in coarse focusing, when the acquired image clarity is lower than 80% of the temporary extreme value, and at least 30 images are continuously taken, and the clarity scores of the 30 images are all lower than 80% of the temporary extreme value, the coarse focusing is terminated.

[0010] Furthermore, the second speed is one fifth to one half of the first speed.

[0011] Furthermore, the first speed is between 3 mm / s and 5 mm / s.

[0012] Furthermore, the fixed frame rate is between 70 fps and 75 fps.

[0013] The present invention also provides an image automatic focusing device, comprising: The height adjustment component includes 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 to the guide rail, and the locking piece is fixed on the fixed plate to limit the sliding of the fixed plate.

[0014] The lifting assembly includes a slide rail, a stepper motor, a screw assembly and a connecting piece. One end of the slide rail is vertically connected to a fixed plate, the stepper motor is fixedly connected to the other end of the slide rail, the screw of the screw assembly is connected to the output end of the stepper motor, the nut of the screw assembly is connected to the connecting piece, and the connecting piece is slidably matched with the slide rail. The connecting piece is used to fix the microscope.

[0015] The horizontal displacement assembly includes a fixed base, a support shell, a placement plate, an X-axis adjustment member and a Y-axis adjustment member. The support shell is connected to the fixed base, and the X-axis adjustment member and the Y-axis adjustment member are both fixed on the support shell. The placement plate is respectively connected to the X-axis adjustment member and the Y-axis adjustment member, and the placement plate is placed on the support shell. The X-axis adjustment member and the Y-axis adjustment member adjust the X-axis and Y-axis displacement distances of the placement plate. The placement plate is used to place materials.

[0016] The controller is in communication with the stepper motor, the X-axis adjustment component and the Y-axis adjustment component.

[0017] Furthermore, it also includes an X-axis tilt adjustment member and a Y-axis tilt adjustment member, both of which are fixed on the fixed seat, and the X-axis tilt adjustment member and the Y-axis tilt adjustment member are both connected to the support shell, the X-axis tilt adjustment member adjusts the tilt angle of the support shell in the X-axis direction, and the Y-axis tilt adjustment member adjusts the tilt angle of the support shell in the Y-axis direction.

[0018] Furthermore, it also includes a grating, which is fixed on the microscope and is used to detect the displacement distance of the microscope.

[0019] The technical solution provided by the embodiment of the present invention has the following advantages compared with the existing technology: Coarse focusing: From a distance away from the material, the camera moves at a first speed toward the material, capturing several images of the material surface in real time at a fixed frame rate. A sharpness score is calculated for each image using a sharpness evaluation function. When the sharpness score of an image exceeds that of the previous image, the sharpness score of that image is set as a temporary extreme value, and the coordinates of the capture position of that image are saved. This process continues until the image sharpness reaches 80% of the temporary extreme value, at which point coarse focusing is terminated. Fine focusing: From a position at least one depth of field above the capture position corresponding to the temporary extreme value, the camera moves at a second speed toward the material, capturing several images of the material surface in real time at a fixed frame rate until the capture position is at least one depth of field below the capture position corresponding to the temporary extreme value. A sharpness score is calculated for each image using a sharpness evaluation function. A function is fitted to all sharpness scores, and the maximum extreme value of the function is calculated. The coordinates corresponding to this maximum extreme value are the focus points. Compared to existing technologies, the present invention enables adaptive adjustment, preventing focal length changes caused by material deformation, which can cause the microscope to lose focus, blur the captured image, and ultimately affect measurement accuracy.

[0020] Other advantages, objectives and features of the present invention will be reflected in part through the following description, and in part will be understood by those skilled in the art through study and practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0022] Figure 1 A schematic diagram of the overall focusing process according to one embodiment of the present invention; Figure 2 A schematic diagram of a real-time focusing process according to one embodiment of the present invention; Figure 3 A schematic diagram of window segmentation according to one embodiment of the present invention; Figure 4 for Figure 3 Multiple area display diagrams in Part A; Figure 5 The focus distance and evaluation function value coordinates of one embodiment of the present invention are Figure 1 ; Figure 6 The focus distance and evaluation function value coordinates of one embodiment of the present invention are Figure 2 ; Figure 7 The focus distance and evaluation function value coordinates of one embodiment of the present invention are Figure 3 ; Figure 8 The focus distance and evaluation function value coordinates of one embodiment of the present invention are Figure 4 ; Figure 9 A simulated focused speckle pattern according to one embodiment of the present invention; Figure 10 This is a data normalization image of one embodiment of the present invention; Figure 11 This is a comparison chart of calculation time for five functions according to one embodiment of the present invention; Figure 12 A diagram showing a comparison between the experimental position and the ideal quasi-focal plane position of one embodiment of the present invention; Figure 13 This is a schematic diagram of the overall structure of a focusing device according to one embodiment of the present invention; Figure 14 This is a schematic diagram of the overall structure of a lifting assembly according to one embodiment of the present invention; Figure 15 This is a schematic diagram of the overall structure of a horizontal displacement assembly according to one embodiment of the present invention.

[0023] Reference numerals: 1. Guide rail; 2. Fixed plate; 3. Slide rail; 4. Stepper motor; 5. Screw assembly; 6. Connector; 7. Fixed seat; 8. Support shell; 9. Placement plate; 10. X-axis adjustment member; 11. Y-axis adjustment member; 12. X-axis tilt adjustment member; 13. Y-axis tilt adjustment member; 14. Microscope. DETAILED DESCRIPTION

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

[0025] In the description of the present invention, it should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", "axial", "radial", "circumferential" and the like to indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the technical solutions of the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as limiting the present invention.

[0026] In the description of the embodiments of the present invention, unless otherwise specified, “a plurality of” means two or more.

[0027] In the description of the embodiments of the present invention, depth of field refers to the range of relatively clear images in front of and behind the camera's focus point. Subjects within this range appear sharp, while areas outside the depth of field gradually become blurred. It's important to note that the "focus" we're referring to isn't an absolute geometric point, but rather a clear imaging area extending forward and backward from the focus plane.

[0028] like Figure 1 and Figure 2 As shown, the present invention provides an image auto-focusing method, which utilizes an auto-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 cause the working distance between the lens and the sample surface to change, if the deformation is too large, it will also cause the sample to exceed the depth of field range and become out of focus. In this case, a continuous focus function is required to adjust the focus. Before continuous focusing, calibration is performed first, and the ROI area (region of interest) is determined by the focus window selection algorithm. After calibration, continuous focusing is started, and the out-of-focus detection function isInFocus() in the sharpWorkerThread thread performs out-of-focus detection. When the out-of-focus threshold DFThreshold is exceeded, the continuous focus function is called to search for focus. The initial direction defaults to downward search for focus. When the evaluation value decreases, the search direction is changed and the search step size is reduced. When the step size is less than the set minimum step size, it indicates that the focal plane is found. The focus is ended and the out-of-focus detection threshold is updated at the same time.

[0029] Specifically, it includes the following two parts: Coarse focusing: First, obtain an image of the material surface at a position far away from the material, divide the image into several areas, select multiple areas at the center position, and calculate the clarity scores of the selected multiple areas respectively through the clarity evaluation function, select the area with the highest score as the focus area, and then move towards the material at a first speed (3 mm / s to 5 mm / s), and take several images of the material surface in real time at a fixed frame rate (one of the frame rates is selected between 70 frames and 75 frames), and calculate the clarity score of each image through the clarity evaluation function. When the clarity score of an image is greater than the clarity score of the previous image, the clarity score of the image is used as a temporary extreme value, and the shooting position coordinates of the image are saved until the clarity of the acquired image is lower than 80% of the temporary extreme value, and the coarse focusing is ended.

[0030] Fine focus: From a position at least one depth of field above the shooting position corresponding to the temporary extreme value, move at the second speed (the second speed is one-fifth to one-half of the first speed) toward the material, and capture several images of the material surface 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 captured. The clarity score of each image is calculated using the clarity evaluation function, and a function is fitted to all clarity scores to calculate the maximum extreme value of the function. The coordinates corresponding to the maximum extreme value are the accurate focus points.

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

[0032] Specifically, the position far away from the material is because the initial position of the lens is prevented from being in an overfocus state.

[0033] Specifically, traditional focus search algorithms, such as hill climbing, global traversal, and function approximation, all have their advantages and disadvantages. Hill climbing is easily affected by local extreme values, resulting in the inability to find the global optimal solution. Although the global search method can traverse all possible focus positions, the search process is relatively slow. The function approximation method relies on the characteristics of the focus curve, but it is prone to large errors in out-of-focus images. The present invention proposes an improved search algorithm that combines the global search method and the function approximation method, aiming to improve the accuracy of focus and the search efficiency. Figures 5 to 8 The specific search steps are as follows:

[0034] First, perform coarse focusing and move the microscope at a moving speed (4mm / s). The frame rate of the microscope is 75 frames, that is, 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 image. If the evaluation function value of the image is greater than the evaluation function value of the previous image during the search process, the value and its corresponding Z-axis (height direction) coordinate are stored as temporary extreme values. If the same situation occurs later, the temporary extreme value is updated, such as 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, such as Figure 5 At point b in the figure, the microscope is driven to return to the temporary extreme position and then recoil a depth of field distance, such as Figure 6 Now we start the second stage of fine focusing. The microscope moves at a relatively low speed (2 mm / s) and performs a global search within a certain interval. When it reaches the boundary of the interval, Figure 7 Point d in the figure, fit the fine search value with the function, when the microscope returns to the fitted extreme point, such as Figure 8 Point e in the image is used as the focus point and the search ends.

[0035] The improved method first uses a global search method to locate the point with the highest relative clarity, that is, to find the area closest to the focal plane. The global search method traverses all possible focus positions, calculates the clarity evaluation value of each position, and ultimately selects the point with the highest clarity as the initial focus position. This process can effectively avoid the influence of local extremes and ensure that the focus search covers all possible focus areas. The motor then adjusts in the opposite direction based on the selected position, that is, the lens is recoiled a certain distance from the initial positioning point and a global search is performed again in this area. This recoil process helps to break through local extremes, thereby further refining the focus position. By performing a local search near the focal plane, the optimal focus position can be determined more accurately, avoiding the possibility of missing the optimal focus position due to a single global search method.

[0036] Finally, the function approximation method is applied to fit the search results for the obtained clarity evaluation value. By fitting the local area of ​​the clarity evaluation function, the analytical expression of the quadratic curve is obtained, and the position of the focal plane is accurately determined by solving the extreme points of the quadratic curve. The function approximation method can quickly converge to the global optimal solution when the extreme points of the evaluation function are known, thereby greatly improving the focusing accuracy.

[0037] During the focusing process, the selection of the focus area is crucial to 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 focus failure when the target deviates from the center of the image. In the embodiment provided by the present invention, before coarse focusing, an image of the material surface is first obtained at a position away from the material, and the image is divided into several areas. Multiple areas at the center position are selected, and the clarity scores of the selected multiple areas are calculated using a clarity evaluation function. The area with the highest score is selected as the focus area.

[0038] Through this method, the focus window can be dynamically adjusted according to the changes in the clarity of different areas in the image, so as to capture the main target more accurately and avoid the focus failure problem that may occur when the target position changes in the fixed window method. For example, the image is first evenly divided into 30 small blocks, and the middle 12 areas are selected to calculate the clarity score of each area, such as Figure 3 and Figure 4 shown.

[0039] This method combines the advantages of static and dynamic windows. The static window method ensures efficient computation, while the dynamic window method adaptively adjusts the focus area based on clarity assessment, better adapting to changes in the target scene's position. This method can effectively improve image focus accuracy, especially when the target object is not located in the center of the image, demonstrating good adaptability and robustness. Compared with the traditional static window method, the improved method can more accurately select the focus area during the focusing process, avoiding excessive background information interference, while also improving adaptability to off-center target objects. Even when the target object is small or distant, this method can still maintain good focusing performance, thereby improving overall performance and stability.

[0040] In the embodiment provided by the present invention, the method for calculating the clarity score of the clarity evaluation function is: smoothing the image by Gaussian blur to reduce noise; calling the function in the Laplace operator to calculate the smoothed image to obtain the standard deviation of the image; calculating the standard deviation of the image by the variance function to obtain the variance value of the image; and obtaining the clarity score of the image by calculating the standard deviation of the image and obtaining the variance value of the image.

[0041] Specifically, to improve the accuracy of image clarity evaluation, the Laplacian function and the Variance function are combined to form an improved LAPV function. This function is designed to comprehensively consider the edge information and grayscale distribution characteristics of the image, thereby more comprehensively reflecting the focus level of the image, including:

[0042] First, Gaussian blur is applied to smooth the original image to reduce the influence of noise.

[0043] Secondly, the Laplace operator is used to perform a second-order differential operation on the smoothed image to highlight the edge information of the image. The Laplace operator can effectively capture areas with sudden grayscale changes in the image, that is, the edges of the image, which helps to evaluate the sharpness of the image.

[0044] Finally, the image clarity is further quantified by calculating the standard deviation of the Laplacian operator results.

[0045] In an image, the greater the variation in grayscale, the clearer the image, so an image with a larger standard deviation usually has a better focusing effect.

[0046] The square of the standard deviation is used to measure the variance of the image, thereby evaluating the image clarity score F. The formula is defined as follows: Where M and N are the width and height of the image, μ L is the variance of the Laplacian transformation result, and L(x,y) is the standard deviation of the Laplacian transformation result.

[0047] By combining the variance function with the Laplace function, the LAPV evaluation function can capture the edge features of the image while considering the overall grayscale changes of the image. This combination method not only retains the variance function's sensitivity to image details, but also increases the evaluation of image edge clarity, making the evaluation results more comprehensive and accurate.

[0048] In the embodiment provided by the present invention, in coarse focusing, when the clarity of the acquired image is lower than eighty percent of the temporary extreme value, at least 30 images are taken continuously, and the clarity scores of the 30 images are all lower than eighty percent of the temporary extreme value, the coarse focusing is terminated.

[0049] The autofocus microscope system studied in this paper mainly captures speckle images of microscopic DIC, uses speckle images that meet the experiment to collect images at different working distances, and evaluates the clarity of the collected images. Finally, further research and analysis are carried out on the simulation results of five evaluation functions: Laplacin, Tenengrad, Brenner, Variance, and LAPV.

[0050] In order to verify the effectiveness of the evaluation function studied in this paper, a series of qualitative tests were conducted. During the experiment, the sample speckle image was placed on the experimental platform, and the test was started after the light source was turned on and the system was initialized. The experimental setting started from a farther defocus position and moved in a specific direction with a step size of 2μm. An image was collected for each step size. A total of 200 speckle images of 3376×2704 pixels were collected, covering the entire process from defocus to focus and then to defocus. The best focus position was the 106th image, as shown in Figure 2. Figure 9 As shown in the figure, Figure a is the initial image at the defocused position, and Figures b and c are 20μm and 40μm away from the initial position, respectively, that is, 10 steps apart. Visually observing Figures a and b, we can see that there is not much change in clarity between them, as both are in a state of significant defocus, while Figure c is significantly clearer than the previous two. This shows that in a state of significant defocus, it is difficult to obtain a noticeable change in clarity with small step sizes, while large step sizes allow for quicker perception of clarity changes, saving significant focusing time.

[0051] exist Figure 9 In the figure: (a) 1 means that image a is the first image of 200 images; the rest (b) 20, (c) 40, (d) 100, (e) 105, (f) 110, (g) 160, (h) 180, and (i) 200 indicate the number of images.

[0052] The images in the middle, d, e, and f, are near the focal plane and are the 100th, 105th, and 110th images, respectively. It's difficult to detect differences between images in this range with the naked eye. This is due to errors in subjective judgment and the lack of clarity within the depth of field. This requires a function that's sensitive to clarity changes, combined with a small-step search to determine the focal plane. The final images, g, h, and i, are the 160th, 180th, and 200th images, respectively, showing an overfocus state. The changes become more pronounced as you go further, positively correlated with the defocus state.

[0053] Import 200 images into the sharpness algorithm test program, and normalize the evaluation values ​​by testing five focus evaluation functions, such as Figure 10As shown in the figure, all of them are able to effectively complete the focusing task and obtain clear images. In particular, the image clarity observed by the naked eye reaches its highest level near the 105th image, a finding consistent with the evaluation curve results, thus confirming the effectiveness of the evaluation functions. The maximum values ​​of the five evaluation functions are observed near their peaks, indicating that they are all able to effectively find the focal plane. However, the Tenengrad function and the Variance function do not conform to the characteristic of sharp extrema and are not very sensitive near the focal plane. While the Laplacian function and the Brenner function converge well near their extrema, they experience local extrema during the focusing process, resulting in weak interference resistance. The improved LAPV function proposed in this paper combines the peak convergence of the Laplacian function with the robustness of the Variance function. Specifically, it can reduce noise interference during the focusing process, is highly sensitive to extrema, and has extremely high convergence near the focal plane.

[0054] In addition to the comparative analysis of focus accuracy, the time required for focusing must also be considered. The focus area is selected using an improved window selection algorithm. The time required for each function to process 200 images is statistically analyzed. The calculation time of the five evaluation functions is compared and the results are analyzed by Figure 11 The results are presented. The results show that the computation time for the Brenner and LAPV functions, which are variance functions, is similar, with a single image processing time of approximately 0.002 seconds, demonstrating high computational efficiency. The Tenengrad and Laplacian functions take relatively long computation times, exceeding 0.002 seconds for a single image. While these two functions may provide more accurate edge detection in some cases, their high computational complexity limits their application in real-time autofocus systems. Therefore, the LAPV function is more suitable for applications that require a balance between computational efficiency and focusing accuracy.

[0055] This test used a standard laboratory speckle sample and the DIC imaging software Vic-Snap for focus evaluation. Before the experiment, the autofocus function was used to find focus. Once the focal plane was reached, the Vic-Snap software was used to adjust exposure and focus.

[0056] Autofocus software is used to control the movement of the Z-axis camera to continuously adjust the focal length, and the focal plane position is determined by observing the color changes. This focusing method involves manually adjusting the position of the lens to find the focus, which requires cumbersome steps and a considerable amount of time. Moreover, since the position is determined by human observation, it is subject to certain subjective errors. The present invention uses the autofocus function in the autofocus software to focus, and records the positions after two focus operations. By repeating this operation multiple times, the average position of the two successful focus methods is used as the ideal quasi-focal plane position.

[0057] After determining the quasi-focal plane position, set the distance interval at the quasi-focal plane position to 1mm. Due to the working distance of the lens, only the defocus state is considered, so the starting position is above the ideal quasi-focal plane position. The maximum distance is 4mm, and a set of experiments is performed every 1mm, and each set of experiments is repeated 30 times. After focusing, record each experimental position. If the offset between the experimental position and the ideal quasi-focal plane is within the depth of field, it is determined that the focus is successful. The comparison results of the experimental position and the ideal quasi-focal plane position are as follows: Figure 12 As shown in the figure, most of the focus test positions are close to the quasi-focal plane, while a small number of test positions deviate significantly from the quasi-focal plane. The specific deviation results require further analysis of the experimental data to verify the focus accuracy.

[0058] By consulting the microscope's parameters and the depth of field calculation formula, combined with the experimental environment, we calculated that the current depth of field is 19.2μm. As long as the deviation is within half the depth of field (9.6μm), the experimental requirements are met. The experimental data analysis results are shown in Table 1. A success rate of over 98% was achieved across over 200 experiments, demonstrating excellent stability. The average focus accuracy for the entire experiment was 3.5μm, lower than 9.6μm, meeting the accuracy requirements.

[0059] Table 1: Experimental data analysis The present invention also provides an image automatic focusing device, comprising: The height adjustment assembly includes a guide rail 1, a fixed plate 2 and a locking member (not shown in the figure). The guide rail 1 is arranged along the height direction, the fixed plate 2 is slidably connected to the guide rail 1, and the locking member is fixed on the fixed plate 2 to limit the sliding of the fixed plate 2.

[0060] The lifting assembly includes a slide rail 3, a stepper motor 4, a screw assembly 5 and a connecting member 6. One end of the slide rail 3 is vertically connected to the fixed plate 2, and the stepper motor 4 is fixedly connected to the other end of the slide rail 3. The screw of the screw assembly 5 is connected to the output end of the stepper motor 4, and the nut of the screw assembly 5 is connected to the connecting member 6. The connecting member 6 is slidably matched with the slide rail 3, and the connecting member 6 is used to fix the microscope 14.

[0061] The horizontal displacement assembly includes a fixed seat 7, a support shell 8, a placement plate 9, an X-axis adjustment member 10 and a Y-axis adjustment member 11. The support shell 8 is connected to the fixed seat 7. The X-axis adjustment member 10 and the Y-axis adjustment member 11 are both fixed on the support shell 8. The placement plate 9 is respectively connected to the X-axis adjustment member 10 and the Y-axis adjustment member 11, and the placement plate 9 is placed on the support shell 8. The X-axis adjustment member 10 and the Y-axis adjustment member 11 adjust the X-axis and Y-axis displacement distances of the placement plate 9. The placement plate 9 is used to place materials.

[0062] The controller is in communication with the stepper motor 4 , the X-axis adjustment member 10 and the Y-axis adjustment member 11 .

[0063] In the embodiment provided by the present invention, an X-axis tilt adjustment member 12 and a Y-axis tilt adjustment member 13 are also included, both of which are fixed on the fixing seat 7, and the X-axis tilt adjustment member 12 and the Y-axis tilt adjustment member 13 are both connected to the support shell 8, the X-axis tilt adjustment member 12 adjusts the tilt angle of the support shell 8 in the X-axis direction, and the Y-axis tilt adjustment member 13 adjusts the tilt angle of the support shell 8 in the Y-axis direction.

[0064] In the embodiment provided by the present invention, a grating (not shown in the figure) is further included. The grating is fixed on the connecting member 6 and is used to detect the displacement distance of the connecting member 6.

[0065] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.

[0066] Although the embodiments of the present invention have been disclosed above, they are not limited to the applications listed in the specification and exemplary embodiments. They can be applied to a variety of fields suitable for the present invention. Further modifications will be readily apparent to those skilled in the art. Therefore, the present invention is not limited to the specific details and illustrations shown and described herein without departing from the general concept defined by the claims and their equivalents.

Claims

1. An image auto-focusing method, characterized in that: include: Coarse focus: Move at a first speed from a position away from the material toward the material, capture several images of the material surface in real time at a fixed frame rate, and calculate the clarity score of each image using a clarity evaluation function. When the clarity score of an image is greater than that of the previous image, the clarity score of the image is used as a temporary extreme value, and the coordinates of the shooting position of the image are saved. The coarse focus is terminated until the acquired image clarity score is lower than the threshold. Fine focus: From a position at least one depth of field above the shooting position corresponding to the temporary extreme value, move at the second speed toward the direction close to the material, and capture several images of the material surface 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 captured. The clarity score of each image is calculated using the clarity evaluation function, and a function is fitted to all the clarity scores to calculate the maximum extreme value of the function. The coordinates corresponding to the maximum extreme value are the focus points. The first speed is greater than the second speed.

2. The image auto-focusing method according to claim 1, wherein: Before coarse focusing, an image of the material surface is first obtained at a position far away from the material. The image is divided into several areas, and multiple areas at the center are selected. The clarity scores of the selected multiple areas are calculated using the clarity evaluation function, and the area with the highest score is selected as the focus area.

3. The image auto-focusing method according to claim 1, wherein: The method for calculating the clarity score of the clarity evaluation function is: Gaussian blur smoothes the image and reduces noise; Call the function in the Laplace operator to calculate the smoothed image to obtain the standard deviation of the image; The standard deviation of the image is calculated by the variance function to obtain the variance value of the image; The clarity score is obtained by the standard deviation and variance values.

4. The image auto-focusing method according to claim 1, wherein: The threshold is eighty percent of the temporary extreme value.

5. The image automatic focusing method according to claim 4, wherein: In the coarse focus adjustment, when the acquired image clarity is lower than 80% of the temporary extreme value, and at least 30 images are continuously taken, and the clarity scores of the 30 images are all lower than 80% of the temporary extreme value, the coarse focus adjustment is ended.

6. The image auto-focusing method according to claim 1, wherein: The second speed is one fifth to one half of the first speed.

7. The image automatic focusing method according to claim 5, wherein: The first speed is between 3 mm / s and 5 mm / s.

8. The image auto-focusing method according to claim 1, wherein: The fixed frame rate is between 70 and 75 frames.

9. The focusing device used in the image automatic focusing method according to any one of claims 1 to 8, characterized in that: include: A height adjustment assembly includes a guide rail, a fixing plate, and a locking member, wherein the guide rail is arranged along the height direction, the fixing plate is slidably connected to the guide rail, and the locking member is fixed to the fixing plate to limit the sliding of the fixing plate; A lifting assembly includes a slide rail, a stepper motor, a lead screw assembly, and a connector. One end of the slide rail is vertically connected to a fixed plate. The stepper motor is fixedly connected to the other end of the slide rail. The screw of the lead screw assembly is connected to the output end of the stepper motor. The nut of the lead screw assembly is connected to the connector. The connector is in sliding engagement with the slide rail. The connector is used to fix the microscope. A horizontal displacement assembly includes a fixed base, a support shell, a placement plate, an X-axis adjustment member, and a Y-axis adjustment member. The support shell is connected to the fixed base, and the X-axis adjustment member and the Y-axis adjustment member are both fixed to the support shell. The placement plate is respectively connected to the X-axis adjustment member and the Y-axis adjustment member, and the placement plate is placed on the support shell. The X-axis adjustment member and the Y-axis adjustment member adjust the X-axis and Y-axis displacement distances of the placement plate. The placement plate is used to place materials. The controller is in communication with the stepper motor, the X-axis adjustment component and the Y-axis adjustment component.

10. The image automatic focusing device according to claim 9, wherein: It also includes an X-axis tilt adjustment member and a Y-axis tilt adjustment member, both of which are fixed on the fixed seat, and the X-axis tilt adjustment member and the Y-axis tilt adjustment member are both connected to the support shell, the X-axis tilt adjustment member adjusts the tilt angle of the support shell in the X-axis direction, and the Y-axis tilt adjustment member adjusts the tilt angle of the support shell in the Y-axis direction.

Citation Information

Patent Citations

  • Automatic focusing method and device for camera based on defocus estimation improved hill climbing method

    CN108259753A

  • Improved focusing position searching method based on hill climbing method

    CN112261285A

  • Microscope automatic focusing method and device based on image definition evaluation

    CN113109936A

  • Efficient automatic focusing method for imaging equipment

    CN114760411A

  • Rapid focusing strategy method based on stereomicroscope

    CN119620367A

Cited By

  • Microscope camera imaging virtual focus detection method and system based on calibration plate

    CN121540394A

  • Microscope camera imaging out-of-focus detection method and system based on a calibration plate

    CN121540394B