An auto focus control method, system and medium

By dynamically controlling the objective lens's movement speed along the z-axis, combined with sensor spot displacement and defocus threshold, multi-level speed adjustment is achieved. This solves the problem of balancing focusing speed and computational load in dynamic scenes, improving focusing accuracy and image quality.

CN121541358BActive Publication Date: 2026-05-01HEFEI I TEK OPTOELECTRONICS CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HEFEI I TEK OPTOELECTRONICS CO LTD
Filing Date
2026-01-21
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

Existing autofocus systems struggle to balance focusing speed, computational load, and image quality in dynamic scenes. High sampling frequencies lead to strained computing resources, while low sampling frequencies result in blurred images, making them unsuitable for complex and ever-changing scene requirements.

Method used

By dynamically driving and controlling the objective lens's movement speed along the z-axis, and combining the sensor spot displacement and defocus threshold, multi-level speed adjustment is achieved, the upper limit of the objective lens's allowable movement speed is selected, and the calculation workload of focusing speed and defocus amount is balanced.

Benefits of technology

While ensuring the quality of the bokeh image, achieve fast focusing, improve the accuracy of defocus calculation and focusing efficiency, and reduce the workload of bokeh image processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121541358B_ABST
    Figure CN121541358B_ABST
Patent Text Reader

Abstract

The application discloses an automatic focusing control method, system and medium, the method comprises the following steps: using the maximum spot displacement allowed by the sensor, the total displacement of the spot on the sensor caused by the moving speed of the objective lens along the z-axis and the moving speed of the object to be measured along the x-axis is constrained to screen out the upper limit moving speed allowed by the objective lens; the moving speed of the current objective lens along the z-axis and the defocus amount are obtained, the relationship between the absolute value of the defocus amount and the set defocus amount threshold is judged, if it is not greater than the set defocus amount threshold, the objective lens is driven to move at the second moving speed, if it is greater than the set defocus amount threshold, the objective lens is driven to move at the first moving speed. Through the relationship between the absolute value of the defocus amount of the position of the objective lens and the set defocus amount threshold, the dynamic control of the moving speed of the objective lens, the calculation amount of the focusing speed and the defocus amount is effectively balanced, the accuracy of the defocus amount calculation is improved while realizing the fast focusing.
Need to check novelty before this filing date? Find Prior Art

Description

An autofocus control method, system and medium Technical Field

[0001] This invention belongs to the field of autofocus technology and relates to an autofocus control method, system and medium. Background Technology

[0002] The autofocus system uses sensors to capture images of the light spot and calculates the defocus amount based on these images, which then drives the objective lens to achieve focus. In dynamic scenes, rapid response to changes in the scene is required to ensure image sharpness; therefore, sampling frequency is a crucial factor affecting system performance. A higher sampling frequency can more accurately capture rapidly changing signals (such as moving subjects), improving focusing speed and accuracy. This is especially important in continuous autofocus mode, where the system needs to track moving objects in real time, thus demanding even higher sampling frequencies. However, a high sampling frequency significantly increases the system's computational burden, leading to resource constraints and increased power consumption.

[0003] On the other hand, to reduce the sampling frequency, the system needs to extend the time for a single focus calculation to obtain an image with a sufficient signal-to-noise ratio to determine the focus status. This is achieved by increasing the exposure time to ensure the quality of the bokeh image. However, long exposure times introduce motion blur, especially in dynamic scenes, where the bokeh image is prone to ghosting, thus affecting the accuracy of the defocus calculation. This presents an challenge for autofocus systems in balancing dynamic response and image quality: while a high sampling frequency improves response speed, it increases computational cost, whereas a low sampling frequency reduces computational burden but leads to image blurring and reduced focus reliability.

[0004] Current autofocus systems often use fixed sampling frequencies or exposure parameters, making it difficult to adapt to complex and ever-changing scene requirements and simultaneously balance focusing speed, computational load, and image quality. Therefore, there is an urgent need to solve the problem of balancing focusing speed and computational load while ensuring image quality. Summary of the Invention

[0005] The purpose of this invention is to overcome the above-mentioned problems in the prior art and provide an automatic focus control method, system and medium that solves the problem of balancing focusing efficiency and defocus calculation under the existing high sampling frequency requirements.

[0006] To achieve the above-mentioned technical objectives and effects, the present invention is implemented through the following technical solution:

[0007] An autofocus control method for dynamically driving and controlling the movement speed of an objective lens along the z-axis to balance the computational complexity of focusing speed and defocusing amount includes:

[0008] The maximum spot displacement allowed by the sensor is used to constrain the total displacement of the spot on the sensor caused by the moving speed of the objective lens along the z-axis and the moving speed of the object under test along the x-axis, so as to screen out the upper limit of the moving speed allowed by the objective lens. The total displacement under the constraint is less than the maximum spot displacement allowed by the sensor.

[0009] Obtain the current moving speed and defocus amount of the objective lens along the z-axis, determine the relationship between the absolute value of the defocus amount and the set defocus amount threshold, if it is not greater than the set defocus amount threshold, drive the objective lens to move at the second moving speed, if it is greater than the set defocus amount threshold, drive the objective lens to move at the first moving speed.

[0010] The second moving speed is less than the first moving speed, and the first moving speed is not greater than the upper limit of the moving speed allowed by the objective lens.

[0011] Furthermore, the method for determining the upper limit of the objective lens's allowable movement speed includes: establishing a relationship between the objective lens's movement speed along the z-axis and the object's movement speed along the x-axis based on a set displacement threshold, the object's movement speed along the x-axis, the objective lens's magnification, and the sensor's exposure time, thereby determining the objective lens's movement speed range along the z-axis.

[0012] The relationship is as follows: Vx represents the velocity of the object being measured along the x-axis, and Vz represents the velocity of the objective lens along the z-axis. max Let d represent the distance from a point on the object at the edge of the field of view to the z-axis, and let d represent the distance from the objective lens to the surface of the object along the z-axis. img The value is represented by the set displacement threshold, M represents the magnification of the objective lens, and T represents the single exposure time of the sensor.

[0013] Furthermore, the method for determining the set defocus threshold includes: obtaining the magnification of the objective lens, filtering the depth of field of the objective lens with the magnification, fixing the magnification factor and the maximum allowable defocus within the depth of field, and calculating the defocus threshold of the objective lens.

[0014] Furthermore, methods for adjusting abnormal defocus amount include:

[0015] Calculate the change in defocus amount and the change in z-axis position between two adjacent time points, and calculate the relative deviation between the change in defocus amount and the change in z-axis position at the same time point.

[0016] Determine whether the absolute value of the relative deviation between two adjacent moments is greater than a set deviation threshold. If it is greater than the set deviation threshold, then the abnormal defocus amount is eliminated, and the defocus amount at the current moment is corrected by using the change in the objective lens position on the z-axis between two adjacent moments.

