Automatic focusing method and microscope image acquisition equipment
By combining the point diffusion function model and adaptive Gaussian filtering, local fuzzy parameters are dynamically adjusted, and a multi-dimensional evaluation auxiliary mechanism is introduced, which solves the robustness and accuracy problems of the automatic focusing method in dynamic scenarios in the existing technology, and achieves an efficient and accurate focus effect.
Patent Information
- Application Number
- CN202411963854.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-06-06
- Estimated Expiration
- 2044-12-30
AI Technical Summary
The existing automatic focusing method fails to effectively combine global fuzzy characteristics with local fuzzy characteristics, resulting in poor robustness in dynamically changing scenarios, low focus accuracy, and inability to take into account the coverage of the target number and the balance of image sharpness, making it easy to fall into the local optimal solution.
The automatic focusing method combining point diffusion function model and adaptive Gaussian filtering is adopted to dynamically adjust the local blur parameters, optimize the local blur characteristics of the image, and introduce a multi-dimensional evaluation auxiliary mechanism to comprehensively evaluate the quality of the focus position to achieve balanced coverage of the target and improve the focus accuracy.
It improves focus accuracy and robustness, can achieve stable focus in dynamic and complex scenarios, improves focus efficiency and target coverage capabilities, and ensures accurate and efficient focus in complex dynamic scenarios.
Smart Images

