An autofocus method and a microscope image acquisition device
By combining point spread function and adaptive Gaussian filtering, the local blur parameters are dynamically adjusted and the blur parameters are optimized in real time, which solves the problems of insufficient robustness and accuracy of existing autofocus methods in dynamic scenes, and achieves efficient and accurate autofocus.
Patent Information
- Application Number
- CN202411963854.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2044-12-30
AI Technical Summary
Existing autofocus methods fail to effectively combine global and local blur characteristics in dynamically changing scenes, resulting in poor robustness. They also fail to balance the coverage of target quantity and the image sharpness, easily getting trapped in local optima, and having low focusing accuracy and efficiency.
By combining the point spread function model with adaptive Gaussian filtering, and by dynamically adjusting local fuzzy parameters, and utilizing energy distribution methods and multi-dimensional evaluation assistance mechanisms, the focusing position is optimized, achieving a combination of global and local fuzzy characteristics. Dynamic search and fine optimization strategies are employed to adjust fuzzy parameters and target detection results in real time.
It improves focusing accuracy and robustness, enabling fast and stable focusing in complex dynamic scenes, ensuring a balance between image clarity and target coverage, and is suitable for applications with high precision and real-time requirements.
Smart Images

Figure CN120103597B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing and autofocus technology, and in particular to an autofocus method and a microscope image acquisition device. Background Technology
[0002] Autofocus technology has been widely used in fields such as microscopy imaging, medical image analysis, and automated detection systems. In particular, precise focusing is crucial when processing biomedical images such as sperm analysis and cytology.
[0003] Existing autofocus methods mainly include those based on image sharpness, contrast, and frequency domain analysis. These methods evaluate the focus state by calculating the gradient changes or blur levels in local image regions. Common image sharpness-based methods include gradient methods, Laplacian methods, and Brenner methods. These methods suffer from high noise sensitivity and significant dependence on changes in image background and illumination, resulting in poor image quality or low contrast in complex dynamic scenes, which affects focusing accuracy.
[0004] To address the aforementioned issues, the point spread function (PSF) model was introduced into the field of autofocus. The PSF model can describe the blurring characteristics of an optical system and theoretically provides a quantification of global blur. However, most existing PSF models assume that the blur level of an image is globally consistent and lack the ability to dynamically adapt to local areas of the image. This makes the model less adaptable in complex scenes and unable to effectively handle changes in blur level in different areas, especially in cases of dynamic changes or when the target overlaps with the background.
[0005] In recent years, focusing methods based on adaptive filtering have been gradually applied to overcome the limitations of fixed blur parameters. However, this method relies on changes in local image features and fails to effectively combine global blur characteristics with local blur characteristics, resulting in poor robustness and low focusing accuracy in dynamic and complex scenes.
[0006] Furthermore, existing autofocus methods often fail to balance the coverage of target quantity and the balance of image sharpness, especially when the target object is moving dynamically or layered. Existing autofocus methods are prone to getting stuck in local optima and cannot effectively achieve accurate focusing. Summary of the Invention
[0007] Therefore, the technical problem to be solved by the present invention is to overcome the problems in the prior art that do not consider combining global fuzziness characteristics with local fuzziness characteristics, resulting in poor robustness in dynamically changing scenes and thus low focusing accuracy; and that do not take into account the coverage of the number of target objects and the balance of image clarity, resulting in getting stuck in local optima when the target objects are dynamic and layered, resulting in low focusing efficiency and effect.
[0008] To solve the above-mentioned technical problems, the present invention provides an automatic focusing method, comprising:
[0009] Acquire the image at the initial focusing position of the microscope as the original image; set the dynamic search range of the microscope focusing position based on the movement range of the motion control platform;
[0010] The standard deviation of the point spread function is obtained based on the numerical aperture, wavelength, and defocus of the microscope.
[0011] Using each pixel in the original image as the center and according to a preset window size, the local region corresponding to each pixel in the original image is obtained, and the local variance of each pixel is calculated. 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 region, the pixel value of each pixel in the original image within the local region is obtained. Based on the weight function of the adaptive Gaussian filter and the pixel value of each pixel in the original image within the local region, the pixel value of each pixel in the Gaussian-filtered image is obtained.
[0012] Based on the pixel value of each pixel in the Gaussian-filtered image and the pixel value after the relative position offset of the pixel in its local region, the local energy of each pixel in the Gaussian-filtered image is obtained; based on the mapping function between energy and blur parameters and the local energy of each pixel in the Gaussian-filtered image, the blur parameters of each pixel are obtained; based on the blur parameters of each pixel, the Gaussian-filtered image is subjected to weighted blur processing to obtain the energy distribution image;
[0013] All target objects and their total number in the energy distribution image are detected. Target objects with a confidence level greater than a threshold are selected as confidence target objects, and the number of confidence target objects is obtained. Within the dynamic search range of the microscope's focusing 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 fuzziness parameter constraints and the number of confidence target objects constraints based on the sharpness threshold and the reliability threshold, the objective function is optimized. Optimization terminates when the total number of target objects reaches its maximum value, the number of confidence target objects exceeds the reliability threshold, and the fuzziness parameter is less than the sharpness threshold. The focusing position at the termination of optimization is taken as the optimal focusing position of the microscope.
[0014] Preferably, the standard deviation of the point spread function is obtained based on the numerical aperture, wavelength, and defocus of the microscope, and its expression is:
[0015] ;
[0016] in, This represents the standard deviation of the point spread function; This represents the proportionality coefficient. ; Indicates the numerical aperture of the microscope; Indicates the wavelength of light emitted by the microscope; Indicates the amount of defocus.
[0017] Preferably, the step of obtaining the local region corresponding to each pixel in the original image, centered on each pixel and 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] pixels in the original image Centered on a preset window size, obtain the pixels in the original image. The corresponding local region is calculated, and the pixel points are determined. The local variance of is expressed as:
[0019] ;
[0020] in, Represents pixels Local variance; Indicates the preset window size; Represents the pixel in the original image Pixels in the corresponding local area Pixel values; Represents the pixel in the original image The average pixel value of all pixels within the corresponding local region;
[0021] Based on the standard deviation of the point spread function and pixel points The local variance is used to obtain the pixel points. The local standard deviation is expressed as:
[0022] ;
[0023] in, Represents pixels Local standard deviation; This represents the standard deviation of the point spread function; Indicates the regulating factor; Represents pixels The local variance.
[0024] Preferably, the pixel value of each pixel in the Gaussian-filtered image is obtained by using the weight function based on the adaptive Gaussian filter and the pixel value of each pixel in the original image within a local region, and its expression is as follows:
[0025] ;
[0026] in, Represents the pixels in a Gaussian filtered image Pixel values; Represents pixels Local standard deviation; Indicates based on The weighting function of the constructed adaptive Gaussian filter; Represents pixels The corresponding weights of the adaptive Gaussian filter; Represents the pixel in the original image Pixels in a local area The pixel value.
[0027] Preferably, the local energy of each pixel in the Gaussian-filtered image is obtained based on the pixel value of each pixel and the pixel value after the relative position offset within its local region. The expression for this local energy is as follows:
[0028] ;
[0029] in, Represents the pixels in a Gaussian filtered image Local energy; Represents pixels Relative position offset within its local area The resulting pixel value; Represented by pixels Centered on, with a window radius of pixels The relative position offset within a local area; Represents the horizontal direction relative to the center pixel. The change in position; Represents the vertical direction relative to the center pixel. The change in position; Represents the pixels in a Gaussian filtered image Pixel values; This represents the window radius, with a default window size of [value missing]. ,but .
[0030] Preferably, the blur parameter of each pixel is obtained based on the mapping function between energy and blur parameters and the local energy of each pixel in the Gaussian filtered image, and its expression is:
[0031] ;
[0032] in, Represents pixels fuzzy parameters; A mapping function representing the relationship between energy and fuzzy parameters; Represents the pixels in a Gaussian filtered image Local energy.
[0033] Preferably, the step of selecting target objects with a confidence level greater than a threshold from all target objects as confidence target objects and obtaining the number of confidence target objects is expressed as follows:
[0034] ;
[0035] in, Indicates the number of target objects with confidence level; Indicates the total number of target objects; Indicates an indicator function, if ,but ,like ,but ; Indicates the first Confidence level of each target object; This 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 focusing position of the microscope; Indicates the dynamic search range of the microscope's focusing position; Indicates the initial threshold for the microscope's focusing position; This indicates the threshold for terminating the microscope's focusing position. Indicates the focusing position of the microscope The total number of target objects at the time of the event; Indicates the focusing position of the microscope The number of target objects with confidence level at that time; The weights represent the number of target objects for confidence level.
[0039] Preferably, determining the fuzzy parameter constraints and the confidence target object number constraints based on the sharpness threshold and the reliability threshold includes:
[0040] The expression for the fuzzy parameter constraint is:
[0041] ;
[0042] in, Indicates the focusing position of the microscope; Indicates the focusing position of the microscope Pixels at time fuzzy parameters; Indicates the sharpness threshold;
[0043] The expression for the confidence level target object quantity constraint is:
[0044] ;
[0045] in, Indicates the focusing position of the microscope The number of target objects with confidence level at that time; This represents the reliability threshold.
[0046] The present invention also provides a microscope image acquisition device, comprising:
[0047] The microscope, positioned directly above the motion control platform, is connected to the platform via an optical interface; it is used to magnify and examine the details of the target object sample.
[0048] The camera, a high-resolution CCD camera, is installed at the imaging port of the microscope and connected to the computer via a high-speed data transmission cable; it is used to acquire microscope images and transmit the acquired microscope images to the computer.
[0049] The motion control platform, equipped with an electric Z-axis adjuster and connected to a computer, is used to place the target object sample and control the adjustment of the microscope's focusing position.
[0050] The computer has a built-in program for the autofocusing method described above, which is used to execute the built-in program, process and acquire microscope images, adjust the position of the motion control platform, realize the automatic focusing of the microscope, and acquire the microscope image after autofocusing.
[0051] Compared with the prior art, the above-described technical solution of the present invention has the following advantages:
[0052] This invention discloses an automatic focusing method that combines a point spread function model with adaptive Gaussian filtering. This allows for dynamic adjustment of local blur parameters based on a global blur characteristic description, effectively combining global and local blur characteristics to optimize local image blur parameters and improve focusing accuracy and robustness. The method utilizes adaptive Gaussian filtering to dynamically adjust the local standard deviation based on local image features, achieving dynamic search. It also employs an energy distribution method, adjusting blur parameters based on an energy-blur parameter mapping function, to achieve fine optimization. By combining dynamic search and fine optimization strategies, precise positioning is achieved through dynamic search within a small area near the focal plane, improving focusing efficiency. Finally, a multi-dimensional evaluation auxiliary mechanism is introduced, which performs real-time analysis at different microscope focusing positions. This method analyzes the blur parameters of each pixel and the target detection results to comprehensively evaluate the quality of the microscope's focusing position. This reduces the error in detecting layered or dynamically moving targets, improves focusing accuracy, optimizes target coverage, and ensures stable focusing in dynamic and complex scenes. Furthermore, this method rapidly locates a coarse focusing area by dynamically adjusting the local standard deviation in real time. Using the energy distribution method, blur parameters are adjusted based on local energy changes to optimize focusing in real time and continuously improve focusing accuracy. A multi-dimensional evaluation mechanism is used to analyze target detection, blur parameters, and image sharpness in real time to comprehensively evaluate the microscope's focusing position. Ultimately, this method achieves rapid and stable focusing, meeting real-time requirements and ensuring accurate and efficient focusing in complex and dynamic scenes. Attached Figure Description
[0053] To make the content of this invention easier to understand, the invention will be further described in detail below with reference to specific embodiments and accompanying drawings, wherein:
[0054] Figure 1 This is a flowchart of an autofocusing method provided by the present invention. Detailed Implementation
[0055] The present invention will be further described below with reference to the accompanying drawings and specific embodiments, so that those skilled in the art can better understand and implement the present invention. However, the embodiments described are not intended to limit the present invention.
[0056] Reference Figure 1 As shown, Figure 1 A flowchart of an autofocusing method provided by the present invention; specifically including:
[0057] S1: Acquire the image at the initial focusing position of the microscope as the original image; based on the movement range of the motion control platform, set the dynamic search range for the microscope focusing position; wherein, the initial focusing position of the microscope is... The dynamic search range for the microscope's focusing position is: , , Initialize the standard deviation of the adaptive Gaussian filter to its initial value.
[0058] S2: Based on the microscope's numerical aperture, wavelength, and defocus, the standard deviation of the point spread function is obtained, and its expression is:
[0059] ;
[0060] in, This represents the standard deviation of the point spread function; The proportionality coefficient is determined by the overall characteristics of the microscope's optical system; it is the numerical aperture through which the microscope can pass. and wavelength of light Sure, ; It represents the amount of defocus and is the core variable for dynamically adjusting the focal length position;
[0061] This process provides a preliminary estimate of the global fuzziness, laying the foundation for subsequent fuzziness parameter adjustments and precise optimization. Based on the global fuzziness, a simplified expression for the point spread function model is obtained: In existing technologies, the expression for a blurred image can be obtained by combining the original image with the expression of the point spread function model: ;in, Represents a blurred image; Represents the original image;
[0062] S3: Taking each pixel in the original image as the center and according to a preset window size, obtain the local region 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 region, obtain the pixel value of each pixel in the original image within the local region; based on the weight function of the adaptive Gaussian filter and the pixel value of each pixel in the original image within the local region, obtain the pixel value of each pixel in the Gaussian-filtered image, including:
[0063] S31: Using pixels from the original image Centered on a preset window size, obtain the pixels in the original image. The corresponding local region is calculated, and the pixel points are determined. The local variance of is expressed as:
[0064] ;
[0065] in, Represents pixels The local variance is used to reflect the degree of change in local sharpness; Indicates the preset window size; Represents the pixel in the original image Pixels in the corresponding local area Pixel values; Represents the pixel in the original image The average pixel value of all pixels within the corresponding local region;
[0066] S32: Standard deviation and pixel count based on point spread function The local variance is used to obtain the pixel points. The local standard deviation is expressed as:
[0067] ;
[0068] in, Represents pixels Local standard deviation; This represents the standard deviation of the point spread function; This represents the adjustment factor, used to control the magnitude of the influence of local features on the filter parameters; Represents pixels The local variance; dynamically adjust the local standard deviation according to the local features (local variance) of the image to adapt to the degree of blur in different regions of the image, ensuring that the degree of blur is reduced in clear areas of the image, while maintaining the blur enhancement effect in blurry or noisy areas of the image, thus providing an initial search for accurate focusing and positioning;
[0069] S33: Based on the pixel value of each pixel in the original image and its corresponding local region, obtain the pixel value of each pixel in the original image within the local region; based on the weight function of the adaptive Gaussian filter and the pixel value of each pixel in the original image within the local region, obtain the pixel value of each pixel in the Gaussian-filtered image, the expression of which is:
[0070] ;
[0071] in, Represents the pixels in a Gaussian filtered image Pixel values; Represents pixels Local standard deviation; Indicates based on The weighting function of the constructed adaptive Gaussian filter; Represents pixels The corresponding weights of the adaptive Gaussian filter; Represents the pixel in the original image Pixels in a local area Pixel values;
[0072] In summary, through dynamic adjustment The adaptive Gaussian filter reduces the smoothing effect in areas of high image sharpness to preserve details, and enhances the smoothing effect in blurred or noisy areas to suppress interference; this stage is the dynamic search stage, which performs coarse focus localization and completes the initial localization.
[0073] S4: Based on the pixel value of each pixel in the Gaussian-filtered image and the pixel value after the relative position offset of that pixel through its local region, the local energy of each pixel in the Gaussian-filtered image is obtained, and its expression is:
[0074] ;
[0075] in, Represents the pixels in a Gaussian filtered image Local energy; Represents pixels Relative position offset within its local area The resulting pixel value; Represented by pixels Centered on, with a window radius of pixels The relative position offset within a local area; Represents the horizontal direction relative to the center pixel. The change in position; Represents the vertical direction relative to the center pixel. The change in position; Represents the pixels in a Gaussian filtered image Pixel values; This represents the window radius, with a default window size of [value missing]. ,but ;
[0076] Based on the mapping function between energy and blur parameters, and the local energy of each pixel in the Gaussian filtered image, the blur parameters of each pixel are obtained, and their expression is as follows:
[0077] ;
[0078] in, Represents pixels fuzzy parameters; A mapping function representing the relationship between energy and fuzzy parameters; Represents the pixels in a Gaussian filtered image The local energy; dynamically adjust the blur parameters based on the local sharpness of the image;
[0079] The Gaussian filtered image is weighted and blurred based on the blur parameters of each pixel to obtain the energy distribution image.
[0080] In summary, after the initial localization in S3, the fine search stage begins. In this stage, the local energy of the image is calculated using energy analysis, and then the blur parameters are optimized based on the local energy. This results in regions with higher energy corresponding to lower blur parameters, keeping the image sharp, while regions with lower energy correspond to higher blur parameters to smooth noise. This optimization strategy can dynamically adjust the blur parameters according to changes in the 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 a confidence level greater than a threshold from all target objects as confidence target objects, and obtain the number of confidence target objects. The expression for this number is:
[0082] ;
[0083] in, Indicates the number of target objects with confidence level; Indicates the total number of target objects; Indicates an indicator function, if ,but ,like ,but ; Indicates the first Confidence level of each target object; Indicates the confidence threshold;
[0084] Within the dynamic search range of the microscope's focusing position, an objective function is constructed to maximize the weighted sum of the number of confident target objects and the total number of target objects. Its expression is:
[0085] ;
[0086] in, Indicates the focusing position of the microscope; Indicates the dynamic search range of the microscope's focusing position; Indicates the initial threshold for the microscope's focusing position; This indicates the threshold for terminating the microscope's focusing position. Indicates the focusing position of the microscope The total number of target objects at the time of the event; Indicates the focusing position of the microscope The number of target objects with confidence level at that time; The weights represent the number of target objects for confidence level;
[0087] Based on the sharpness threshold and the reliability threshold, fuzzy parameter constraints and confidence target object quantity constraints are determined; wherein, the expression for the fuzzy parameter constraints is: The expression for the confidence level target object quantity constraint is: ;in, Indicates the focusing position of the microscope; Indicates the focusing position of the microscope Pixels at time fuzzy parameters; Indicates the sharpness threshold; Indicates the focusing position of the microscope The number of target objects with confidence level at that time; Indicates the reliability threshold;
[0088] Based on fuzzy parameter constraints and confidence level target object number constraints, the objective function is optimized; the focal length position is optimized by dynamically solving the objective function, that is, the optimization objective function evaluates the quality of the focal length position by combining fuzzy parameters and the number of high-confidence targets.
[0089] When the total number of target objects reaches its maximum value, the number of target objects with confidence exceeds the reliability threshold, and the blur parameter is less than the sharpness threshold, the optimization terminates, and the focus position at the time of optimization termination is taken as the best focus position of the microscope; by calculating the target detection results and blur parameters in real time, the system continuously optimizes the focus position until the optimization termination condition is met.
[0090] In summary, during the fine optimization stage, this invention introduces a multi-dimensional evaluation assistance mechanism to comprehensively evaluate the focal length position by combining target detection results, blur parameters, and image sharpness. By analyzing target detection results, blur parameters, and image sharpness in real time, the optimization effect of the focal length position is comprehensively evaluated, further improving robustness.
[0091] This invention can optimize the precise focal plane positioning and achieve high-precision autofocus in complex dynamic scenes by dynamically adjusting fuzzy parameters and comprehensively evaluating target detection results. It is particularly suitable for scenarios that require high-precision image focusing, such as sperm analysis and cell biology research. It can effectively overcome the accuracy problems of traditional autofocus methods in dynamic scenes and improve the robustness of image processing.
[0092] This invention, based on image blur and target detection results, introduces a multi-dimensional evaluation assistance mechanism to achieve precise selection of the focus position. It can analyze target detection results, blur parameter changes, and sharpness assessment in real time during the focusing process, ensuring a balance between image sharpness and target coverage. Furthermore, it comprehensively analyzes target detection results, blur parameters, and image sharpness to optimize the focal length position in real time, overcoming the limitations of existing technologies in dynamic scenes and ensuring a balance between image sharpness and target coverage, thus providing a more efficient and accurate autofocus solution.
[0093] The automatic focusing method provided by this invention achieves efficient positioning near the focal plane through a strategy combining dynamic search and fine optimization. The dynamic search phase uses a large step size for initial searching, while the fine optimization phase uses a smaller step size for precise searching. This multi-stage search strategy provides faster focusing speed and higher focusing accuracy at different focal lengths and in dynamic scenes.
[0094] In one specific embodiment of the present invention, the present invention also provides a microscope image acquisition device, comprising:
[0095] The microscope, positioned directly above the motion control platform, is connected to the platform via an optical interface; it is used to magnify and examine the details of the target object sample.
[0096] The camera, a high-resolution CCD camera, is installed at the imaging port of the microscope and connected to the computer via a high-speed data transmission cable; it is used to acquire microscope images and transmit the acquired microscope images to the computer.
[0097] The motion control platform, equipped with an electric Z-axis adjuster and connected to a computer, is used to place the target object sample and control the adjustment of the microscope's focusing position.
[0098] The computer has a built-in program for the autofocusing method described above, which is used to execute the built-in program, process and acquire microscope images, adjust the position of the motion control platform, realize the automatic focusing of the microscope, and acquire the microscope image after autofocusing.
[0099] Compared with the prior art, the present invention has the following characteristics:
[0100] 1. Combining Adaptive Gaussian Filtering and a Simplified Point Spread Function (PSF) Model: Most existing autofocus methods rely on fixed blur parameters or global blur characteristics, failing to effectively adapt to the different levels of blur in different regions of an image. In contrast, this invention combines adaptive Gaussian filtering with a simplified point spread function (PSF) model, enabling dynamic adjustment of blur parameters based on a description of global blur characteristics. It effectively optimizes local blurring in images, improving focusing accuracy and robustness.
[0101] 2. Multi-dimensional Evaluation Assistance Mechanism: Traditional focusing methods often rely solely on image sharpness metrics for optimization, neglecting the impact of target coverage on the focusing result. In contrast, this invention introduces a multi-dimensional evaluation assistance mechanism that comprehensively evaluates the quality of the focal position by analyzing blur parameters and target detection results in real time. This innovative mechanism effectively overcomes target detection errors caused by layering and dynamic movement in sperm images, optimizing target coverage while maintaining focusing accuracy, ensuring stable focusing in complex scenes.
[0102] 3. Combination of Dynamic Search and Precise Optimization: Traditional autofocus methods typically require two steps—coarse search and fine search—to determine the focal length, and are prone to getting trapped in local optima, especially far from the focal plane. In contrast, this invention employs a strategy combining dynamic search and fine optimization, achieving precise positioning through a small-scale dynamic search near the focal plane. This strategy not only improves focusing efficiency but also avoids the local optima problem common in traditional methods.
[0103] 4. Real-time Processing and Efficient Implementation: Existing autofocus technologies often face high computational complexity in dynamic scenes, making it difficult to meet real-time requirements. The autofocus algorithm proposed in this paper ensures real-time image processing and focusing accuracy by performing calculations while moving. This technology can achieve fast and stable focusing in dynamic and complex environments, making it particularly suitable for high-precision applications such as sperm analysis.
[0104] 5. Improved Robustness and Accuracy: Traditional focusing methods often suffer from poor accuracy and robustness under complex factors such as noise, lighting changes, and background interference. This invention, however, comprehensively utilizes adaptive Gaussian filtering, a PSF model, and a multi-dimensional evaluation mechanism to optimize blur, target detection, and image sharpness in real time during image processing, significantly improving the robustness and accuracy of the focusing process, especially performing exceptionally well in dynamic, low-contrast environments.
[0105] 6. High adaptability and applicability to multiple fields: The autofocus algorithm proposed in this 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, this invention is not only suitable for focusing biomedical imaging and microscope images, but can also be widely applied in industrial inspection, real-time video analysis, autonomous driving, and automated control, especially in applications with high precision and real-time requirements, where it has significant advantages. For example:
[0106] (1) Biomedical Imaging: In the biomedical field, especially in microscopic image analysis, images of cells and tissues are often affected by complex background interference and dynamic changes of the target object. Traditional focusing methods are difficult to effectively address these challenges, while this invention can accurately focus and optimize target coverage by adjusting blur parameters and target detection results in real time. Whether in sperm analysis, cell segmentation, or tissue imaging, this invention provides excellent focusing accuracy, and is particularly suitable for focusing needs of multi-layered images and dynamic objects.
[0107] (2) Industrial Inspection and Non-destructive Testing: In the industrial field, the autofocus technology of this invention can be widely applied to high-precision non-destructive testing systems, such as surface defect detection and welding quality inspection. Whether it is the detection of micro-cracks on metal surfaces or the three-dimensional image analysis of complex products, this invention can optimize the focal length position in real time according to the local ambiguity of the image, thereby improving the detection accuracy and avoiding focusing problems caused by workpiece position 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, this invention provides a multi-dimensional comprehensive evaluation mechanism based on image sharpness and target detection results. This mechanism can identify the target position in the image in real time and dynamically optimize based on blur, image sharpness, and target detection accuracy to ensure clear focus of the target. Whether in nighttime monitoring under low light conditions or dynamic target tracking in high-speed moving environments, this invention can provide efficient and stable real-time focusing, ensuring image quality and accurate target positioning.
[0109] (4) Autonomous Driving and Automatic Navigation Systems: In autonomous driving and robot navigation systems, the focusing accuracy of the vision system directly affects the accuracy of target recognition and path planning. Based on the focusing algorithm of this invention, the automatic focusing technology can optimize the focusing surface in real time, effectively improving the clarity and recognition capability of camera images regardless of complex road environments or different lighting conditions. This method can ensure that the camera focuses quickly and maintains image clarity in dynamically changing environments, improving the reaction speed and accuracy of autonomous driving systems.
[0110] (5) Intelligent Manufacturing and Automation Control: This invention can also be applied to the field of intelligent manufacturing, such as automated inspection and robot control. By performing automatic focusing in real time on industrial production lines, this technology can accurately position workpieces and products during the production process, optimizing assembly, inspection, and operation. In 3D scanning or high-precision measurement systems, this invention can ensure optimal focusing at different workpiece positions and angles, improving production efficiency and ensuring product quality.
[0111] (6) Adaptability in dynamic environments: Unlike traditional autofocus technology, the autofocus algorithm of this invention does not rely on fixed optical parameters, but adapts to changes in the environment by adjusting the 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 length positions, unaffected by factors such as lighting and background changes, thus exhibiting excellent robustness and accuracy.
[0112] In summary, compared with the prior art, this embodiment has significant innovation and advantages in terms of focusing accuracy, real-time performance, robustness and adaptability, and is especially suitable for applications requiring precise focusing and target detection, such as sperm analysis and cell biology research.
[0113] Obviously, the above embodiments are merely illustrative examples for clear explanation and are not intended to limit the implementation. Those skilled in the art will recognize that other variations or modifications can be made based on the above description. It is neither necessary nor possible to exhaustively list all possible implementations here. However, obvious variations or modifications derived therefrom are still within the scope of protection of this invention.
Claims
1. An autofocusing method, characterized in that, include: Acquire the image at the initial focusing position of the microscope as the original image; set the dynamic search range of the microscope focusing position based on the movement range of the motion control platform; The standard deviation of the point spread function is obtained based on the numerical aperture, wavelength, and defocus of the microscope. Using each pixel in the original image as the center, and according to a preset window size, the local region corresponding to each pixel in the original image is obtained, and the local variance of each pixel is calculated. The local standard deviation of each pixel is obtained based on the standard deviation of the point spread function and the local variance of each pixel; the pixel value of each pixel in the original image within the local region is obtained based on the pixel value of each pixel in the original image and its corresponding local region; the pixel value of each pixel in the Gaussian filtered image is obtained based on the weight function of the adaptive Gaussian filter and the pixel value of each pixel in the local region of the original image. Based on the pixel value of each pixel in the Gaussian-filtered image and the pixel value after the relative position offset of the pixel in its local region, the local energy of each pixel in the Gaussian-filtered image is obtained; based on the mapping function between energy and blur parameters and the local energy of each pixel in the Gaussian-filtered image, the blur parameters of each pixel are obtained; based on the blur parameters of each pixel, the Gaussian-filtered image is subjected to weighted blur processing to obtain the energy distribution image; All target objects and their total number in the energy distribution image are detected. Target objects with a confidence level greater than a threshold are selected 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's focusing position, an objective function is constructed with the goal of maximizing the weighted sum of the number of confidence-based target objects and the total number of target objects. After determining the fuzzy parameter constraints and the confidence target object number constraints based on the sharpness threshold and the reliability threshold, the objective function is optimized. When the total number of target objects reaches its maximum value, the confidence target object number exceeds the reliability threshold, and the fuzzy parameter is less than the sharpness threshold, the optimization terminates, and the focusing position at the time of optimization termination is taken as the optimal focusing position of the microscope.
2. The autofocusing method according to claim 1, characterized in that, The standard deviation of the point spread function is obtained based on the numerical aperture, wavelength, and defocus of the microscope, and its expression is as follows: ; in, This represents the standard deviation of the point spread function; This represents the proportionality coefficient. ; Indicates the numerical aperture of the microscope; Indicates the wavelength of light emitted by the microscope; Indicates the amount of defocus.
3. The autofocusing method according to claim 1, characterized in that, The process involves taking each pixel in the original image as the center, obtaining the local region corresponding to each pixel in the original image according to a preset window size, and calculating 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 as follows: pixels in the original image Centered on a preset window size, obtain the pixels in the original image. The corresponding local region is calculated, and the pixel points are determined. The local variance of is expressed as: ; in, Represents pixels Local variance; Indicates the preset window size; Represents the pixel in the original image Pixels in the corresponding local area Pixel values; Represents the pixel in the original image The average pixel value of all pixels within the corresponding local region; Based on the standard deviation of the point spread function and pixel points The local variance is used to obtain the pixel points. The local standard deviation is expressed as: ; in, Represents pixels Local standard deviation; This represents the standard deviation of the point spread function; Indicates the regulating factor; Represents pixels The local variance.
4. The autofocusing 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 region of the original image are used to obtain the pixel value of each pixel in the Gaussian-filtered image, and its expression is as follows: ; in, Represents the pixels in a Gaussian filtered image Pixel values; Represents pixels Local standard deviation; Indicates based on The weighting function of the constructed adaptive Gaussian filter; Represents pixels The corresponding weights of the adaptive Gaussian filter; Represents the pixel in the original image Pixels in a local area The pixel value.
5. The autofocusing method according to claim 1, characterized in that, The local energy of each pixel in the Gaussian-filtered image is obtained based on the pixel value of each pixel and the pixel value after the relative position offset within its local region. The expression for this local energy is: ; in, Represents the pixels in a Gaussian filtered image Local energy; Represents pixels Relative position offset within its local area The resulting pixel value; Represented by pixels Centered on, with a window radius of pixels The relative position offset within a local area; Represents the horizontal direction relative to the center pixel. The change in position; Represents the vertical direction relative to the center pixel. The change in position; Represents the pixels in a Gaussian filtered image Pixel values; This represents the window radius, with a default window size of [value missing]. ,but .
6. The autofocusing method according to claim 1, characterized in that, The blur parameter of each pixel is obtained based on the mapping function between energy and blur parameters and the local energy of each pixel in the Gaussian filtered image. The expression for this parameter is as follows: ; in, Represents pixels fuzzy parameters; A mapping function representing the relationship between energy and fuzzy parameters; Represents the pixels in a Gaussian filtered image Local energy.
7. The autofocusing method according to claim 1, characterized in that, The process of selecting target objects with a confidence level greater than a threshold from all target objects as confidence target objects and obtaining the number of confidence target objects is expressed as follows: ; in, Indicates the number of target objects with confidence level; Indicates the total number of target objects; Indicates an indicator function, if ,but ,like ,but ; Indicates the first Confidence level of each target object; This represents the confidence threshold.
8. The autofocusing 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-based target objects and the total number of target objects. Its expression is as follows: ; in, Indicates the focusing position of the microscope; Indicates the dynamic search range of the microscope's focusing position; Indicates the initial threshold for the microscope's focusing position; This indicates the threshold for terminating the microscope's focusing position. Indicates the focusing position of the microscope The total number of target objects at the time of the event; Indicates the focusing position of the microscope The number of target objects with confidence level at that time; The weights represent the number of target objects for confidence level.
9. The autofocusing method according to claim 1, characterized in that, The process of determining fuzzy parameter constraints and confidence target object quantity constraints based on sharpness thresholds and reliability thresholds includes: The expression for the fuzzy parameter constraint is: ; in, Indicates the focusing position of the microscope; Indicates the focusing position of the microscope Pixels at time fuzzy parameters; Indicates the sharpness threshold; The expression for the confidence level target object quantity constraint is: ; in, Indicates the focusing position of the microscope The number of target objects with confidence level at that time; This represents the reliability threshold.
10. A microscope image acquisition device, characterized in that, include: The microscope, positioned directly above the motion control platform, is connected to the platform via an optical interface; it is used to magnify and examine the details of the target object sample. The camera, a high-resolution CCD camera, is installed at the imaging port of the microscope and connected to the computer via a high-speed data transmission cable; it is used to acquire microscope images and transmit the acquired microscope images to the computer. The motion control platform, equipped with an electric Z-axis adjuster and connected to a computer, is used to place the target object sample and control the adjustment of the microscope's focusing position. A computer, with a built-in program for an autofocusing method as described in any one of claims 1 to 9, is used to execute the built-in program, process acquired microscope images, adjust the position of the motion control platform, achieve automatic focusing of the microscope, and acquire the automatically focused microscope image.
Citation Information
Patent Citations
Apparatus and method for measuring focal plane separation
US5642441A
Robust autofocus system for a microscope
WO2000075709A1