[0017] Furthermore, if the absolute value of the relative deviation between two adjacent moments is greater than the set deviation threshold, the defocus amount at the current moment is corrected by using the ratio of the defocus amount at the previous moment, the change in z-axis position between two adjacent moments, and the sum of the cumulative changes in defocus amount between adjacent moments to the sum of the changes in objective lens position along the z-axis.

[0018] Furthermore, the method for analyzing the surface unevenness of the object under test includes:

[0019] Using the corrected defocus amount, a trajectory curve between the moving distance of the object under test and the defocus amount is established, and the defocus amount at the next moment is predicted based on the trajectory curve;

[0020] Based on the defocus amount of the object under test at the previous moment, the moving speed of the object under test along the z-axis, and the sampling frequency, calculate the real-time defocus amount of the object under test at the current moment.

[0021] Extract the defocus amount predicted by the real-time defocus amount model and the defocus amount predicted by the trajectory curve model at the same time, and analyze the relative height difference between the surface of the object under test at the time and the surface of the object under test at the previous time.

[0022] Furthermore, if the defocus amount at the current moment is not greater than the set defocus amount threshold, the second moving speed of the objective lens along the z-axis is determined by the fact that the change in real-time defocus amount between two adjacent moments is less than the set first defocus amount change threshold.

[0023] If the defocus amount at the current moment is greater than the set defocus amount threshold, the first moving speed of the objective lens along the z-axis is determined by the fact that the change in real-time defocus amount between two adjacent moments is less than the second defocus amount change threshold and greater than the first defocus amount change threshold.

[0024] Furthermore, an autofocus control method also includes:

[0025] Several sets of defocus thresholds and corresponding moving speeds are set, wherein the several sets of defocus thresholds are all greater than the maximum defocus amount allowed within the depth of field of the objective lens.

[0026] Obtain the current objective lens's moving speed and defocusing amount along the z-axis;

[0027] From a number of defocus thresholds, the smallest defocus threshold among the absolute values ​​greater than the current defocus amount is selected. Based on the smallest defocus threshold among the absolute values ​​greater than the current defocus amount, a moving speed corresponding to the defocus threshold is selected. The objective lens is driven to move at the selected moving speed to achieve multi-level speed adjustment of the objective lens along the z-axis.

[0028] An autofocus control system is used to dynamically drive and control the objective lens along the z-axis to balance the computational complexity of focusing speed and defocusing amount, and is applied to any of the methods described, comprising:

[0029] The motion analysis module uses the maximum spot displacement allowed by the sensor to constrain the total displacement of the spot on the sensor caused by the moving speed of the objective lens along the z-axis and the moving speed of the object under test along the x-axis, so as to screen out the upper limit of the moving speed allowed by the objective lens. The total displacement under the constraint is less than the maximum spot displacement allowed by the sensor.

[0030] The dynamic drive adjustment module obtains the current moving speed and defocus amount of the objective lens along the z-axis, and determines the relationship between the absolute value of the defocus amount and the set defocus amount threshold. If it is not greater than the set defocus amount threshold, the objective lens is driven to move at the second moving speed; if it is greater than the set defocus amount threshold, the objective lens is driven to move at the first moving speed.

[0031] The second moving speed is less than the first moving speed, and the first moving speed is not greater than the upper limit of the moving speed allowed by the objective lens.

[0032] The beneficial effects of this invention are:

[0033] This invention compares the absolute value of the defocus amount at the objective lens position with a set defocus threshold to select the corresponding objective lens movement speed, thereby achieving dynamic control of the objective lens movement speed. This facilitates a balance adjustment between focusing speed and defocus calculation based on the defocus amount. During the focusing process on a moving object, the objective lens position can be adjusted more quickly to achieve the optimal focus state. While ensuring the quality of the light spot image, it achieves fast focusing and improves the accuracy of defocus calculation.

[0034] This invention sets several defocus thresholds and corresponding moving speeds for each defocus threshold. Based on the relationship between the defocus amount at the objective lens position and the set defocus thresholds, it selects the corresponding moving speed of the objective lens along the z-axis, achieving multi-level range adjustment of the moving speed. This further controls the relationship between the calculation of focusing speed and defocus amount, balancing the calculation of focusing speed and defocus amount.

[0035] This invention identifies the magnification of the objective lens to determine its depth of field, filters the defocus threshold corresponding to the current objective lens based on the depth of field, distinguishes the differences between objective lenses, and obtains the trigger conditions for dynamic adjustment of the movement speed of different objective lenses, thereby improving the focusing accuracy and precision of different objective lenses.

[0036] This invention uses the maximum allowable spot displacement to prevent blurring of the spot image. It constrains the maximum total displacement of the spot on the sensor caused by the movement of the objective lens along the z-axis and the movement of the test object along the x-axis. This limits the relationship between the moving speed of the objective lens along the z-axis and the moving speed of the test object along the x-axis. With the moving speed of the test object along the x-axis fixed, the range of the moving speed of the objective lens along the z-axis can be obtained. Under the constraint, the requirements of the moving speed of the objective lens under different moving speeds of the test object are met, so as to determine the maximum moving speed of the objective lens and make dynamic adjustments within the maximum moving speed.

[0037] This invention uses a set deviation threshold to compare the changes in defocus amount and z-axis position at two adjacent time points to identify abnormal defocus amounts. This avoids the problem of poor accuracy in identifying abnormal defocus amounts caused by using only the change in defocus amount alone, and improves the accuracy of abnormal defocus amount identification.

[0038] This invention eliminates abnormal defocus based on the identified defocus amount and corrects the defocus amount of the previous moment by using the change in z-axis position to obtain the defocus amount of the next moment, thereby improving the reliability of instantaneous defocus amount data and reducing the interference of abnormal defocus amount data on the focusing process.

[0039] This invention constructs a trajectory curve using the corrected defocus amount, facilitating the prediction of the defocus amount at the next moment based on the current defocus amount. Combined with a real-time defocus amount model, it calculates the real-time defocus amount at the current location of the object under test. By using the predicted defocus amount and the real-time defocus amount at the same moment, the relative height difference of the object's surface relative to the previous moment is obtained. This allows for effective control of the object's movement direction and speed based on the surface change trend and defocus amount. While ensuring focusing accuracy, it balances focusing speed and computational load, improving focusing efficiency and reducing the workload of spot image processing. Attached Figure Description

[0040] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:

[0041] Figure 1 is a flowchart of the autofocus control method in this invention;

[0042] Figure 2 is a schematic diagram of the objective lens movement trajectory under constant objective lens movement speed in this invention;

[0043] Figure 3 is a schematic diagram of the trajectory of the change in the z-axis position of the objective lens in this invention;

[0044] Figure 4 is a schematic diagram of the height change of the surface of the object under test at two adjacent time points in this invention;

[0045] Figure 5 is a schematic diagram of the autofocus control system in this invention. Detailed Implementation

[0046] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0047] In a laser autofocus system, a sensor acquires a spot image, calculates the defocus amount based on the spot image, and then drives the objective lens to move along the z-axis to achieve focusing. The sampling frequency of the sensor acquiring the spot image is affected by the exposure time. To ensure the quality of the spot image, a long exposure time is required at a low sampling frequency, but a long exposure time increases the image ghosting phenomenon. Currently, the objective lens moves the same amount along the z-axis in each sampling cycle, making it impossible to dynamically adjust the sampling interval according to the defocus amount.