Figure CN120103597A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of image processing and automatic focusing, and in particular to an automatic focusing method and a microscope image acquisition device. Background Art
[0002] Autofocus technology has been widely used in the fields of microscope imaging, medical image analysis, and automated detection systems. In particular, accurate focusing is crucial when processing biomedical images such as sperm analysis and cytology.
[0003] Existing autofocus methods mainly include methods based on image sharpness, contrast and frequency domain analysis. These methods evaluate the focus state by calculating the gradient change or blur degree of the local area of the image. Common methods based on image sharpness include the gradient method, Laplace method and Brenner method. These methods have the problems of strong noise sensitivity and great dependence on image background and illumination changes, resulting in poor image quality or low contrast in complex dynamic scenes, which affects the focusing accuracy.
[0004] In order to solve the above problems, the point spread function (PSF) model was introduced into the field of autofocus. The PSF model can describe the blur characteristics of the optical system and theoretically provide quantification of the global blur. However, most of the existing PSF models assume that the blur degree of the image is globally consistent and lack the ability to dynamically adapt to the local area of the image, which makes the model less adaptable in complex scenes and unable to effectively handle changes in the blur degree of different areas, especially in the case of dynamic changes or overlap between the target and the background.
[0005] In order to overcome the limitations of fixed blur parameters, focusing methods based on adaptive filtering have gradually been used in recent years; however, this method relies on the changes in local image features and fails to effectively combine the global blur characteristics with the local blur characteristics, resulting in poor robustness and low focusing accuracy in dynamically changing complex scenes.
[0006] In addition, existing autofocus methods usually cannot balance the coverage of the number of targets and the balance of image clarity. Especially when the target objects are dynamically moving and layered, existing autofocus methods are prone to fall into local optimal solutions and cannot effectively perform precise focusing. Summary of the invention
[0007] To this end, the technical problem to be solved by the present invention is to overcome the problem that the prior art does not consider combining global blur characteristics with local blur characteristics, resulting in poor robustness in dynamically changing scenes, and then causing low focusing accuracy; it does not take into account the balance between the coverage of the number of target objects and the clarity of the image, resulting in falling into a local optimal solution when the target objects are dynamic and layered, resulting in low focusing efficiency and effect.
[0008] In order to solve the above technical problems, the present invention provides an automatic focusing method, comprising:
[0009] An image at an initial focus position of the microscope is acquired as an original image; a dynamic search range of the focus position of the microscope is set based on the moving range of the motion control platform;
[0010] Based on the numerical aperture of the microscope, the wavelength of light, and the defocus, the standard deviation of the point spread function is obtained;
[0011] Taking each pixel in the original image as the center, according to the preset window size, obtain the local area corresponding to each pixel in the original image, and calculate the local variance of each pixel; based on the standard deviation of the point spread function and the local variance of each pixel, obtain the local standard deviation of each pixel; based on the pixel value of each pixel in the original image and its corresponding local area, obtain the pixel value of each pixel in the local area of the original image; based on the weight function of the adaptive Gaussian filter and the pixel value of each pixel in the local area of the original image, obtain the pixel value of each pixel in the Gaussian filtered image;
[0012] Based on the pixel value of each pixel in the Gaussian filter image and the pixel value of the pixel after the relative position offset in its local area, the local energy of each pixel in the Gaussian filter image is obtained; based on the mapping function between energy and blur parameter and the local energy of each pixel in the Gaussian filter image, the blur parameter of each pixel is obtained; based on the blur parameter of each pixel, the Gaussian filter image is weighted blurred to obtain an energy distribution image;
[0013] All target objects and their total number in the energy distribution image are detected, and target objects with confidence greater than a threshold are screened out from all target objects as confidence target objects, and the number of confidence target objects is obtained; within the dynamic search range of the microscope focus position, an objective function is constructed with the goal of maximizing the weighted sum of the number of confidence target objects and the total number of target objects; after determining the fuzzy parameter constraints and the confidence target object number constraints according to the clarity threshold and the reliability threshold, the objective function is optimized; when the total number of target objects reaches the maximum value, the number of confidence target objects exceeds the reliability threshold and the fuzzy parameter is less than the clarity threshold, the optimization is terminated, and the focus position at the time of optimization termination is used as the optimal focus position of the microscope.
[0014] Preferably, the standard deviation of the point spread function is obtained based on the numerical aperture, light wavelength and defocus of the microscope, and its expression is:
[0015] ;
[0016] in, represents the standard deviation of the point spread function; represents the proportionality coefficient, ; It represents the numerical aperture of the microscope; Indicates the wavelength of light from the microscope; Indicates the amount of defocus.
[0017] Preferably, taking each pixel in the original image as the center and obtaining the local area corresponding to each pixel in the original image according to a preset window size, and calculating the local variance of each pixel; obtaining the local standard deviation of each pixel based on the standard deviation of the point spread function and the local variance of each pixel includes:
[0018] The pixels in the original image As the center, according to the preset window size, get the pixel points in the original image The corresponding local area and calculate the pixel points The local variance of is expressed as:
[0019] ;
[0020] in, Represents pixel The local variance of Indicates the preset window size; Indicates the pixel point in the original image The corresponding pixel point in the local area The pixel value of Indicates the pixel point in the original image The pixel mean of all pixels in the corresponding local area;
[0021] Standard deviation and pixel points based on point spread function The local variance of the pixel is obtained The local standard deviation of is expressed as:
[0022] ;
[0023] in, Represents pixel The local standard deviation of represents the standard deviation of the point spread function; represents the regulating factor; Represents pixel The local variance of .
[0024] Preferably, the weight function based on the adaptive Gaussian filter and the pixel value of each pixel in the local area of the original image is used to obtain the pixel value of each pixel in the Gaussian filtered image, and its expression is:
[0025] ;
[0026] in, Represents the pixel point in the Gaussian filtered image The pixel value of Represents pixel The local standard deviation of Indicates based on The weight function of the constructed adaptive Gaussian filter; Represents pixel The corresponding weights of the adaptive Gaussian filter; Indicates the pixel point in the original image Pixel points in the local area The pixel value of .
[0027] Preferably, the local energy of each pixel in the Gaussian filtered image is obtained based on the pixel value of each pixel in the Gaussian filtered image and the pixel value of the pixel after the relative position offset in its local area, and its expression is:
[0028] ;
[0029] in, Represents the pixel point in the Gaussian filtered image The local energy of Represents pixel The relative position offset within its local area The pixel value after Indicated in pixels The center of the window is Pixels Relative position offset within a local area; Indicates the horizontal direction relative to the center pixel The change in position of Indicates the vertical direction relative to the center pixel The change in position of Represents the pixel point in the Gaussian filtered image The pixel value of Indicates the window radius, the default window size is ,but .
[0030] Preferably, the mapping function between energy and blur parameter and the local energy of each pixel in the Gaussian filtered image is used to obtain the blur parameter of each pixel, and its expression is:
[0031] ;
[0032] in, Represents pixel The fuzzy parameters of Represents the mapping function between energy and fuzzy parameters; Represents the pixel point in the Gaussian filtered image The local energy.
[0033] Preferably, the target objects with confidence greater than a threshold are screened out from all target objects as confidence target objects, and the number of confidence target objects is obtained, and the expression is:
[0034] ;
[0035] in, Indicates the number of confidence target objects; Indicates the total number of target objects; represents the indicator function, if ,but ,like ,but ; Indicates The confidence level of the target object; Represents the confidence threshold.
[0036] Preferably, the objective function is constructed with the goal of maximizing the weighted sum of the number of confidence target objects and the total number of target objects, and its expression is:
[0037] ;
[0038] in, Indicates the focus position of the microscope; Indicates the dynamic search range of the microscope focus position; Indicates the starting threshold of the microscope focus position; Indicates the microscope focus position termination threshold; Indicates the focus position of the microscope The total number of target objects at the time of Indicates the focus position of the microscope The number of target objects with confidence at the time; The weight representing the number of confidence target objects.
[0039] Preferably, the determining of the fuzzy parameter constraint and the confidence target object quantity constraint according to the clarity threshold and the reliability threshold comprises:
[0040] The expression of the fuzzy parameter constraint is:
[0041] ;
[0042] in, Indicates the focus position of the microscope; Indicates the focus position of the microscope Pixel at time The fuzzy parameters of represents the clarity threshold;
[0043] The expression of the confidence target object quantity constraint is:
[0044] ;
[0045] in, Indicates the focus position of the microscope The number of target objects with confidence at the time; Represents the reliability threshold.
[0046] The present invention also provides a microscope image acquisition device, comprising:
[0047] A microscope is placed directly above the motion control platform and connected to the motion control platform through an optical interface; it is used to magnify and view the details of the target object sample;
[0048] The camera is a high-resolution CCD camera installed at the imaging port of the microscope and connected to the computer via a high-speed data transmission line; it is used to collect microscope images and transmit the collected microscope images to the computer;
[0049] Motion control platform, equipped with electric Z-axis adjuster, connected to computer for communication; used to place target object samples and control the adjustment of microscope focus position;
[0050] A computer has a built-in program for the above-mentioned automatic focusing method, which is used to execute the built-in program, process and collect microscope images, adjust the position of the motion control platform, realize automatic focusing of the microscope, and obtain the microscope image after automatic focusing.
[0051] The above technical solution of the present invention has the following beneficial effects compared with the prior art:
[0052] The automatic focusing method described in the present invention combines a point spread function model with an adaptive Gaussian filter, so that local blur parameters can be dynamically adjusted based on the description of global blur characteristics, effectively combining global blur characteristics with local blur characteristics, optimizing local blur parameters of the image, and improving focusing accuracy and robustness; using adaptive Gaussian filtering, dynamically adjusting local standard deviations according to local features of the image to achieve dynamic search; using an energy distribution method, adjusting blur parameters according to energy and blur parameter mapping functions to achieve fine optimization; by combining dynamic search with fine optimization strategies, precise positioning is achieved in a small range of dynamic search near the focal plane, thereby improving focusing efficiency; introducing a multi-dimensional evaluation auxiliary mechanism, by real-time analysis at different microscope focusing positions, The blur parameters of each pixel and the target detection results are analyzed to comprehensively evaluate the quality of the focus position of the microscope, which reduces the error in detecting stratified and dynamically moving target objects, improves the focus accuracy, optimizes the target coverage capability, and ensures stable focus in dynamic and complex scenes. In addition, this method calculates the adaptive local standard deviation in real time, dynamically adjusts the local standard deviation, and quickly locates the rough focus area. The energy distribution method is used to adjust the blur parameters according to the local energy changes, optimize the focus in real time, and continuously improve the focus accuracy. The multi-dimensional evaluation auxiliary mechanism is used to analyze the target detection, blur parameters and image clarity in real time, and comprehensively evaluate the focus position of the microscope. Finally, fast and stable focusing is achieved to meet the real-time requirements and ensure accurate and efficient focusing in complex dynamic scenes. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] In order to make the content of the present invention more clearly understood, the present invention is further described in detail below according to specific embodiments of the present invention in conjunction with the accompanying drawings, wherein:
[0054] Figure 1 The present invention provides a flowchart of an automatic focusing method. DETAILED DESCRIPTION
[0055] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it, but the embodiments are not intended to limit the present invention.
[0056] Reference Figure 1 As shown, Figure 1 A flowchart of an automatic focusing method provided by the present invention; specifically comprising:
[0057] S1: Acquire an image at the initial focus position of the microscope as the original image; set the dynamic search range of the microscope focus position based on the moving range of the motion control platform; wherein the initial focus position of the microscope is ; The dynamic search range of the microscope focus position is , , ; Initialize the standard deviation of the adaptive Gaussian filter to the initial value;
[0058] S2: Based on the numerical aperture, wavelength and defocus of the microscope, the standard deviation of the point spread function is obtained, which is expressed as:
[0059] ;
[0060] in, represents the standard deviation of the point spread function; represents the proportionality factor, which is determined by the overall characteristics of the microscope optical system, that is, the numerical aperture of the microscope and wavelength of light Sure, ; Indicates the defocus amount, which is the core variable for dynamically adjusting the focal length position;
[0061] This process provides a preliminary estimate of the global blur, which provides a basis for subsequent adjustment of blur parameters and precise optimization. Simplified on the basis of global blur, the expression of the point spread function model is: In the prior art, the expression of the blurred image can be obtained by using the expression of the original image and the point spread function model: ;in, Indicates a blurred image; represents the original image;
[0062] S3: taking each pixel in the original image as the center, obtaining the local area corresponding to each pixel in the original image according to the preset window size, and calculating the local variance of each pixel; obtaining the local standard deviation of each pixel based on the standard deviation of the point spread function and the local variance of each pixel; obtaining the pixel value of each pixel in the local area of the original image based on the pixel value of each pixel in the original image and its corresponding local area; obtaining the pixel value of each pixel in the Gaussian filtered image based on the weight function of the adaptive Gaussian filter and the pixel value of each pixel in the local area of the original image, including:
[0063] S31: Pixel points in the original image As the center, according to the preset window size, get the pixel points in the original image The corresponding local area and calculate the pixel points The local variance of is expressed as:
[0064] ;
[0065] in, Represents pixel The local variance is used to reflect the degree of change in local clarity; Indicates the preset window size; Indicates the pixel point in the original image The corresponding pixel point in the local area The pixel value of Indicates the pixel point in the original image The pixel mean of all pixels in the corresponding local area;
[0066] S32: Standard deviation and pixel points based on point spread function The local variance of the pixel is obtained The local standard deviation of is expressed as:
[0067] ;
[0068] in, Represents pixel The local standard deviation of represents the standard deviation of the point spread function; Represents the adjustment factor, which is used to control the influence of local features on the filtering parameters; Represents pixel The local standard deviation is dynamically adjusted according to the local features (local variance) of the image to adapt to the blur degree of different areas in the image, ensuring that the blur degree is kept low in the clear area of the image, that is, the blur is reduced in the clear area, and the blur enhancement effect is maintained in the blurred or noisy area of the image, thereby providing a preliminary search for accurate focus positioning;
[0069] S33: Based on the pixel value of each pixel in the original image and its corresponding local area, the pixel value of each pixel in the local area of the original image is obtained; based on the weight function of the adaptive Gaussian filter and the pixel value of each pixel in the local area of the original image, the pixel value of each pixel in the Gaussian filtered image is obtained, and its expression is:
[0070] ;
[0071] in, Represents the pixel point in the Gaussian filtered image The pixel value of Represents pixel The local standard deviation of Indicates based on The weight function of the constructed adaptive Gaussian filter; Represents pixel The corresponding weights of the adaptive Gaussian filter; Indicates the pixel point in the original image Pixel points in the local area The pixel value of
[0072] In summary, through dynamic adjustment ,The adaptive Gaussian filter weakens the smoothing effect in the area with high local clarity of the image to retain the details, and enhances the smoothing effect in the blurred or noisy area to suppress interference; ,This stage is in the dynamic search stage, and performs rough focus positioning to complete ,preliminary positioning;
[0073] S4: Based on the pixel value of each pixel in the Gaussian filtered image and the pixel value of the pixel after the relative position offset in its local area, the local energy of each pixel in the Gaussian filtered image is obtained, and its expression is:
[0074] ;
[0075] in, Represents the pixel point in the Gaussian filtered image The local energy of Represents pixel The relative position offset within its local area The pixel value after Indicated in pixels The center of the window is Pixels Relative position offset within a local area; Indicates the horizontal direction relative to the center pixel The change in position of Indicates the vertical direction relative to the center pixel The change in position of Represents the pixel point in the Gaussian filtered image The pixel value of Indicates the window radius, the default window size is ,but ;
[0076] Based on the mapping function between energy and blur parameter and the local energy of each pixel in the Gaussian filtered image, the blur parameter of each pixel is obtained, and its expression is:
[0077] ;
[0078] in, Represents pixel The fuzzy parameters of Represents the mapping function between energy and fuzzy parameters; Represents the pixel point in the Gaussian filtered image The local energy of the image; dynamically adjust the blur parameters according to the local clarity of the image;
[0079] The Gaussian filter image is subjected to weighted blur processing based on the blur parameter of each pixel to obtain an energy distribution image;
[0080] In summary, after the initial positioning of S3 is completed, the fine search stage is entered. In this stage, the local energy of the image is calculated by the energy analysis method, and then the fuzzy parameters are optimized according to the local energy, so that the area with higher energy corresponds to a lower fuzzy parameter, and the image remains clear; the area with lower energy corresponds to a larger fuzzy parameter, which is used to smooth the noise; this optimization strategy can dynamically adjust the fuzzy parameter according to the change of local energy of the image to improve the focusing accuracy of the image;
[0081] S5: Detect all target objects and their total number in the energy distribution image, select target objects with confidence greater than a threshold from all target objects as confidence target objects, and obtain the number of confidence target objects, which is expressed as:
[0082] ;
[0083] in, Indicates the number of confidence target objects; Indicates the total number of target objects; represents the indicator function, if ,but ,like ,but ; Indicates The confidence level of the target object; represents the confidence threshold;
[0084] Within the dynamic search range of the microscope focus position, the objective function is constructed with the goal of maximizing the weighted sum of the number of confidence target objects and the total number of target objects. Its expression is:
[0085] ;
[0086] in, Indicates the focus position of the microscope; Indicates the dynamic search range of the microscope focus position; Indicates the starting threshold of the microscope focus position; Indicates the microscope focus position termination threshold; Indicates the focus position of the microscope The total number of target objects at the time of Indicates the focus position of the microscope The number of target objects with confidence at the time; The weight representing the number of confidence target objects;
[0087] According to the clarity threshold and the reliability threshold, the fuzzy parameter constraint and the confidence target object quantity constraint are determined; wherein the expression of the fuzzy parameter constraint is: ; The expression of the confidence target object quantity constraint is: ;in, Indicates the focus position of the microscope; Indicates the focus position of the microscope Pixel at time The fuzzy parameters of represents the clarity threshold; Indicates the focus position of the microscope The number of target objects with confidence at the time; represents the reliability threshold;
[0088] Based on the fuzzy parameter constraints and the confidence target object quantity constraints, the objective function is optimized; wherein, the optimization of the focal position is completed by dynamically solving the objective function, that is, the optimization objective function evaluates the quality of the focal position by combining the fuzzy parameters and the high confidence target quantity;
[0089] When the total number of target objects reaches the maximum value, the number of confidence target objects exceeds the reliability threshold and the blur parameter is less than the clarity threshold, the optimization is terminated, and the focus position at the time of optimization termination is used as the optimal focus position of the microscope; by calculating the target detection results and blur parameters in real time, the system continuously optimizes the focal position until the optimization termination condition is reached;
[0090] In summary, in the fine optimization stage, the present invention introduces a multi-dimensional evaluation auxiliary mechanism to comprehensively evaluate the focal position by combining the target detection results, blur parameters and image clarity. By real-time analysis of the target detection results, blur parameters and image clarity, the optimization effect of the focal position is comprehensively evaluated to further improve the robustness.
[0091] The present invention can optimize precise focal plane positioning and achieve high-precision automatic focusing in complex dynamic scenes by dynamically adjusting blur parameters and comprehensively evaluating target detection results. It is particularly suitable for scenes that require high-precision image focusing, such as sperm analysis and cytological research, and can effectively overcome the accuracy problems of traditional automatic focusing methods in dynamic scenes and improve the robustness of image processing.
[0092] The present invention is based on image blur and target detection results and achieves accurate selection of focus position by introducing a multi-dimensional evaluation auxiliary mechanism; the present invention can analyze target detection results, blur parameter changes and clarity evaluation in real time during the focusing process to ensure a balance between image clarity and target coverage capability; the present invention can comprehensively analyze target detection results, blur parameters and image clarity to optimize the focal position in real time, overcome the limitations of the prior art in dynamic scenes, ensure a balance between image clarity and target coverage capability, and thus provide a more efficient and accurate automatic focusing solution.
[0093] The present invention provides an automatic focusing method, which realizes efficient positioning near the focal plane through a strategy of combining dynamic search and fine optimization; a preliminary search is performed through a larger step size in the dynamic search stage, and a precise search is performed through a smaller step size in the fine optimization stage; this multi-stage search strategy can provide faster focusing speed and higher focusing accuracy in different focal length positions and dynamic scenes
[0094] In a specific embodiment of the present invention, the present invention further provides a microscope image acquisition device, comprising:
[0095] A microscope is placed directly above the motion control platform and connected to the motion control platform through an optical interface; it is used to magnify and view the details of the target object sample;
[0096] The camera is a high-resolution CCD camera installed at the imaging port of the microscope and connected to the computer via a high-speed data transmission line; it is used to collect microscope images and transmit the collected microscope images to the computer;
[0097] Motion control platform, equipped with electric Z-axis adjuster, connected to computer for communication; used to place target object samples and control the adjustment of microscope focus position;
[0098] A computer has a built-in program for the above-mentioned automatic focusing method, which is used to execute the built-in program, process and collect microscope images, adjust the position of the motion control platform, realize automatic focusing of the microscope, and obtain the microscope image after automatic focusing.
[0099] Compared with the prior art, the present invention has the following characteristics:
[0100] 1. Combining adaptive Gaussian filtering with point spread function (PSF) model: Most existing autofocus methods rely on fixed blur parameters or global blur characteristics, and fail to effectively adapt to the blur levels of different areas in the image. In contrast, the present invention combines adaptive Gaussian filtering with a simplified point spread function (PSF) model, which can dynamically adjust blur parameters based on the description of global blur characteristics. , effectively optimizing the local blur of the image and improving the accuracy and robustness of focusing.
[0101] 2. Multi-dimensional evaluation auxiliary mechanism: Traditional focusing methods often rely only on image clarity indicators for optimization, ignoring the impact of target coverage on focusing results. In contrast, the present invention introduces a multi-dimensional evaluation auxiliary mechanism, which comprehensively evaluates the quality of the focal position by analyzing blur parameters and target detection results in real time. This innovative mechanism effectively overcomes the target detection error caused by stratification and dynamic swimming in sperm images, and can optimize the target coverage while ensuring focusing accuracy, ensuring stable focusing in complex scenes.
[0102] 3. Combination of dynamic search and precise optimization: Traditional autofocus methods usually require two steps of coarse search and fine search to locate the focal length, and are prone to fall into the local optimal solution, especially when far away from the focal plane. In contrast, the present invention adopts a strategy of combining dynamic search with fine optimization, and achieves precise positioning through a small range of dynamic search near the focal plane. This strategy not only improves the focusing efficiency, but also avoids the local optimal problem common in traditional methods.
[0103] 4. Real-time processing and efficient implementation: The existing technology of automatic focusing in dynamic scenes often faces high computational complexity and is difficult to meet real-time requirements. The automatic focusing algorithm proposed in this paper ensures the accuracy of real-time image processing and focusing by calculating while walking. This technology can achieve fast and stable focusing in dynamic and complex environments, and is particularly suitable for application scenarios with high precision requirements such as sperm analysis.
[0104] 5. Improved robustness and accuracy: Traditional focusing methods usually have poor accuracy and robustness under complex factors such as noise, illumination changes, and background interference. However, the present invention uses adaptive Gaussian filtering, PSF model, and multi-dimensional evaluation mechanism to optimize blur, target detection, and image clarity in real time during image processing, greatly improving the robustness and accuracy of the focusing process, especially in dynamic and low-contrast environments.
[0105] 6. Strong adaptability, suitable for multi-field applications: The automatic focusing algorithm proposed in the present invention can adaptively adjust the focusing strategy according to different image features in dynamic scenes, thereby ensuring the accuracy and stability of the focusing process. Unlike traditional methods, the present invention is not only suitable for focusing of biomedical imaging and microscope images, but can also be widely used in industrial detection, real-time video analysis, unmanned driving, automatic control and other fields, especially in applications with high precision and real-time requirements, it has obvious advantages. For example:
[0106] (1) Biomedical imaging: In the biomedical field, especially in microscope image analysis, images of cells and tissues are often affected by complex background interference and dynamic changes of target objects. Traditional focusing methods are difficult to effectively cope with these challenges, while the present invention can accurately focus and optimize the coverage of the target by adjusting blur parameters and target detection results in real time. Whether in sperm analysis, cell segmentation or tissue imaging, the present invention can provide excellent focusing accuracy, and is particularly suitable for focusing requirements of multi-level images and dynamic objects.
[0107] (2) Industrial inspection and non-destructive testing: In the industrial field, the automatic focusing technology of the present invention can be widely used in high-precision non-destructive testing systems, such as surface defect detection, welding quality detection, etc. Whether it is the detection of tiny cracks on the metal surface or the three-dimensional image analysis of complex products, the present invention can optimize the focal position in real time according to the local blur of the image, improve the detection accuracy, and avoid focusing problems caused by the position of the workpiece or surface irregularities. Its dynamic search and fine optimization combination strategy makes this method particularly suitable for rapidly changing industrial environments.
[0108] (3) Real-time video processing and target tracking: In applications such as real-time video processing, security monitoring, and autonomous driving, the present invention provides a multi-dimensional comprehensive evaluation mechanism based on image clarity and target detection results. This mechanism can identify the target position in the image in real time and dynamically optimize according to blur, image clarity, and target detection accuracy to ensure clear focus on the target. Whether it is nighttime monitoring under low light conditions or dynamic target tracking in a high-speed motion environment, the present invention can efficiently and stably provide real-time focusing to ensure image quality and target positioning accuracy.
[0109] (4) Unmanned driving and automatic navigation systems: In unmanned driving and robot navigation systems, the focusing accuracy of the visual system directly affects the accuracy of target recognition and path planning. Based on the focusing algorithm of the present invention, the automatic focusing technology can optimize the focus plane in real time, and can effectively improve the clarity and recognition ability of the camera image regardless of complex road environments or different lighting conditions. This method can ensure that the camera focuses quickly and maintains image clarity in a dynamically changing environment, thereby improving the response speed and accuracy of the autonomous driving system.
[0110] (5) Intelligent manufacturing and automated control: The present invention can also be applied to the field of intelligent manufacturing, such as automated inspection, robot control and other scenarios. By performing real-time automatic focusing on industrial production lines, the technology can accurately locate workpieces and products in the production process and optimize the assembly, inspection and operation processes. In 3D scanning or high-precision measurement systems, the present invention can ensure that the optimal focusing state is maintained at different workpiece positions and angles, thereby improving production efficiency and ensuring product quality.
[0111] (6) Adaptability in dynamic environments: Unlike traditional autofocus technology, the autofocus algorithm of the present invention does not rely on fixed optical parameters, but responds to changes in the environment by adaptively adjusting blur parameters. In dynamic scenes (such as robot vision systems or real-time medical image processing), this technology can quickly adjust when the target object is at different focal lengths, and is not affected by factors such as lighting and background changes, so it has excellent robustness and accuracy.
[0112] In summary, compared with the prior art, this embodiment has significant innovations and advantages in focusing accuracy, real-time performance, robustness and adaptability, and is particularly suitable for application scenarios such as sperm analysis and cytological research that require precise focusing and target detection.
[0113] Obviously, the above embodiments are merely examples for the purpose of clear explanation and are not intended to limit the implementation methods. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the implementation methods here. The obvious changes or modifications derived therefrom are still within the scope of protection of the present invention.
Claims
1. An automatic focusing method, characterized in that: include: An image at an initial focus position of the microscope is acquired as an original image; a dynamic search range of the focus position of the microscope is set based on the moving range of the motion control platform; Based on the numerical aperture of the microscope, the wavelength of light, and the defocus, the standard deviation of the point spread function is obtained; Taking each pixel in the original image as the center, according to the preset window size, obtain the local area corresponding to each pixel in the original image, and calculate the local variance of each pixel; Based on the standard deviation of the point spread function and the local variance of each pixel, the local standard deviation of each pixel is obtained; based on the pixel value of each pixel in the original image and its corresponding local area, the pixel value of each pixel in the local area of the original image is obtained; based on the weight function of the adaptive Gaussian filter and the pixel value of each pixel in the local area of the original image, the pixel value of each pixel in the Gaussian filtered image is obtained; Based on the pixel value of each pixel in the Gaussian filter image and the pixel value of the pixel after the relative position offset in its local area, the local energy of each pixel in the Gaussian filter image is obtained; based on the mapping function between energy and blur parameter and the local energy of each pixel in the Gaussian filter image, the blur parameter of each pixel is obtained; based on the blur parameter of each pixel, the Gaussian filter image is weighted blurred to obtain an energy distribution image; Detect all target objects and their total number in the energy distribution image, select target objects with confidence greater than a threshold from all target objects as confidence target objects, and obtain the number of confidence target objects; Within the dynamic search range of the microscope focus position, an objective function is constructed with the goal of maximizing the weighted sum of the number of confidence target objects and the total number of target objects; According to the clarity threshold and reliability threshold, after determining the fuzzy parameter constraint and the confidence target object number constraint, the objective function is optimized; when the total number of target objects reaches the maximum value, the number of confidence target objects exceeds the reliability threshold and the fuzzy parameter is less than the clarity threshold, the optimization is terminated, and the focus position at the time of optimization termination is used as the optimal focus position of the microscope.
2. An automatic focusing method according to claim 1, characterized in that: The standard deviation of the point spread function is obtained based on the numerical aperture, light wavelength and defocus of the microscope, and its expression is: ; in, represents the standard deviation of the point spread function; represents the proportionality coefficient, ; It represents the numerical aperture of the microscope; Indicates the wavelength of light from the microscope; Indicates the amount of defocus.
3. The automatic focusing method according to claim 1, characterized in that: The method takes each pixel in the original image as the center, obtains the local area corresponding to each pixel in the original image according to the preset window size, and calculates the local variance of each pixel; Based on the standard deviation of the point spread function and the local variance of each pixel, the local standard deviation of each pixel is obtained: The pixels in the original image As the center, according to the preset window size, get the pixel points in the original image The corresponding local area and calculate the pixel points The local variance of is expressed as: ; in, Represents pixel The local variance of Indicates the preset window size; Indicates the pixel in the original image The corresponding pixel point in the local area The pixel value of Indicates the pixel in the original image The pixel mean of all pixels in the corresponding local area; Standard deviation and pixel points based on point spread function The local variance of the pixel is obtained The local standard deviation of is expressed as: ; in, Represents pixel The local standard deviation of represents the standard deviation of the point spread function; represents the regulating factor; Represents pixel The local variance of .
4. The automatic focusing method according to claim 1, characterized in that: The weight function based on the adaptive Gaussian filter and the pixel value of each pixel in the local area of the original image are used to obtain the pixel value of each pixel in the Gaussian filtered image, and the expression is: ; in, Represents the pixel point in the Gaussian filtered image The pixel value of Represents pixel The local standard deviation of Indicates based on The weight function of the constructed adaptive Gaussian filter; Represents pixel The corresponding weights of the adaptive Gaussian filter; Indicates the pixel point in the original image Pixel points in the local area The pixel value of .
5. The automatic focusing method according to claim 1, characterized in that: Based on the pixel value of each pixel in the Gaussian filter image and the pixel value of the pixel after the relative position offset in its local area, the local energy of each pixel in the Gaussian filter image is obtained, and its expression is: ; in, Represents the pixel point in the Gaussian filtered image The local energy of Represents pixel The relative position offset within its local area The pixel value after Indicated in pixels The center of the window is Pixels Relative position offset within a local area; Indicates the horizontal direction relative to the center pixel The change in position of Indicates the vertical direction relative to the center pixel The change in position of Represents the pixel point in the Gaussian filtered image The pixel value of Indicates the window radius, the default window size is ,but .
6. The automatic focusing method according to claim 1, characterized in that: The mapping function between energy and blur parameter and the local energy of each pixel in the Gaussian filter image is used to obtain the blur parameter of each pixel, and its expression is: ; in, Represents pixel The fuzzy parameters of Represents the mapping function between energy and fuzzy parameters; Represents the pixel point in the Gaussian filtered image The local energy.
7. The automatic focusing method according to claim 1, characterized in that: The target objects with confidence greater than a threshold are selected from all target objects as confidence target objects, and the number of confidence target objects is obtained, and the expression is: ; in, Indicates the number of confidence target objects; Indicates the total number of target objects; represents the indicator function, if ,but ,like ,but ; Indicates The confidence level of the target object; Represents the confidence threshold.
8. The automatic focusing method according to claim 1, characterized in that: The objective function is constructed with the goal of maximizing the weighted sum of the number of confidence target objects and the total number of target objects, and its expression is: ; in, Indicates the focus position of the microscope; Indicates the dynamic search range of the microscope focus position; Indicates the starting threshold of the microscope focus position; Indicates the microscope focus position termination threshold; Indicates the focus position of the microscope The total number of target objects at the time of Indicates the focus position of the microscope The number of target objects with confidence at the time; The weight representing the number of confidence target objects.
9. The automatic focusing method according to claim 1, characterized in that: Determining the fuzzy parameter constraint and the confidence target object quantity constraint according to the clarity threshold and the reliability threshold includes: The expression of the fuzzy parameter constraint is: ; in, Indicates the focus position of the microscope; Indicates the focus position of the microscope Pixel at time The fuzzy parameters of represents the clarity threshold; The expression of the confidence target object quantity constraint is: ; in, Indicates the focus position of the microscope The number of target objects with confidence at the time; Represents the reliability threshold.
10. A microscope image acquisition device, characterized in that: include: A microscope is placed directly above the motion control platform and connected to the motion control platform through an optical interface; it is used to magnify and view the details of the target object sample; The camera is a high-resolution CCD camera installed at the imaging port of the microscope and connected to the computer via a high-speed data transmission line; it is used to collect microscope images and transmit the collected microscope images to the computer; Motion control platform, equipped with electric Z-axis adjuster, connected to computer for communication; used to place target object samples and control the adjustment of microscope focus position; A computer having a built-in program of an automatic focusing method as described in any one of claims 1 to 9, which is used to execute the built-in program, process and collect microscope images, adjust the position of the motion control platform, realize automatic focusing of the microscope, and obtain the microscope image after automatic focusing.
Citation Information
Patent Citations
Defocus blurred image definition detecting method based on edge strength weight
CN104637064A
Microscope automatic focusing method, based on laser image, system and computer equipment
CN111679418A
Algorithm and device for image processing
US20160048952A1
Apparatus and method for measuring focal plane separation
US5642441A
Robust autofocus system for a microscope
WO2000075709A1
Cited By
Method for automatically positioning Gaussian light sheet center based on confocal scanning light field microscope
CN120802481A
Large-scale flexible body surface microstructure defect detection device and method
CN121856269A