[0048] With the sensor's sampling frequency and exposure time remaining constant, the sampling interval can be dynamically adjusted by changing the moving speed of the objective lens along the z-axis. This allows for the adjustment of the sampling interval between two adjacent light spot images along the z-axis, reducing the data processing burden and balancing the focusing speed requirement with the consumption of computing resources, thus ensuring the efficiency and accuracy of the focusing process.

[0049] To address the aforementioned technical problems, as shown in Figure 1, this application specifically provides an autofocus control method for dynamically driving and controlling the movement speed of the objective lens along the z-axis, so as to balance the computational complexity of focusing speed and defocusing amount. The autofocus control method includes:

[0050] The total displacement of the light spot on the sensor caused by the moving speed of the objective lens along the z-axis and the moving speed of the object under test along the x-axis is constrained to screen out the upper limit of the moving speed of the objective lens. The total displacement under the constraint is less than the maximum light spot displacement allowed by the sensor.

[0051] When the objective lens is in the collimated position, the light spot on the sensor is clear and a straight line. When the objective lens deviates from the collimated position, the light spot becomes semi-elliptical or irregular in shape. When the objective lens moves away from the collimated position (moving upwards when the objective lens is above the collimated position or downwards when the objective lens is below the collimated position), as the distance between the objective lens and the surface of the object being measured increases, the focal point of the reflected light beam deviates from the sensor plane, and the light spot becomes diffused. At this time, the size of the reflected light spot on the sensor gradually increases. When the objective lens moves closer to the collimated position (moving downwards when the objective lens is above the collimated position or upwards when the objective lens is below the collimated position), as the distance between the objective lens and the surface of the object being measured decreases, the size of the reflected light spot on the sensor gradually decreases until it reaches its minimum size, at which point the objective lens is in the optimal focusing position.

[0052] Establish a coordinate system with the horizontal movement direction of the object to be measured as the x-axis, the optical axis of the objective lens as the z-axis, the direction perpendicular to the x0z plane as the y-axis, and the intersection of the z-axis and the surface of the object to be measured as the origin.

[0053] During a single exposure, the movement of the object under test along the horizontal direction (x-axis) and the movement of the objective lens along the z-axis will both cause the position of the light spot on the sensor to change.

[0054] During a single exposure, if the speed at which the object under test moves horizontally increases or / and the speed at which the objective lens moves along the z-axis increases, the displacement of the light spot on the sensor will increase.

[0055] The total displacement is the sum of the displacement of the light spot on the sensor caused by the moving speed of the objective lens along the z-axis and the displacement of the light spot on the sensor caused by the moving speed of the object under test along the x-axis.

[0056] The displacement of the light spot on the sensor caused by the moving speed of the objective lens along the z-axis is taken as the first displacement, while the displacement of the light spot on the sensor caused by the moving speed of the object under test along the x-axis is taken as the second displacement. When the first and second displacements are in the same direction, a set displacement threshold is used to limit the sum of the first and second displacements to obtain the upper limit of the objective lens's allowable moving speed. The set displacement threshold is determined by the focusing accuracy of the autofocus system and can be selected as 1 pixel or 0.5 pixel length, depending on the required accuracy.

[0057] Obtain the current moving speed and defocus amount of the objective lens along the z-axis, determine the relationship between the absolute value of the defocus amount and the set defocus amount threshold, if it is not greater than the set defocus amount threshold, drive the objective lens to move at the second moving speed, if it is greater than the set defocus amount threshold, drive the objective lens to move at the first moving speed.

[0058] The second moving speed is less than the first moving speed, and the first moving speed is not greater than the upper limit of the moving speed allowed by the objective lens.

[0059] As the objective lens moves along the z-axis, the sensor acquires light spot images of the surface of the object under test at a fixed sampling frequency, and calculates the defocus amount for each light spot image to obtain the defocus amount at the current objective lens position.

[0060] The current defocus amount is compared with the set defocus amount threshold to determine whether the current defocus amount is greater than the set defocus amount threshold. If it is greater than the set defocus amount threshold, it indicates that the objective lens position corresponding to the current defocus amount is relatively far from the objective lens being in the focus position. If the objective lens is driven to move along the z-axis at the current moving speed, the focusing time and the workload of defocus amount calculation will be increased. At this time, the objective lens is driven to move along the z-axis at a first moving speed greater than the current moving speed, which increases the sampling interval between two adjacent light spot images and reduces the amount of defocus amount calculation during the process from the current position to the focus position.

[0061] If the defocus amount is not greater than the set defocus threshold, it indicates that the distance between the objective lens position corresponding to the current defocus amount and the objective lens in the focus position is small. If the objective lens is driven to move along the z-axis at the current moving speed, the sampling interval is large, which may miss focus information. This may result in the changes in the spot image not being fully captured, leading to a deviation in the calculation of the defocus amount. At this time, the objective lens is driven to move along the z-axis at a second moving speed that is less than the current moving speed, reducing the sampling interval between two adjacent spot images and improving the accuracy of the defocus amount calculation.

[0062] By using the relationship between the absolute value of the current defocus amount and the set defocus amount threshold, the moving speed of the objective lens along the z-axis is dynamically driven and controlled to balance the calculation of focusing speed and defocus amount. During the focusing process on a moving object, the objective lens position can be adjusted more quickly to achieve the best focusing state, thus improving the accuracy of defocus amount calculation while achieving fast focusing.

[0063] In this embodiment, the defocus threshold can be determined according to the magnification of different objectives, or a fixed defocus threshold can be used for different objectives.

[0064] The above implementation allows for two-stage speed adjustment of the objective lens during focusing, based on the relationship between the current defocus amount and a set defocus threshold. Furthermore, by setting several sets of defocus thresholds, multi-stage speed adjustment of the objective lens's movement along the z-axis can be achieved. Specifically, a first defocus threshold, a second defocus threshold, ..., and a s-th defocus threshold are set, where the first defocus threshold > the second defocus threshold > ... > the s-th defocus threshold. The s-th defocus threshold is greater than the maximum allowable defocus amount within the depth of field of the objective lens, where s ≥ 2.

[0065] Several sets of defocus thresholds and corresponding moving speeds are set, wherein the several sets of defocus thresholds are all greater than the maximum defocus amount allowed within the depth of field of the objective lens.

[0066] Obtain the current objective lens's moving speed and defocusing amount along the z-axis;

[0067] From a number of defocus thresholds, the smallest defocus threshold among the absolute values ​​greater than the current defocus amount is selected. Based on the smallest defocus threshold among the absolute values ​​greater than the current defocus amount, a moving speed corresponding to the defocus threshold is selected. The objective lens is driven to move at the selected moving speed to achieve multi-level speed adjustment of the objective lens along the z-axis.

[0068] When the defocus amount is greater than the first defocus threshold, the objective lens is driven to move using the first moving speed; when the defocus amount is less than the first defocus threshold but not less than the second defocus threshold, the objective lens is driven to move using the second moving speed; when the defocus amount is less than the second defocus threshold but not less than the third defocus threshold, the objective lens is driven to move using the third moving speed, and so on. When the defocus amount is less than the (s-1)th defocus threshold but not less than the sth defocus threshold, the objective lens is driven to move using the fourth moving speed.

[0069] Among them, the first moving speed is greater than the second moving speed, the second moving speed is greater than the third moving speed, and so on, with the (s-1)th moving speed being greater than the sth moving speed.

[0070] By employing multiple sets of defocus thresholds, the moving speed of the objective lens can be adjusted in multiple levels during the focusing process along the z-axis, thereby achieving dynamic range adjustment of the moving speed of the objective lens along the z-axis according to the magnitude of the defocus.

[0071] In addition, in this embodiment, the moving speed of the objective lens along the z-axis is dynamically adjusted according to the moving speed of the object under test along the x-axis. That is, when the moving speed of the object under test along the x-axis changes, the upper limit of the moving speed allowed by the objective lens also changes accordingly. Based on the current moving speed of the objective lens along the z-axis and the defocus amount at the current position, if the absolute value of the defocus amount is not greater than the set defocus amount threshold, the second moving speed is adopted. The second moving speed is not greater than the current moving speed of the objective lens along the z-axis. If the absolute value of the defocus amount is greater than the set defocus amount threshold, the first moving speed is adopted. The first moving speed is greater than the current moving speed of the objective lens along the z-axis.

[0072] As the upper limit of the objective lens's movement speed changes, the first and second movement speeds can be dynamically adjusted, provided that the first movement speed is not greater than the upper limit of the objective lens's movement speed and the second movement speed is less than the first movement speed.

[0073] The total displacement of the light spot on the sensor caused by the moving speed of the objective lens along the z-axis and the moving speed of the object under test along the x-axis is constrained, and the total displacement is constrained to be less than a set displacement threshold, which is the maximum allowable light spot displacement.

[0074] During the exposure time of the sensor, the displacement change of the light spot on the test object on the sensor is analyzed. If the displacement change is less than the set displacement threshold, the light spot will not be blurred. If the displacement change is greater than the set displacement threshold, the light spot will be blurred. The greater the displacement change, the more blurred the corresponding light spot.

[0075] The above-mentioned constraints on the total displacement of the light spot on the sensor caused by the moving speed of the objective lens along the z-axis and the moving speed of the object under test along the x-axis allow for the selection of limiting conditions for the total displacement based on the allowable accuracy of the light spot image. This determines the relationship between the moving speed of the objective lens along the z-axis and the moving speed of the object under test along the x-axis, thereby filtering out the moving speed of the objective lens along the z-axis.

[0076] The method for determining the upper limit of the objective lens's movement speed includes: establishing a relationship between the objective lens's movement speed along the z-axis and the object's movement speed along the horizontal direction based on a set displacement threshold, the object's movement speed along the horizontal direction, the objective lens's magnification, and the sensor's exposure time; determining the range of the objective lens's movement speed along the z-axis; and selecting the maximum movement speed from the range as the upper limit of the movement speed.

[0077] For a moving object under test, the objective lens moves along the z-axis to focus, achieving focus on the object. During this process, the relationship between the objective lens's movement speed along the z-axis and the object's movement speed along the horizontal direction (x-axis) perpendicular to the z-axis is defined by the following formula:

[0078] Where Vx represents the horizontal velocity of the object under test, and Vz represents the horizontal velocity of the objective lens along the z-axis. The velocity can be instantaneous or average. max Let d represent the distance from a point on the object at the edge of the field of view to the z-axis, and let d represent the distance from the objective lens to the surface of the object along the z-axis. img The set displacement threshold is the maximum allowable spot displacement. M represents the magnification of the objective lens, and T represents the single exposure time of the sensor.

[0079] Based on the relationship between the objective lens's movement speed along the z-axis and the object's movement speed along the horizontal direction, the range of the objective lens's movement speed along the z-axis can be determined when the object's horizontal movement speed is fixed. If the objective lens's movement speed along the z-axis exceeds the maximum value Vz within this range... max If so, there may be motion blur in the light spot image.

[0080] Specifically, when the objective lens moves along the z-axis at a speed exceeding the maximum value Vz in the range of moving speeds... max If the direction of the displacement change of the light spot on the sensor caused by the objective lens moving along the z-axis is the same as the direction of the displacement change of the light spot on the sensor caused by the object's moving along the x-axis, a ghosting effect will occur in the light spot image; when the objective lens moving along the z-axis exceeds the maximum value Vz in the moving speed range... max If the direction of the displacement change of the light spot on the sensor caused by the moving speed of the objective lens along the z-axis is opposite to the direction of the displacement change of the light spot on the sensor caused by the moving speed of the object under test along the x-axis, the light spot image may not have a ghosting effect.

[0081] In this embodiment, when the moving speed of the object under test changes in the horizontal direction, the moving speed of the objective lens along the z-axis can be obtained again according to the relationship between the moving speed of the objective lens along the z-axis and the moving speed of the object under test in the horizontal direction. The moving speed of the object under test is not limited, and the maximum moving speed of the objective lens along the z-axis can be determined according to the moving speed of the object under test.

[0082] During an exposure, the object under test moves horizontally, causing a change in position on the sensor. This change in position caused by horizontal movement is taken as the first displacement change. The objective lens moves along the z-axis, causing the light spot to scale on the sensor, which in turn causes a change in the position of the light spot on the sensor. This change in position is taken as the second displacement change.

[0083] When the objective lens moves closer to the object along the z-axis, the light spot at the edge of the field of view expands outward from the center of the optical axis; when the objective lens moves away from the object along the z-axis, the light spot at the edge of the field of view contracts inward from the center of the optical axis. The relationship between the speed of the objective lens moving along the z-axis and the speed of the object moving along the horizontal direction (x-axis) defines the sum of the absolute value of the second displacement change of the objective lens along the z-axis and the absolute value of the first displacement change of the object along the x-axis as the total displacement caused by the movement.

[0084] This total displacement represents the objective lens movement along the z-axis. The direction of the second displacement change on the sensor is the same as the direction of the first displacement change of the object under test along the x-axis. At this time, the maximum allowable objective lens movement speed Vz1 along the z-axis is... maxIf the direction of the second displacement change is opposite to the direction of the first displacement change of the object under test along the x-axis, then the maximum allowable objective lens movement speed Vz2 along the z-axis is... max Vz2 max >Vz1 max .

[0085] To set a safe moving speed for the objective lens along the z-axis, the moving speed of the objective lens along the z-axis is selected such that the direction of the second displacement change on the sensor is the same as the direction of the first displacement change on the sensor when the objective lens moves along the x-axis.

[0086] When the objective lens moves along the z-axis at a speed close to or equal to the maximum moving speed Vz1 max The first moving speed can be the maximum moving speed, or it can be selected to be less than the maximum moving speed Vz1. max The first moving speed is the speed at which the second moving speed is less than the first moving speed.

[0087] In addition, the first moving speed and the second moving speed can be fixed moving speed values.

[0088] The first and second moving speeds can also be dynamically adjusted based on the current moving speed and defocusing amount of the objective lens along the z-axis. Regardless of whether the first and second moving speeds are fixed or dynamic values ​​based on the current moving speed of the objective lens along the z-axis, the second moving speed must be less than the first moving speed.

[0089] When the first and second movement speeds are dynamic values, the first movement speed can be set to L1 times the current movement speed, and the second movement speed can be set to L2 times the current movement speed, where R ≥ L1 > 1 and 0 < L2 < 1, and R represents the maximum movement speed Vz1. max The ratio between the objective lens speed and the current objective lens movement speed.

[0090] During the autofocusing process of a microscope, the defocusing amount is calculated based on the centroid of the laser spot image, and then the objective lens is moved along the z-axis to reach the focusing position. The microscope autofocusing system includes two image sensors: one acquires the laser spot image, and the other acquires the image of the object's surface. Both sensors share a single objective lens. Using objectives with different magnifications directly affects the depth of field of the optical path system acquiring the object's surface image, and similarly affects the sharpness of the acquired laser spot image. When using objectives with different magnifications, the change in depth of field means that using the same objective lens movement speed for focusing can lead to missed focus points.

[0091] A method for determining the defocus threshold corresponding to an objective lens includes: determining the magnification of the objective lens, filtering the depth of field of the objective lens with the magnification, and calculating the defocus threshold of the objective lens based on the magnification.

[0092] In this embodiment, the set defocus threshold is affected by the depth of field of the objective lens. The depth of field of the objective lens refers to the range of distances in an imaging system that allow for sharp imaging before and after the objective lens's focal point. The depth of field includes the foreground depth of field and the background depth of field, and the depth of field is equal to the sum of the foreground depth of field and the background depth of field.

[0093] Before determining the set defocus threshold, the magnification of the objective lens needs to be determined. The magnification of the objective lens can be identified manually or by using a calibration object.

[0094] To facilitate the differentiation of the magnification of objectives, different objectives are marked with their corresponding magnification, which can be directly identified manually.

[0095] Alternatively, a flat calibration object can be used for identification. Specifically, the actual physical size of a known calibration object is selected, and the driving mechanism moves the objective lens along the z-axis. During the movement, a spot image is acquired and the defocusing amount is calculated until the acquired spot is clear and basically forms a thin, long straight line. The current z-axis position of the objective lens is recorded. From the z-axis positions corresponding to several objectives with different magnifications under focusing conditions, the objective lens magnification that matches the current objective lens's z-axis position is selected, thus determining the objective lens's magnification. In this way, from known objectives with different magnifications, the magnification of the current objective lens is determined.

[0096] Another method for identifying objective lens magnification can be used. A coordinate system is established with the horizontal movement direction of the object under test as the x-axis, the optical axis of the objective lens as the z-axis, and the direction perpendicular to the x0z plane as the y-axis. The intersection of the z-axis and the object under test is taken as the origin. The actual physical dimensions of the known marker are selected, and under focal focusing, the laser spot length is greater than the length of the marker along the x-axis.

[0097] The drive mechanism drives the objective lens to move along the z-axis, acquires a spot image and calculates the defocus amount. The magnification of the objective lens is determined based on the total pixel size of the calibration object along the x-axis, with the number of pixels occupied by the spot image in the x-axis direction being less than the set defocus amount. The magnification of the objective lens is equal to the ratio between the total pixel size and the actual physical size.

[0098] In this embodiment, the same defocus threshold can be used for objective lenses with different magnifications.

[0099] Since different magnifications of objective lenses correspond to different depths of field, a defocus threshold can be selected to match the depth of field of each objective lens, thereby improving focusing efficiency. The defocus threshold must be selected according to the magnification of the objective lens to determine the triggering conditions for dynamically adjusting the movement speed of different objectives.

[0100] The method for determining the set defocus threshold includes: obtaining the magnification of the objective lens, filtering the depth of field of the objective lens with the magnification, fixing the magnification factor and the maximum allowable defocus within the depth of field, and calculating the defocus threshold of the objective lens.

[0101] The set defocus threshold uses K times the depth of field as the set defocus threshold to determine the movement range after the objective lens movement speed is adjusted, where K is the fixed magnification factor corresponding to the maximum allowable defocus amount within the depth of field range.

[0102] By identifying the magnification of the objective lens, the depth of field of the objective lens can be determined. Based on the maximum defocus amount allowed within the depth of field range of the objective lens and the fixed magnification factor, the defocus threshold corresponding to different magnification objectives can be determined, so that when using different objectives, the trigger conditions corresponding to the movement speed adjustment can be selected.

[0103] Since the object under test moves at a constant speed in the horizontal direction, the objective lens moves along the z-axis. If we do not consider the dynamic adjustment of the objective lens's moving speed with the defocusing amount at the previous moment, the moving trajectory of the objective lens relative to the upper surface of the object under test is a straight line. Taking the position of the objective lens on the z-axis at a certain moment as z0, the x-coordinate of the object under test is 0. As time increases, the moving trajectory of the objective lens with the moving speed unchanged is shown in Figure 2. Straight line 1 represents the objective lens moving upward along the z-axis, straight line 2 represents the objective lens moving downward along the z-axis, and z0 represents the z-axis position coordinate of the objective lens at a certain moment.

[0104] The objective lens corresponds to a defocus amount at different z-axis coordinate positions. If the defocus amount is less than the set defocus threshold corresponding to the magnification of the objective lens, the objective lens is driven to move along the z-axis using the second moving speed. At this time, the absolute value of the slope of line 1 or line 2 is K1. If the defocus amount is greater than the set defocus threshold corresponding to the magnification of the objective lens, the objective lens is driven to move along the z-axis using the first moving speed. At this time, the absolute value of the slope of line 1 or line 2 is K2, and K2 > K1.

[0105] As a specific embodiment of the present invention, the defocus amount of the spot image at two adjacent time points is affected by the change in the distance of the objective lens along the z-axis and the change in the height of the surface of the object under the objective lens. Specifically, based on the defocus amount of the spot image at two adjacent time points and the z-axis position corresponding to the objective lens, the defocus amount of the spot image at the next time point is adjusted, as shown in Figure 3. The adjustment method includes:

[0106] Step 11: Extract the defocus amount corresponding to the spot image at two adjacent time points, denoted as d(i-1) and di respectively, and the z-axis position corresponding to the objective lens at two adjacent time points, denoted as z(i-1) and zi respectively.

[0107] Step 12: Calculate the change in defocus amount and the change in z-axis position And calculate the change in defocus at the same time. Change in position relative to the z-axis The relative deviation between two points, where the change in defocus between two adjacent moments is the amount of deviation. The change in z-axis position between two adjacent time points .

[0108] Step 13: Determine whether the absolute value of the relative deviation between two adjacent time points is greater than the set deviation threshold. If it is greater than the set deviation threshold, then eliminate abnormal defocusing amounts and use the change in objective lens position along the z-axis between two adjacent time points. The current defocus amount is corrected to obtain the corrected defocus amount.

[0109] The set deviation threshold is greater than the amount of objective lens movement along the z-axis between two adjacent moments. The set deviation threshold is used to identify abnormal defocusing so that it can be corrected according to the change in objective lens position along the z-axis between two adjacent moments. The set deviation threshold is determined according to the degree of defocusing change between two adjacent moments that is allowed / accepted.

[0110] The sampling time of the two adjacent time points corresponds to the sampling time of the two adjacent light spot images. A fixed sampling duration can also be selected. Therefore, the two adjacent time points can be set as needed.

[0111] By using a set deviation threshold, the changes in defocus amount are filtered to eliminate interference from instantaneous abnormal defocus amounts on the surface of the object under test. Based on the changes in position along the z-axis between two adjacent time points, the abnormal defocus amount at the current time is compensated to obtain the compensated defocus amount. This avoids directly using the abnormal defocus amount at the current time or using the defocus amount at the previous time point to replace the defocus amount at the current time, thereby improving the reliability of the defocus amount data and reducing interference from abnormal defocus amount data.

[0112] In addition, this embodiment also discloses another method for adjusting abnormal defocus. A dynamic adjustment model is used to adjust the defocus if the absolute value of the relative deviation between two adjacent moments is greater than a set deviation threshold. In addition to using the above steps 11 and 12, if the absolute value of the relative deviation between two adjacent moments is greater than the set deviation threshold, the defocus at the current moment is corrected by the ratio of the defocus at the previous moment, the change in the z-axis position between two adjacent moments, and the sum of the cumulative changes in the defocus at adjacent moments to the sum of the changes in the objective lens position along the z-axis, thereby obtaining the adjusted defocus.

[0113] The dynamic adjustment model used to correct the defocus amount at the current moment is as follows:

[0114] , di is the defocus value after the abnormal defocus adjustment. The defocus value at this time is the actual defocus value corresponding to the current movement position and z-axis position of the test object, not the defocus value in the collimated state corresponding to the current movement position of the test object. d(i-1) is the defocus value at the previous moment. Δzi is the change in the position of the objective lens along the z-axis between the current moment and the previous moment. ΔD is the sum of the changes in defocus at several adjacent moments. n The sum of the objective lens's position change along the z-axis and ΔZ n The ratio is used to measure the weight of the sum of the defocus changes at adjacent times and the sum of the position changes of the objective lens along the z-axis. f is the sampling frequency, and n represents the number of times the sampling is performed.

[0115] When there are multiple consecutive out-of-focus points, the out-of-focus amount is corrected based on the out-of-focus amount of the previous moment and the out-of-focus amount of the current moment. The corrected out-of-focus amount is then used to correct the out-of-focus amount of the next moment, and so on, to process the out-of-focus amounts continuously.

[0116] The above method identifies abnormal defocus amounts, and the sum of the cumulative changes in defocus amount and the sum of the changes in the objective lens position along the z-axis are used to adjust the abnormal defocus amount. This improves the accuracy of the defocus amount, reduces the interference of abnormal defocus amount on subsequent defocus amounts, reduces focus lag, and improves focus speed.

[0117] Based on the relationship between the absolute value of the defocus amount at the current position and a set defocus threshold, this invention not only adjusts the moving speed of the objective lens along the z-axis, but also adjusts the moving speed of the object under test along the x-axis based on the relationship between the absolute value of the defocus amount and the set defocus threshold. When the absolute value of the defocus amount is less than the set defocus threshold, the moving speed of the object under test along the x-axis is driven, and the total displacement of the light spot on the sensor caused by the moving speed of the objective lens along the z-axis and the moving speed of the object under test along the horizontal direction (x-axis) satisfies the constraint condition.

[0118] The present invention also provides another embodiment, as shown in Figure 3, in which a point on the object to be tested is selected as the origin of the coordinate system, the horizontal axis is the direction of movement of the object to be tested, and the vertical axis is the position of the objective lens on the z-axis. During the movement of the object to be tested along the x-axis, the position of the objective lens on the z-axis at the next moment is adjusted according to the defocusing amount of the objective lens at the previous moment, so as to obtain a schematic diagram of the trajectory of the change of the position of the objective lens on the z-axis.

[0119] The objective lens moves along the z-axis to focus, and the resulting defocus amount accurately reflects the defocus amount at the current position of the object under test. This defocus amount includes the surface undulations of the object under test. Therefore, the positional change of the objective lens along the z-axis is affected by the surface irregularities of the object under test.

[0120] The method for analyzing the surface unevenness of an object to be tested includes the following steps:

[0121] Step 1: Using the adjusted defocus amount, establish a trajectory curve between the moving distance of the object under test and the defocus amount, and predict the defocus amount at the next moment based on the trajectory curve; in order to eliminate the influence caused by abnormal defocus amount, improve the accuracy of the defocus amount calculation for the next frame, reduce the interference of abnormal defocus amount, and realize real-time focusing on the surface of the object under test.

[0122] This application requires constructing a trajectory curve based on the defocus amount at different times in the past, in order to ensure the accuracy of the defocus amount calculation during the movement of the object under test.

[0123] A dynamic adjustment model is adopted to predict and correct the current abnormal defocus amount based on the defocus amount of the previous moment, and obtain multiple sets of defocus amounts corresponding to different positions of the test object along the movement direction. Data fitting is used to obtain the trajectory curve corresponding to the test object along the movement direction.

[0124] The trajectory curve model corresponding to the trajectory curve: x represents the distance of the object under test relative to the origin of the coordinate system, which is determined by the distance the object under test moves along the direction of movement within a sampling frequency, x = Mv x / f, M represents the number of samples, f represents the sampling frequency, v x This represents the speed of the object under test along the direction of movement within the sampling frequency. Alternatively, x can also be the distance on the object relative to the origin of the coordinate system corresponding to the change in the speed of movement along the direction of movement. x The predicted defocus amount corresponding to position x on the test object is represented by , and a, b, c, d, e and h are the coefficients in the trajectory curve model. The values ​​of each coefficient are obtained by performing polynomial fitting between multiple sets of adjusted defocus amounts and the corresponding x positions on the test object.

[0125] The trajectory curve model described above is a trajectory curve established based on the defocus amount after anomaly correction and the x-position of the test object. This trajectory curve has a non-flat state on the upper surface of the test object along the direction of movement of the test object. As a result, the defocus amount is different at different positions of the test object when the z-axis position of the objective lens remains unchanged. By using the trajectory curve model described above, the defocus amount at different positions of the test object along the direction of movement can be predicted, and the defocus amount at the next moment can be predicted.

[0126] To eliminate the influence of surface unevenness of the test object on the defocus amount, without considering the unevenness of the surface of the test object when it is placed horizontally or when the test object is placed at an angle, we analyze the real-time defocus amount corresponding to the next moment during the movement of the objective lens along the z-axis.

[0127] Step 2: Based on the defocus amount corresponding to the position of the object under test at the previous moment, the moving speed of the object under test along the z-axis, and the sampling frequency, calculate the real-time defocus amount at the current position of the object under test.

[0128] If the surface of the object under test is not flat, as the object moves horizontally, the change in defocus between two adjacent moments is affected by the change in the height of the object's surface and the direction of the objective lens's movement along the z-axis. When the surface of the object is flat and does not change, the change in defocus between two adjacent moments is only affected by the change in the objective lens's position along the z-axis.

[0129] Without considering the effects of unevenness, tilt, or flatness of the upper surface of the object under test, a real-time defocus model is constructed by using the moving speed of the objective lens along the z-axis at two adjacent time points to predict the defocus amount at the next time point.

[0130] The real-time defocusing amount at the current location of the object under test is calculated using a real-time defocusing amount model.

[0131] The real-time defocusing model is as follows: When x=0, d20 represents the defocusing amount corresponding to the position of the objective lens on the z-axis at the initial position (origin) of the object under test. x-1 d2 represents the defocusing amount corresponding to the position of the object being measured at the previous moment. x V represents the real-time defocus amount corresponding to position x on the object being measured at the current moment. z It represents the moving speed of the objective lens along the z-axis, which can be either the first moving speed or the second moving speed.

[0132] The aforementioned real-time defocus model can predict the real-time defocus amount at the next moment based solely on the moving speed of the objective lens along the z-axis, without considering any special circumstances of the surface of the object under test. This allows for the determination of the height change of the surface of the object under test between two adjacent moments by comparing the defocus amount predicted by the trajectory curve model with that predicted by the real-time defocus model.

[0133] Step 3: Extract the defocus amount predicted by the real-time defocus amount model and the defocus amount predicted by the trajectory curve model at the same time, and analyze the relative height difference between the surface of the object under test at each time and the surface of the object under test at the previous time. .

[0134] As shown in Figure 4, the surface roughness of the object under test is determined relative to the previous moment based on the relative height difference between two adjacent moments. Specifically, if the relative height difference is less than 0, it indicates that the surface of the object under test at this position is a groove compared to the previous moment. The objective lens movement speed is controlled based on the relationship between the absolute value of the defocus amount at the previous moment and the set defocus amount threshold. At the same time, the relationship between the defocus amount at the previous moment and the value 0 is judged to control the movement direction of the objective lens (if the defocus amount at the previous moment is greater than 0, it indicates that the upper surface of the object under test is above the focal plane; if the defocus amount is less than 0, it indicates that the upper surface of the object under test is below the focal plane). Similarly, if the relative height difference is greater than 0, it indicates that the surface of the object under test at this position is a convexity compared to the previous moment. The objective lens movement speed is controlled based on the relationship between the absolute value of the defocus amount at the previous moment and the set defocus amount threshold. At the same time, the relationship between the defocus amount at the previous moment and the value 0 is judged to control the movement direction of the objective lens.

[0135] If the defocus value at the previous moment is greater than 0, it indicates that the upper surface of the object under test is above the focal plane. At this time, the driving objective lens moves downward along the z-axis. If the defocus value is less than 0, it indicates that the upper surface of the object under test is below the focal plane. At this time, the driving objective lens moves upward along the z-axis.

[0136] The height of the objective lens along the z-axis is adjusted so that the spot image acquired at the initial position of the objective lens is in a focused state. Based on the relative height difference between the surface of the test object at two adjacent moments along the moving direction, and combined with the relationship between the absolute value of the defocus amount at the previous moment and the set defocus amount threshold, as well as whether the defocus amount value is less than 0, the moving speed and direction of the objective lens are driven. This allows for focusing control of the test object along the moving direction based on the changing trend of the test object surface, effectively eliminating the interference of changes in the test object surface on focusing. While ensuring focusing accuracy, focusing efficiency is improved, and the workload of spot image processing is reduced.

[0137] In the above embodiments, the first moving speed and the second moving speed can be selected based on the relationship between the absolute value of the defocus amount and the set defocus amount threshold to adjust the moving speed of the objective lens. The first moving speed and the second moving speed are fixed values ​​determined within the upper limit moving speed range allowed by the objective lens.

[0138] The present invention also provides the determination of the first moving speed and the second moving speed. If the absolute value of the defocus amount at the current moment is not greater than the set defocus amount threshold, the second moving speed of the objective lens along the z-axis is determined by the change in the real-time defocus amount between two adjacent moments being less than the set first defocus amount change threshold.

[0139] If the defocus amount at the current moment is greater than the set defocus amount threshold, the first moving speed of the objective lens along the z-axis is determined by the fact that the change in real-time defocus amount between two adjacent moments is less than the second defocus amount change threshold and greater than the first defocus amount change threshold.

[0140] Specifically, the movement speed of the objective along the z-axis can be controlled by the relationship between the absolute value of the defocus amount corresponding to the spot image acquired by the objective along the z-axis and a set defocus threshold. If the absolute value of the defocus amount at the current moment is not greater than the set defocus threshold, it indicates that the distance between the objective position and the focus position is small, and a slower objective movement speed should be used. By limiting the change in real-time defocus amount between two adjacent moments to not exceed the first defocus change threshold Δd1, the movement speed of the objective along the z-axis is obtained and used as the second movement speed (v). z 2≤Δd1×f, where f is the sampling frequency per unit time); if the absolute value of the defocus amount at the current moment is not less than the set defocus amount threshold, it indicates that the distance between the objective lens position and the collimation position is large at this time, and a fast objective lens moving speed needs to be adopted to reduce the adjacent sampling interval in the objective lens moving direction. By limiting the change in real-time defocus amount between two adjacent moments to not greater than the second defocus amount change threshold Δd2 and greater than the first defocus amount change threshold, the moving speed of the objective lens along the z-axis is obtained as the first moving speed (Δd1×f<v). z 1≤Δd2×f).

[0141] The first defocus change threshold is less than the second defocus change threshold, and the first and second defocus change thresholds can be determined by focusing accuracy.

[0142] By comparing the absolute value of the current defocus amount with the set defocus threshold, the corresponding defocus change threshold is selected, which facilitates the selection of a suitable objective lens movement speed. For positions with large defocus, a relatively large movement speed is used for focusing, increasing the sampling interval between adjacent light spot images. For positions with small defocus, the movement speed is reduced to decrease the sampling interval between adjacent light spot images, effectively balancing the calculation workload of focusing speed and defocus amount, and achieving fast focusing.

[0143] As shown in Figure 5, a second aspect of the present invention also provides an autofocus control system for dynamically driving and controlling the objective lens along the z-axis to balance the computational complexity of focusing speed and defocusing amount, comprising:

[0144] The motion analysis module constrains the total displacement of the light spot on the sensor caused by the moving speed of the objective lens along the z-axis and the moving speed of the object under test along the x-axis, in order to screen out the upper limit of the moving speed allowed by the objective lens.

[0145] The dynamic drive adjustment module obtains the current moving speed and defocus amount of the objective lens along the z-axis, and determines the relationship between the absolute value of the defocus amount and the set defocus amount threshold. If it is not greater than the set defocus amount threshold, the objective lens is driven to move at the second moving speed; if it is greater than the set defocus amount threshold, the objective lens is driven to move at the first moving speed.

[0146] The second moving speed is less than the first moving speed, and the first moving speed is not greater than the upper limit of the moving speed allowed by the objective lens.

[0147] The specific implementation of the autofocus control system provided in this application can be referred to the above-described autofocus control method, and will not be repeated here.

[0148] In another embodiment, a computer-readable storage medium is also provided, which stores a computer program that, when executed by a processor, implements any of the above-described autofocus control methods.

[0149] In the description of this specification, references to terms such as "an embodiment," "example," and "specific example" indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0150] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the claimed invention.

Claims

1. An autofocus control method for dynamically driving and controlling the movement speed of an objective lens along the z-axis to balance the computational complexity of focusing speed and defocusing amount, characterized in that... include: The maximum allowable spot displacement of the sensor is used to constrain the total displacement of the spot on the sensor caused by the moving speed of the objective lens along the z-axis and the moving speed of the object under test along the x-axis, so as to screen out the upper limit of the moving speed allowed by the objective lens. The total displacement under the constraint is less than the maximum allowable spot displacement of the sensor. The moving speed and defocus amount of the current objective lens along the z-axis are obtained, and the relationship between the absolute value of the defocus amount and the set defocus amount threshold is determined. If it is not greater than the set defocus amount threshold, the objective lens is driven to move at the second moving speed. If it is greater than the set defocus amount threshold, the objective lens is driven to move at the first moving speed. The second moving speed is less than the first moving speed, and the first moving speed is not greater than the upper limit of the moving speed allowed by the objective lens.

2. The autofocus control method according to claim 1, characterized in that, The method for determining the upper limit of the objective lens's allowable movement speed includes: establishing a relationship between the objective lens's movement speed along the z-axis and the object's movement speed along the x-axis based on a set displacement threshold, the object's movement speed along the x-axis, the objective lens's magnification, and the sensor's exposure time; and determining the range of the objective lens's movement speed along the z-axis; the relationship is as follows: Vx represents the velocity of the object being measured along the x-axis, and Vz represents the velocity of the objective lens along the z-axis. max Let d represent the distance from a point on the object at the edge of the field of view to the z-axis, and let d represent the distance from the objective lens to the surface of the object along the z-axis. img The value is represented by the set displacement threshold, M represents the magnification of the objective lens, and T represents the single exposure time of the sensor.

3. The autofocus control method according to claim 1, characterized in that, The method for determining the set defocus threshold includes: obtaining the magnification of the objective lens, filtering the depth of field of the objective lens with the magnification, fixing the magnification factor and the maximum allowable defocus within the depth of field, and calculating the defocus threshold of the objective lens.

4. The autofocus control method according to claim 2, characterized in that, The method for adjusting abnormal defocus includes: calculating the change in defocus and the change in z-axis position between two adjacent time points, and calculating the relative deviation between the change in defocus and the change in z-axis position at the same time point; determining whether the absolute value of the relative deviation between two adjacent time points is greater than a set deviation threshold; if it is greater than the set deviation threshold, then the abnormal defocus is removed, and the change in the objective lens position on the z-axis between two adjacent time points is used to correct the defocus at the current time point.

5. The autofocus control method according to claim 4, characterized in that, If the absolute value of the relative deviation between two adjacent moments is greater than the set deviation threshold, the defocus amount at the current moment is corrected by the ratio of the defocus amount at the previous moment, the change in z-axis position between two adjacent moments, and the sum of the cumulative changes in defocus amount between adjacent moments to the sum of the changes in objective lens position along the z-axis.

6. The autofocus control method according to claim 1, characterized in that, The method for analyzing the surface unevenness of the test object includes: establishing a trajectory curve between the moving distance and the defocus amount of the test object using a corrected defocus amount, and predicting the defocus amount at the next moment based on the trajectory curve; calculating the real-time defocus amount at the current moment based on the defocus amount at the previous moment's position, the moving speed of the test object along the z-axis, and the sampling frequency; extracting the defocus amount predicted by the real-time defocus amount model and the defocus amount predicted by the trajectory curve model at the same moment, and analyzing the relative height difference between the surface of the test object at the current moment and the surface of the test object at the previous moment.

7. The autofocus control method according to claim 1, characterized in that, If the defocus amount at the current moment is not greater than the set defocus amount threshold, the second moving speed of the objective lens along the z-axis is determined if the change in real-time defocus amount between two adjacent moments is less than the set first defocus amount change threshold; if the defocus amount at the current moment is greater than the set defocus amount threshold, the first moving speed of the objective lens along the z-axis is determined if the change in real-time defocus amount between two adjacent moments is less than the second defocus amount change threshold and greater than the first defocus amount change threshold.

8. An autofocus control method according to any one of claims 1-7, characterized in that, Also includes: Several sets of defocus thresholds and corresponding moving speeds are set, all of which are greater than the maximum defocus amount allowed within the depth of field of the objective lens; the moving speed and defocus amount of the current objective lens along the z-axis are obtained; from the several sets of defocus thresholds, the smallest defocus threshold among the absolute values ​​greater than the current defocus amount is selected, and based on the smallest defocus threshold among the absolute values ​​greater than the current defocus amount, the moving speed corresponding to the defocus threshold is selected, and the objective lens is driven to move at the selected moving speed to achieve multi-level speed adjustment of the objective lens along the z-axis.

9. An autofocus control system for dynamically driving and controlling an objective lens along the z-axis to balance the computational complexity of focusing speed and defocusing amount, characterized in that... The method described in any one of claims 1-7 includes: a motion analysis module, which uses the maximum spot displacement allowed by the sensor to constrain the total displacement of the spot on the sensor caused by the moving speed of the objective lens along the z-axis and the moving speed of the object under test along the x-axis, so as to filter out the upper limit moving speed allowed by the objective lens, wherein the total displacement under the constraint is less than the maximum spot displacement allowed by the sensor; and a dynamic drive adjustment module, which obtains the current moving speed and defocus amount of the objective lens along the z-axis, determines the relationship between the absolute value of the defocus amount and a set defocus amount threshold, and if it is not greater than the set defocus amount threshold, drives the objective lens to move at a second moving speed; if it is greater than the set defocus amount threshold, drives the objective lens to move at a first moving speed; wherein the second moving speed is less than the first moving speed, and the first moving speed is not greater than the upper limit moving speed allowed by the objective lens.

10. A computer-readable storage medium, characterized in that, A computer-readable storage medium stores a computer program that, when executed by a processor, implements the autofocus control method according to any one of claims 1-8.

Citation Information

Patent Citations

  • Focusing method and system

    CN120266030A

  • Auto-focusing device and focus control method

    JP2012230195A