An automatic focusing method, system and medium
By identifying the objective lens magnification, constructing a motion model, and making dynamic adjustments, a defocus trajectory curve is established. By combining uniform speed and deceleration drive, the problem of inaccurate focusing of the objective lens in the prior art is solved, and fast and accurate autofocus is achieved.
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
Existing laser autofocus technology cannot select a suitable focusing strategy based on objectives with different magnifications, resulting in the inability to achieve the best focusing effect. Furthermore, the objective cannot accurately focus to the ideal position when moving along the Z-axis, leading to focus delay.
By identifying the magnification of the objective lens, selecting the corresponding defocus threshold, constructing theoretical and experimental motion models, dynamically adjusting the theoretical motion model to eliminate the difference between predicted and measured values, establishing a defocus trajectory curve model, selecting the optimal relative movement distance, and combining uniform and deceleration drive control, fast and accurate focusing is achieved.
It enables rapid focusing of objectives with different magnifications, avoids focusing delay, improves focusing accuracy and efficiency, reduces data calculation, and ensures that the objective stops at the position with the minimum defocus.
Smart Images

Figure CN121541357B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of laser autofocus technology, and relates to an automatic focusing method, system and medium. Background Technology
[0002] Autofocus technology calculates the current defocus level of the objective lens using feedback signals and converts this into motion signals for a motor. The motor then moves the objective lens to achieve focusing. Based on the type of feedback signal, autofocus technology can be divided into two types: image autofocus and laser autofocus. Image autofocus analyzes the sharpness of the current image using an image sharpness evaluation function, determining the current defocus level based on a quantified sharpness value. Laser autofocus, on the other hand, projects a laser beam directly onto the surface of the sample and determines the objective lens's defocus level by observing the state of the laser beam reflected back from the sample surface.
[0003] Autofocus technology is widely used in the inspection of semiconductor wafers, LCD screens, and other industries. Due to the inspection requirements, different magnification objectives are needed to inspect the objects under test, typically 5x (depth of field 14µm), 10x (depth of field 3.6µm), 20x (depth of field 1.6µm), and 50x (depth of field 0.9µm). Different magnification objectives correspond to different depths of field; the higher the magnification, the smaller the depth of field. In microscope autofocus systems, the movement of the objective lens is usually driven by a motor. When the camera needs to focus on a moving object under a high-magnification objective, the motor needs to be moved along the Z-axis. The system adjusts the motor speed based on feedback signals (defocus amount) to achieve deceleration control, ensuring that the defocus amount corresponding to the spot image is within the set defocus range, thus preventing the achievement of optimal focusing.
[0004] Currently, laser autofocus technology uses a set defocus amount for focus determination. Consequently, all objectives with different magnifications use the same set defocus amount for defocus determination. This makes it impossible to select a suitable focusing strategy based on different magnifications, thus failing to achieve the best focusing effect. At the same time, when driving the objective to move along the Z-axis for focusing, the drive motor cannot guarantee that the objective is accurately focused to the ideal focus position (i.e., the defocus amount of the spot image is minimized). It is necessary to continuously calculate and judge the defocus amount, which cannot achieve fast and accurate autofocus, resulting in focus delay. Summary of the Invention
[0005] The purpose of this invention is to overcome the above-mentioned problems in the prior art and to provide an automatic focus method, system and medium.
[0006] To achieve the above-mentioned technical objectives and effects, the present invention is implemented through the following technical solution:
[0007] An automatic focus tracking method is used to drive and control the autofocus process to achieve fast focus tracking, the focus tracking method comprising:
[0008] Identify the magnification of the objective lens and filter the defocus threshold corresponding to the magnification.
[0009] During the focusing process, a theoretical motion model, a measured motion model, and a measured variance of the focusing process parameters are constructed to predict the focusing process parameters at the next moment. The focusing process parameters include Z-axis position, objective lens moving speed, and defocusing amount. The theoretical motion model and the measured motion model represent the relationship between the theoretical focusing process parameters and the measured focusing process parameters as they change over time, respectively.
[0010] Analyze the deviation between the corresponding focusing process parameters in the theoretical motion model and the measured motion model at the same moment, and determine whether the deviation of at least one focusing process parameter is greater than the set deviation threshold.
[0011] If it exists, the theoretical motion model is used to predict the focusing process parameters at the next moment. The theoretical motion model at the next moment is dynamically adjusted by combining the measured variance and the measured focusing process parameters at the next moment to eliminate the difference between the predicted value and the measured value.
[0012] Furthermore, the theoretical motion model is a motion model under uniform velocity conditions, which predicts the focusing process parameters at the next moment based on the moving speed of the objective lens and the interval between two adjacent moments.
[0013] Furthermore, the dynamic adjustment method of the theoretical motion model includes: adjusting the theoretical motion model by using predicted focusing process parameters, measured focusing process parameters, and the weights of the predicted and measured focusing process parameters in the predicted focusing process parameters.
[0014] Furthermore, the focusing method also includes:
[0015] Using the position and defocus amount of the objective lens in the adjusted theoretical motion model, a defocus trajectory curve model is established, and the Z-axis position corresponding to the minimum defocus amount is selected.
[0016] Extract the Z-axis position range where the defocus amount is less than the defocus amount threshold, and calculate the relative Z-axis position range. The relative Z-axis position range is the distance difference between the Z-axis position corresponding to the minimum defocus amount and the Z-axis position where the defocus amount is less than the defocus amount threshold.
[0017] Select the optimal relative movement distance and drive the objective lens to focus;
[0018] The optimal relative movement distance is the distance between the current Z-axis position and the Z-axis position corresponding to the minimum defocus.
[0019] Furthermore, the method for determining the defocus threshold is as follows: determining the depth of field of the microscope system at the objective lens magnification.
[0020] In the defocus trajectory curve model, the distance from the Z-axis position of the minimum defocus amount is the defocus amount corresponding to a certain number of depths of field.
[0021] The distance from the Z-axis position of the minimum defocus amount is such that the defocus amount corresponding to one depth of field is less than the defocus amount threshold.
[0022] Furthermore, the method for selecting the optimal relative movement distance and driving the objective lens to focus includes:
[0023] Based on the current objective lens moving speed along the Z-axis and the optimal relative moving distance, analyze the allowable acceleration;
[0024] Using a dynamically adjusted theoretical motion model, the Z-axis position of the objective lens under different feedback cycles was obtained sequentially.
[0025] Calculate the positional deviation, dynamically adjust the objective lens position on the Z-axis, and correct the objective lens movement distance on the Z-axis to focus to the Z-axis position corresponding to the minimum defocusing amount.
[0026] Furthermore, based on the optimal relative movement distance, the acceleration of the objective lens on the Z-axis and the deceleration duration of the objective lens are determined, wherein the deceleration duration of the objective lens is greater than the feedback period.
[0027] Furthermore, the dynamic adjustment of the Z-axis position of the objective lens is achieved by using the Z-axis position at the defocus threshold corresponding to the current objective lens magnification, the ratio between the position deviation in the current feedback cycle and the theoretical Z-axis position change of the objective lens in one feedback cycle, and the ratio between the cumulative position deviation in the cumulative feedback cycle and the theoretical cumulative Z-axis position change, to dynamically correct the Z-axis position under different feedback cycles.
[0028] An automatic focus tracking system includes:
[0029] The threshold analysis module is used to identify the magnification of the objective lens and filter the defocus threshold corresponding to the magnification.
[0030] The data prediction module is used to construct a theoretical motion model, a measured motion model, and a measured variance of the focusing process parameters during the focusing process, and to predict the focusing process parameters at the next moment. The focusing process parameters include Z-axis position, objective lens moving speed, and defocusing amount. The theoretical motion model and the measured motion model are the relationships between the theoretical focusing process parameters and the measured focusing process parameters as they change over time, respectively.
[0031] The drive focus analysis module is used to analyze the deviation between the corresponding focusing process parameters in the theoretical motion model and the measured motion model at the same moment, and to determine whether the deviation of at least one focusing process parameter is greater than the set deviation threshold.
[0032] If it exists, the theoretical motion model is used to predict the focusing process parameters at the next moment. The theoretical motion model at the next moment is dynamically adjusted by combining the measured variance and the measured focusing process parameters at the next moment to eliminate the difference between the predicted value and the measured value.
[0033] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the automatic focus method described above.
[0034] The beneficial effects of this invention are:
[0035] The automatic focusing method provided by this invention compares the corresponding focusing process parameters in the theoretical motion model and the measured motion model to determine the deviation of the predicted focusing process parameters. Based on the measured motion model and the measured variance, the theoretical motion model is dynamically adjusted. Then, the defocus amount in the dynamically adjusted theoretical motion model is compared with the defocus amount threshold corresponding to the current objective lens magnification to drive the objective lens with acceleration control, thereby achieving fast focusing and meeting the focusing requirements of objectives with different magnifications, and avoiding focusing delay.
[0036] This invention determines whether there is a deviation between the predicted and measured values of a focusing process parameter that exceeds a set deviation threshold. If so, it updates and adjusts the theoretical motion model by using the weights of the predicted and measured focusing process parameters in the predicted focusing process parameters, thereby eliminating the deviation between the predicted and measured values and making the focusing process parameters predicted by the theoretical motion model closer to the true values.
[0037] This invention drives the objective lens to brake when the predicted defocus amount is less than the defocus amount threshold corresponding to the current objective lens magnification, so that the objective lens comes to a stop and triggers the acquisition of the laser spot image. This ensures that the acquired spot image has no motion model, and that after the objective lens comes to a stop, the defocus amount approaches the position corresponding to the ideal spot position.
[0038] This invention establishes trajectory curve models between various positions on the Z-axis and the defocus amount, thereby obtaining the position corresponding to the minimum defocus amount. It can also analyze the relative movement distance range corresponding to the position corresponding to the current defocus amount and the position where the defocus amount is less than the set defocus amount threshold. This allows for the selection of the optimal relative movement distance, and the objective lens is driven to focus based on the optimal relative movement distance. This achieves focus control based on movement distance, avoiding continuous defocus analysis during objective lens focusing, reducing data calculations, and improving focusing accuracy and efficiency.
[0039] This invention combines uniform drive control and deceleration drive control, which can dynamically adjust the error during the focusing process to reduce the impact of sensor detection error on focusing, avoid data delay problems, improve focusing efficiency, and ensure that the objective lens stops at the Z-axis position corresponding to the minimum defocusing amount, thus achieving precise focusing. 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 This is a schematic diagram of the optical path structure of the microscopic autofocus device in this invention;
[0042] Figure 2 This is a flowchart of an automatic focus method in this invention;
[0043] Figure 3 This is a flowchart of another automatic focus method in this invention;
[0044] Figure 4 This is a schematic diagram of the relative distance and defocus amount in this invention;
[0045] Figure 5 This is a flowchart of the method for driving the objective lens to focus in this invention;
[0046] Figure 6 This is a schematic diagram of an automatic focus system according to the present invention. Detailed Implementation
[0047] 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.
[0048] During microscope autofocus, the defocusing amount is calculated based on the centroid of the laser spot image, which then controls the objective lens to move along the Z-axis to the focusing position. The microscope autofocus 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. Changing the objective lens's magnification directly affects the depth of field of the optical path system acquiring the object's surface image, thus affecting the sharpness of the acquired laser spot image. Using objectives with different magnifications will result in focus delay due to the altered depth of field if the same objective lens drive strategy is employed.
[0049] like Figure 1 As shown in the figure, this application provides a schematic diagram of the optical path structure of a prior art microscopic autofocus device based on a laser spot. The optical principle is explained as follows:
[0050] The laser unit emits a parallel laser beam (i.e., a parallel beam). This parallel laser beam is modulated by a cylindrical lens into an asymmetric beam that diverges in the direction of the lens's curvature and is collimated in the direction outside the curvature. The asymmetric beam loses half its energy after passing through a baffle and propagates only on one side of the optical axis, forming a semi-elliptical beam. After being reflected by a reflecting mirror, a first beam splitter, and a second beam splitter, the beam enters the microscope objective. The laser beam is then focused onto the surface of the object under test by the microscope objective.
[0051] The laser beam reflected from the surface of the object under test passes through the microscope objective, the second beam splitter, and the first beam splitter, and is then focused by the focusing lens onto the surface of the first sensor to form a laser spot. The first sensor then acquires an image of the laser spot reflected from the surface of the object under test. The first sensor is the focusing sensor of this application, used in the microscopic autofocus device to acquire the laser spot to calculate the defocusing amount.
[0052] The image processing unit calculates the defocus amount based on the shape of the laser spot in the light spot image, and converts the defocus amount into a control signal for the drive unit, which then drives the microscope objective to move, thereby achieving automatic focusing.
[0053] The illumination source, together with the third beam splitter, the second beam splitter, and the microscope objective, forms a coaxial illumination optical path. The tube mirror, the second sensor, and the microscope objective form an imaging optical path. The second sensor is used to acquire an image of the surface of the object under test after focusing.
[0054] Preferably, the driving unit can be a motor or other driving device to achieve focusing movement control of the microscope objective.
[0055] To solve the above problems, such as Figure 2 As shown, this embodiment proposes an automatic focus tracking method for driving and controlling the automatic focus process to achieve fast focus tracking. The focus tracking method includes:
[0056] Step 1: Identify the magnification of the objective lens and filter the defocus threshold corresponding to the magnification.
[0057] When performing autofocus, the magnification of the objective lens is identified first. The magnification of the objective lens can be identified manually or using a calibration object.
[0058] To facilitate the differentiation of the magnification of objectives, different objectives are marked with their corresponding magnification, which is then manually identified.
[0059] Alternatively, a calibration object (with a flat surface) identification method can be used. The actual physical dimensions of the known calibration object (i.e., the physical dimensions in the actual coordinate system formed by the x1 and y1 axes) are selected, and the objective lens is moved along the Z-axis until the acquired light spot is clear and essentially a thin, straight line. The number of pixels occupied by the calibration object along the x-axis of the image (the x and y axes form the image coordinate system) is counted. Based on the total pixel size occupied by the calibration object along the x-axis, the magnification of the objective lens is calculated.
[0060] In this context, the magnification of the objective lens is equal to the ratio between the total pixel size and the actual physical size.
[0061] The x1 axis of the calibration object is parallel to the x-axis of the image, and the y1 axis of the calibration object is parallel to the y-axis of the image.
[0062] Based on the determined objective magnification, the defocus threshold corresponding to the current objective magnification is selected from the defocus thresholds corresponding to the calibrated objective magnification.
[0063] Step 2: Construct the theoretical motion model, measured motion model, and measured variance of the focusing process parameters during the focusing process, and predict the focusing process parameters at the next moment; the focusing process parameters include Z-axis position, objective lens moving speed, and defocus amount; the theoretical motion model and measured motion model are the relationship between the theoretical focusing process parameters and the measured focusing process parameters as they change over time, respectively.
[0064] Select the focusing parameters for the objective lens at the current magnification, which are the current Z-axis position z. k The moving speed v of the objective lens on the Z-axis k And the defocus amount d at the current position k .
[0065] Theoretical motion models for focusing process parameters are established, namely position dynamic model, velocity dynamic model and defocus amount dynamic model. Among them, the theoretical motion model is a motion model under uniform velocity state, which predicts the focusing process parameters at the next moment based on the moving speed of the objective lens along the Z-axis and the time interval between two adjacent moments.
[0066] Specifically, the location dynamic model: Dynamic model of velocity under uniform speed: v k+1 =v k Defocus dynamic model: d k+1 =d k -(z k+1 -z k ), d k =z k -z0;
[0067] Among them, z k z k+1 Let v represent the position of the objective lens on the Z-axis at time k and time (k+1), respectively; Δt represents the time interval between two adjacent time points; v k v k+1 d represents the moving speed of the objective lens along the Z-axis at time k and time (k+1), respectively; k Let d be the defocusing amount at time k. k+1 Let z be the defocusing amount at time k+1, and z0 be the ideal focus position.
[0068] Based on the motion model of the focusing process parameters described above, a theoretical motion model A for the focusing process parameters under uniform velocity conditions is constructed. k+1 , ;
[0069] in, As a parameter matrix for the focusing process.
[0070] In this embodiment, when using the motion model of uniform focusing process parameters, the corresponding defocus amount is greater than the defocus amount threshold. As the objective lens moves along the Z-axis, the defocus amount at the next moment is less than the defocus amount at the previous moment. When the defocus amount equals 0, and the lens continues to move along this direction, the defocus amount at the next moment is greater than the defocus amount at the previous moment.
[0071] When the acceleration is not equal to 0, the velocity dynamic model v k+1 v k+1 =v k +a1×t0, where a1 represents acceleration and t0 represents acceleration time. In this embodiment, the motion model of the focusing process parameters is for the case where the acceleration is equal to 0.
[0072] By performing multiple calculations on the focusing process parameters, the variance L of each focusing process parameter is obtained:
[0073] ;
[0074] in, Let L represent the theoretical variances of the Z-axis position, moving speed, and defocusing amount at the k-th time, respectively. Let L represent the expression corresponding to the theoretical variances of the Z-axis position, moving speed, and defocusing amount. The variance L of the above focusing process parameters reflects the uncertainty of the established motion model of the focusing process parameters.
[0075] Establish a measured motion model B of the actual focusing process parameters. k+1 , ,
[0076] in, As the actual measurement parameter matrix.
[0077] By performing multiple calculations on the measured motion model, the variances of each actual measured parameter were obtained:
[0078] ;
[0079] in, , , Let Z represent the measured variances of the Z-axis position, moving speed, and defocus amount at the k-th time, respectively. R represents the expression corresponding to the measured variances of the Z-axis position, moving speed, and defocus amount. The variances of each actual measured parameter are determined by the stability of the detection equipment, namely the variances of the sensor detection position data, the sensor detection speed data, and the calculated variances of the defocus amount.
[0080] Step 3: Analyze the deviation between the corresponding focusing process parameters in the theoretical motion model and the measured motion model at the same moment, and determine whether the deviation of at least one focusing process parameter is greater than the set deviation threshold.
[0081] If it exists, the theoretical motion model is used to predict the focusing process parameters at the next moment. The theoretical motion model at the next moment is dynamically adjusted by combining the measured variance and the measured focusing process parameters at the next moment in order to eliminate the difference between the predicted value and the measured value.
[0082] If it does not exist, then when the predicted defocus amount is less than the defocus amount threshold, the objective lens is driven to move and focus with a fixed acceleration.
[0083] At a certain moment, the theoretical Z-axis position, theoretical objective lens moving speed, and theoretical defocus amount in the theoretical motion model are compared with the measured Z-axis position, measured objective lens moving speed, and measured defocus amount in the actual motion model to determine whether there are differences in the Z-axis position, objective lens moving speed, and defocus amount.
[0084] The deviations between the predicted and measured values of the Z-axis position, the predicted and measured values of the objective lens movement speed, and the predicted and measured values of the defocus amount are calculated. It is then determined whether the deviations corresponding to the theoretical Z-axis position, theoretical objective lens movement speed, and theoretical defocus amount are greater than the set deviation thresholds corresponding to the focusing process parameters. When the deviation of at least one of the focusing process parameters (Z-axis position, objective lens movement speed, and defocus amount) is greater than the set deviation threshold, it indicates that the measured value of the focusing process parameter with the deviation greater than the set deviation threshold deviates from the measured value. In order to make the predicted value of the focusing process parameter equal to the measured value (the deviation between the measured value and the predicted value is less than the set deviation threshold), the deviation of the focusing process parameter needs to be adjusted to eliminate the error of the focusing process parameter predicted in the theoretical motion model.
[0085] By comparing the deviation of any pair of focusing process parameters with the corresponding deviation threshold, the degree of deviation between the predicted focusing process parameters and the actual measured focusing process parameters is determined, and whether the focusing judgment condition is met, thereby achieving focus tracking.
[0086] This embodiment discloses a method for dynamically adjusting a theoretical motion model, including: adjusting the theoretical motion model by using predicted focusing process parameters, measured focusing process parameters, and the weights of the predicted and measured focusing process parameters in the predicted focusing process parameters.
[0087] Based on the deviation between measured and predicted values, the predicted values are dynamically adjusted. Specifically, based on the deviation between predicted and measured values, the theoretical motion model is dynamically updated and adjusted. The updated motion model for the predicted focusing process parameters is as follows:
[0088]
[0089] Adjust the variance of the focusing process parameters: ;
[0090] Among them, b T It is represented as the transpose of b. Represented as The transpose of A k+1|k It represents the predicted value of the focusing process parameters at time k+1, given the focusing process parameters at time k. B represents the measured value of the focusing process parameters at the adjusted time k+1. k+1 H represents the focusing process parameters actually measured at time k+1; k+1 Represented as the prediction gain coefficient, it is used to adjust the weights of prediction and measurement; u k+1|k This means predicting the variance of the focusing process parameters at time k+1 based on the variance of the focusing process parameters at time k; u k|kThis represents the variance of the focusing process parameters at time k. u represents the variance of the focusing process parameters at the adjusted time k+1. 0|0 It represents the variance of the initial focusing process parameters, used to reflect the uncertainty of the Z-axis position, the objective lens's moving speed on the Z-axis, and the defocus amount, that is, the variance of the data detected at the initial moment for the Z-axis position, the objective lens's moving speed on the Z-axis, and the defocus amount.
[0091] By predicting the focusing process parameters for the next moment based on the relationship between the predicted and measured values of the focusing process parameters at the previous moment, the focusing process parameters for the next moment can be accurately obtained. At the same time, it is convenient to determine the Z-axis position that is less than the defocus threshold based on the predicted defocus amount and the set defocus amount threshold.
[0092] This embodiment also discloses another dynamic adjustment method, which calculates the deviation values between the predicted and measured values of the Z-axis position, objective lens movement speed, and defocus amount, respectively. The deviation values of the focusing process parameters are used to compensate for the predicted Z-axis position, predicted objective lens movement speed, and predicted defocus amount, so as to obtain the compensated and adjusted predicted Z-axis position, predicted objective lens movement speed, and predicted defocus amount, thereby eliminating the error between the predicted and measured values.
[0093] Specifically, if the deviation values between the predicted Z-axis position and the measured Z-axis position, the deviation values between the predicted objective lens movement speed and the measured objective lens movement speed, and the deviation values between the predicted defocus amount and the measured defocus amount are used, the predicted Z-axis position at time k is compensated using the deviation value between the predicted Z-axis position at time k and the measured Z-axis position, the objective lens movement speed at time k is compensated using the deviation value between the predicted objective lens movement speed at time k and the measured objective lens movement speed, and the defocus amount at time k is compensated using the deviation value between the predicted defocus amount at time k and the measured defocus amount, so as to obtain the compensated focusing process parameters and eliminate the influence of the deviation between the predicted value and the measured value.
[0094] If the above steps are adopted, the image sensor acquires light spot images at different positions of the objective lens on the Z-axis, calculates the defocus amount of the light spot images, and obtains the defocus amount at the current position.
[0095] If image acquisition is performed while the objective lens is moving, motion blur will occur in the spot image, affecting the accuracy of the defocus calculation. Therefore, after moving to the target position, the spot image should be acquired and the defocus calculation performed once the objective lens has stabilized and come to a stop.
[0096] Using steps 1-3 above, the image sensor acquires spot images at different positions on the Z-axis of the objective lens, and calculates the defocus amount at each position. If the spot image is acquired during objective lens movement, motion blur will occur, affecting the accuracy of the defocus calculation. Therefore, after moving to the target position and waiting for the objective lens vibration to stabilize, the spot image is acquired and the defocus amount is calculated.
[0097] Because images cannot be captured in real time during the continuous movement of the objective lens, the captured positions are discrete points, resulting in discrete defocusing amounts. Therefore, it cannot be guaranteed that the objective lens will stop at the exact position corresponding to the optimal defocusing amount after braking.
[0098] In this embodiment, as Figure 3 As shown, based on the above discrete defocus amount, it also includes steps 4 and 5. Step 4 is to establish the trajectory curve model between the Z-axis position and the defocus amount.
[0099] Step 5: Based on the trajectory curve model, identify the Z-axis position corresponding to the current defocus amount and the position range where the defocus amount is less than the set defocus amount threshold, and calculate the relative movement distance range.
[0100] Using the Z-axis position and defocus amount of the objective lens in the adjusted theoretical motion model, a defocus trajectory curve model is established, and the Z-axis position corresponding to the minimum defocus amount is selected.
[0101] Extract the Z-axis position range where the defocus amount is less than the defocus amount threshold, calculate the relative Z-axis position range, which is the distance difference between the Z-axis position corresponding to the minimum defocus amount and the Z-axis position where the defocus amount is less than the defocus amount threshold; select the optimal relative movement distance and drive the objective lens to focus;
[0102] Wherein, the optimal relative movement distance D is the distance between the current Z-axis position and the Z-axis position corresponding to the minimum defocusing amount.
[0103] The relative movement distance is the distance difference between the Z-axis position corresponding to the minimum defocus amount and the position where the defocus amount is less than the set defocus amount threshold. The Z-axis position corresponding to the minimum defocus amount is used as the ideal focus position.
[0104] First, establish the coordinate system for the trajectory curve model, such as... Figure 4 As shown, the initial position of the objective lens is taken as the origin of the coordinate system, the direction of the objective lens pointing towards the object under test along the Z-axis is taken as the positive direction of the Z-axis, and the defocus amount corresponding to the Z-axis position is taken as the Y-axis. The horizontal axis represents the distance from each position on the Z-axis to the origin (relative distance on the Z-axis, i.e., distance from the initial position of the objective lens), and the vertical axis represents the defocus amount corresponding to each position. In this trajectory curve model, the absolute values of the defocus amount at different positions are selected to plot the defocus amount curve at the Z-axis position.
[0105] Extract several sets of defocus amounts at different Z-axis positions, and construct a trajectory curve model between position and defocus amount. .
[0106] Using the initial objective lens position z0, the defocusing amount d0 at the initial position, the initial velocity v0, the acceleration a1, and the Z-axis position z at any time... k and the defocus amount d at the aforementioned position k Substitute these values into the trajectory curve model and process the model to obtain the first and second derivatives. By analyzing multiple sets of expressions, the values of coefficients c, d, e, f, g, and h are obtained.
[0107] Where, d k It represents the defocusing amount at the Z-axis position of the objective lens at time k, where k = 1, 2, 3, ..., Δz k Let Δz represent the distance along the Z-axis between the objective lens position at time k and its initial position. k =z k -z0, h equals the defocusing amount d0 at the initial position, and g equals the speed at which the objective lens moves along the Z-axis. .
[0108] The coefficients in the polynomials above can also be obtained by fitting the coefficients through several sets of relationships between position and defocus amount. For objectives with different magnifications, the trajectory curves will differ. When determining the defocus amount threshold corresponding to objectives with different magnifications, it is necessary to determine it based on the trajectory curve corresponding to the objective with that magnification.
[0109] By constructing the trajectory curve between the position and the defocus amount, the range of positions on the trajectory curve where the defocus amount is less than the defocus amount threshold corresponding to the current magnification is selected. Thus, the position corresponding to the minimum defocus amount is within the range, so that the objective lens drive can be controlled according to the position corresponding to the defocus amount threshold, so that the defocus amount of focusing is less than the set defocus amount threshold.
[0110] Ideally, the optical system produces the clearest image at the focal plane, where the defocus is minimal (equal to 0). As the image deviates from the focal plane, it gradually blurs, forming speckles of confusion. The defocus increases with increasing distance from the focal plane, exhibiting a symmetrical V-shaped distribution, such as... Figure 4 As shown.
[0111] In this application, a polynomial fitting is used to fit the trajectory curve between the position and the defocus amount. Polynomial fitting can adapt to complex nonlinear relationships. Under the influence of environmental factors and detection equipment, by adjusting the order of the polynomial, the relationship between the defocus amount and the position can be more accurately approximated.
[0112] In this embodiment, the corresponding defocus threshold can be selected according to the magnification of the objective lens, thereby meeting the needs of different objectives lenses.
[0113] The method for determining the defocus threshold under different objectives is as follows: determine the depth of field of the microscope system corresponding to the magnification of the objective.
[0114] In the defocus trajectory curve model, the distance from the position of minimum defocus is the defocus amount corresponding to a certain number of depths of field.
[0115] The distance from the position of minimum defocus is such that the defocus amount corresponding to one depth of field is less than the defocus threshold.
[0116] like Figure 1 As shown, a microscope system consists of an image sensor, a tube lens, a beam splitter, a beam splitter, an objective lens, and an illumination source. Under the condition that other conditions of the microscope system remain unchanged, the depth of field is determined by the optical parameters of the lens. 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 distances between the foreground depth of field and the background depth of field.
[0117] The depth of field of an objective lens is an optical parameter of the objective lens. Based on the defocus trajectory curve model, the Z-axis position corresponding to the minimum defocus is selected, and the defocus is corresponding to the position at half the depth of field from the Z-axis position corresponding to the minimum defocus. The defocus threshold is determined by using the defocus corresponding to the half depth of field position at a factor of K (K>1). Based on this, the defocus threshold corresponding to objective lenses with different magnifications can be determined.
[0118] Among them, the Z-axis position corresponding to the minimum distance from focus is the position at half the depth of field, where the defocus amount is less than the defocus amount threshold.
[0119] The defocus amount corresponding to a position with a depth of field of K times half is used to expand the screening criteria and serve as the trigger condition for objective lens braking, so that braking is performed when the Z-axis position of the objective lens is less than the defocus amount threshold.
[0120] In this process, the distance the objective lens moves during the braking process with a fixed acceleration until it comes to a stop can be used to determine the magnification K value, which is the ratio between the braking distance of the objective lens along the Z-axis and half the depth of field.
[0121] By using the trajectory curve model described above, the relationship between the continuous Z-axis position and the defocus amount is obtained, thereby determining the Z-axis position corresponding to the minimum defocus amount, determining the optimal relative movement distance, and driving the objective lens to focus based on the optimal relative movement distance.
[0122] This embodiment also includes step 6, which involves selecting the optimal relative movement distance corresponding to the minimum defocusing amount from the range of relative movement distances, and adjusting the objective lens driving method to drive the objective lens to move along the Z-axis by the optimal relative movement distance to achieve focusing drive.
[0123] like Figure 5 As shown, this embodiment discloses a method for driving an objective lens to focus based on a selected optimal relative movement distance, including:
[0124] Step 61: Based on the current moving speed of the objective lens along the Z-axis and the optimal relative moving distance D, analyze the allowable acceleration;
[0125] Permissible acceleration Based on the current moving speed V0 of the objective lens along the Z-axis and the optimal relative optical axis distance D, the acceleration of the objective lens along the Z-axis can be obtained, which makes it convenient to control the movement of the objective lens according to the acceleration.
[0126] Step 62: Using the dynamically adjusted theoretical motion model, the Z-axis position of the objective lens under different feedback cycles is obtained sequentially;
[0127] Step 63: Calculate the positional deviation, dynamically adjust the Z-axis position of the objective lens, and correct the movement distance of the objective lens on the Z-axis to focus to the Z-axis position corresponding to the minimum defocusing amount.
[0128] The Z-axis position z of the objective lens is obtained sequentially at each feedback period t1. i The position deviation ΔD is calculated by comparing it with the theoretical Z-axis position si of the objective lens at each feedback cycle t1. i In this case, the feedback period t1 is less than T. , D represents the optimal relative movement distance, which is the distance between the current Z-axis position and the Z-axis position corresponding to the minimum defocus amount. T represents the time corresponding to the optimal relative movement distance driven by the objective lens. V0 represents the current movement speed of the objective lens along the Z-axis. z0 represents the Z-axis position corresponding to the defocus amount threshold corresponding to the current objective lens magnification being less than the aforementioned defocus amount threshold. i represents the i-th feedback cycle t1, and the value of i ranges from less than... The integer si represents the theoretical position of the objective lens on the Z-axis during the i-th feedback cycle t1.
[0129] Where d0 represents the Z-axis position corresponding to the defocus threshold where the defocus amount is less than the current objective lens magnification, and i represents the number of the i-th feedback cycle t1, with i taking values less than... .
[0130] Based on the optimal relative movement distance, the acceleration of the objective lens on the Z-axis and the deceleration time of the objective lens are determined, wherein the deceleration time of the objective lens is greater than the feedback period (T>t1).
[0131] By using a motion model of the predicted focusing process parameters, the problem of inaccurate Z-axis position obtained due to sensor detection anomalies is eliminated, and the Z-axis position of the objective lens can be directly obtained for comparison with the theoretical Z-axis position.
[0132] During focusing, the direction of movement is determined based on the relative movement distance. If the relative movement distance is greater than 0, focusing continues in the current direction of movement; if the relative movement distance is less than 0, focusing occurs in the opposite direction of movement.
[0133] By determining the optimal relative movement distance, the objective lens can be driven to move along the Z-axis by the optimal relative movement distance. This enables focusing control based on the movement distance, reduces braking time, and eliminates the direction of objective lens movement along the Z-axis. Continuous defocus analysis reduces data calculation while improving focusing accuracy.
[0134] Within the range of relative movement distances, the relative movement distance corresponding to the minimum defocus is selected. Then, based on the current position and the current defocus, the relative movement distance corresponding to the minimum defocus is determined, so as to enable fast and accurate focusing during the focusing process.
[0135] With the objective lens at the current magnification, piezoelectric or electromagnetic drive can be used to move the objective lens along the Z-axis until the defocus amount corresponding to the moved position is less than the defocus amount threshold corresponding to the magnification of the objective lens. When the defocus amount at the Z-axis position of the objective lens is greater than the defocus amount threshold, uniform speed movement is adopted. When the defocus amount at the Z-axis position of the objective lens is less than the defocus amount threshold, deceleration movement is adopted. By combining uniform speed and deceleration movement, the focusing efficiency is improved, and the position of the objective lens after stopping is the Z-axis position corresponding to the minimum defocus amount.
[0136] In this embodiment, in step 63, one method for calculating the position deviation is to use a motion model of the predicted focusing process parameters under the same feedback cycle to obtain the Z-axis position z detected by the sensor. i The cumulative position deviation D is obtained by comparing it with the theoretical Z-axis position si. i D i =si-z i .
[0137] For the cumulative position deviation D i Calculate the average value to obtain the average cumulative position deviation over i feedback cycles. And so on, to obtain .
[0138] The average cumulative position deviation within the i-th feedback cycle This is the position deviation within the i-th feedback cycle.
[0139] Another method for calculating the positional deviation is to use a sensor to sequentially collect the Z-axis position z of the objective lens at each feedback cycle t1. i Based on the Z-axis position z0 corresponding to the defocus threshold where the defocus amount is less than the current objective lens magnification, the distance Δz that the objective lens moves along the Z-axis in each feedback cycle is calculated. i ,△z i =z i -z i-1 , z i and z i-1 This represents the Z-axis position of the objective lens during the i-th and (i-1)-th feedback cycles t1; and the distance the objective lens moves along the Z-axis (the theoretical change in Z-axis position) based on each feedback cycle t1. Calculate the position deviation ΔD for each feedback cycle. i =△si-△z i .
[0140] In this embodiment, the Z-axis position of the objective lens is dynamically adjusted based on the position deviation amount and the cumulative position deviation amount in each feedback cycle. The Z-axis position in each feedback cycle is dynamically corrected by using the Z-axis position at the defocus threshold corresponding to the current objective lens magnification, the ratio between the position deviation amount in the current feedback cycle and the theoretical Z-axis position change amount in one feedback cycle, and the ratio between the cumulative position deviation amount in the cumulative feedback cycle and the theoretical cumulative Z-axis position change amount.
[0141] Z-axis position correction formula: ,in, Let z represent the corrected position of the objective lens on the Z-axis during the i-th feedback cycle t1. iLet z0 represent the Z-axis position of the objective lens in the i-th feedback cycle t1, z0 represent the Z-axis position corresponding to the defocusing amount being less than the defocusing threshold corresponding to the current objective lens magnification, η represent the ratio between the position deviation in the current feedback cycle (i-th feedback cycle) and the theoretical Z-axis position change of the objective lens in one feedback cycle, which is used to reflect the degree of deviation between the data detected by the sensor and the theoretical spot position, P0 represent the Z-axis position corresponding to the ideal spot position, and β represent the ratio between the cumulative position deviation in the cumulative feedback cycle and the theoretical cumulative Z-axis position change, which is used to eliminate the error caused by long-term accumulation. During the detection process, multiple sets of data detected by the sensor are analyzed to dynamically correct the sensor detection error, so as to reduce the impact of sensor detection error on focusing and avoid data delay, which would affect the accuracy of focusing.
[0142] By using steps 4-6 above, focus adjustment is performed on the Z-axis position from the defocused position (which is less than the defocused threshold) to the ideal focus position. This corrects the deviation between the detected value and the theoretical value during the deceleration process, thereby achieving precise focus tracking.
[0143] Based on the same inventive concept, such as Figure 6 As shown, the present invention also provides an automatic focus tracking system, comprising:
[0144] The threshold analysis module is used to identify the magnification of the objective lens and filter the defocus threshold corresponding to the magnification.
[0145] The data prediction module is used to construct a theoretical motion model, a measured motion model, and a measured variance of the focusing process parameters during the focusing process, and to predict the focusing process parameters at the next moment. The focusing process parameters include Z-axis position, objective lens moving speed, and defocusing amount. The theoretical motion model and the measured motion model are the relationships between the theoretical focusing process parameters and the measured focusing process parameters as they change over time, respectively.
[0146] The drive focus analysis module is used to analyze the deviation of the corresponding focusing process parameters in the theoretical motion model and the measured motion model at the same moment, and to determine whether the deviation of at least one pair of focusing process parameters is greater than the set deviation threshold.
[0147] If it exists, the theoretical motion model is used to predict the focusing process parameters at the next moment. The theoretical motion model at the next moment is dynamically adjusted by combining the measured variance and the measured focusing process parameters at the next moment in order to eliminate the difference between the predicted value and the measured value.
[0148] If it does not exist, then when the predicted defocus amount is less than the defocus amount threshold, the objective lens is driven to move and focus with a fixed acceleration.
[0149] In another embodiment provided in this application, 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 automatic focus methods.
[0150] 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.
[0151] 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 automatic focus tracking method for driving and controlling the automatic focus process to achieve fast focus tracking, characterized in that, The focusing method includes: Identify the magnification of the objective lens and filter the corresponding defocus threshold; A theoretical motion model, a measured motion model, and a measured variance of the focusing process parameters are constructed to predict the focusing process parameters at the next moment. The focusing process parameters include Z-axis position, objective lens moving speed, and defocusing amount. The theoretical motion model and the measured motion model represent the relationship between the theoretical focusing process parameters and the measured focusing process parameters over time, respectively. Analyze the deviation between the corresponding focusing process parameters in the theoretical motion model and the measured motion model at the same moment, and determine whether the deviation of at least one focusing process parameter is greater than the set deviation threshold. If it exists, the theoretical motion model is used to predict the focusing process parameters at the next moment. The theoretical motion model at the next moment is dynamically adjusted by combining the measured variance and the measured focusing process parameters at the next moment to eliminate the difference between the predicted value and the measured value.
2. The automatic focus method according to claim 1, characterized in that, The theoretical motion model is a motion model under uniform velocity conditions. Based on the moving speed of the objective lens and the time interval between two adjacent moments, it predicts the focusing process parameters at the next moment.
3. The automatic focus method according to claim 2, characterized in that, The method for dynamically adjusting the theoretical motion model includes: adjusting the theoretical motion model by using predicted focusing process parameters, measured focusing process parameters, and the weights of the predicted and measured focusing process parameters in the predicted focusing process parameters.
4. The automatic focus method according to claim 3, characterized in that, The focusing method further includes: Using the position and defocus amount of the objective lens in the adjusted theoretical motion model, a defocus trajectory curve model is established, and the Z-axis position corresponding to the minimum defocus amount is selected. Extract the Z-axis position range where the defocus amount is less than the defocus amount threshold, and calculate the relative Z-axis position range. The relative Z-axis position range is the distance difference between the Z-axis position corresponding to the minimum defocus amount and the Z-axis position where the defocus amount is less than the defocus amount threshold. Select the optimal relative movement distance and drive the objective lens to focus; The optimal relative movement distance is the distance between the current Z-axis position and the Z-axis position corresponding to the minimum defocus.
5. The automatic focusing method according to claim 2, characterized in that, The method for determining the defocus threshold is as follows: determine the depth of field of the microscope system at the objective lens magnification. In the defocus trajectory curve model, the distance from the Z-axis position of the minimum defocus amount is the defocus amount corresponding to a certain number of depths of field. The distance from the Z-axis position of the minimum defocus amount is such that the defocus amount corresponding to one depth of field is less than the defocus amount threshold.
6. The automatic focusing method according to claim 5, characterized in that, The method for selecting the optimal relative movement distance and driving the objective lens to focus includes: Based on the current objective lens moving speed along the Z-axis and the optimal relative moving distance, analyze the allowable acceleration; Using a dynamically adjusted theoretical motion model, the Z-axis position of the objective lens under different feedback cycles was obtained sequentially. Calculate the positional deviation, dynamically adjust the objective lens position on the Z-axis, and correct the objective lens movement distance on the Z-axis to focus to the Z-axis position corresponding to the minimum defocusing amount.
7. The automatic focusing method according to claim 6, characterized in that, Based on the optimal relative movement distance, the acceleration of the objective lens on the Z-axis and the deceleration time of the objective lens are determined, wherein the deceleration time of the objective lens is greater than the feedback period.
8. The automatic focus method according to claim 2, characterized in that, The dynamic adjustment of the Z-axis position of the objective lens is achieved by using the Z-axis position at the defocus threshold corresponding to the current objective lens magnification, the ratio between the position deviation in the current feedback cycle and the theoretical Z-axis position change of the objective lens in one feedback cycle, and the ratio between the cumulative position deviation in the cumulative feedback cycle and the theoretical cumulative Z-axis position change, to dynamically correct the Z-axis position under different feedback cycles.
9. An automatic focus tracking system, characterized in that, include: The threshold analysis module is used to identify the magnification of the objective lens and filter the corresponding defocus threshold. The data prediction module is used to construct a theoretical motion model, a measured motion model, and a measured variance of the focusing process parameters during the focusing process, and to predict the focusing process parameters at the next moment. The focusing process parameters include Z-axis position, objective lens moving speed, and defocusing amount. The theoretical motion model and the measured motion model are the relationships between the theoretical focusing process parameters and the measured focusing process parameters as they change over time, respectively. The drive focus analysis module is used to analyze the deviation between the corresponding focusing process parameters in the theoretical motion model and the measured motion model at the same moment, and to determine whether the deviation of at least one focusing process parameter is greater than the set deviation threshold. If it exists, the theoretical motion model is used to predict the focusing process parameters at the next moment. The theoretical motion model at the next moment is dynamically adjusted by combining the measured variance and the measured focusing process parameters at the next moment to eliminate the difference between the predicted value and the measured value.
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 method as described in any one of claims 1-8.
Citation Information
Patent Citations
Apparatus and methods for determining the three-dimensional shape of an object using active illumination and relative blurring in two images due to defocus
CA2196563A1
System and method for dynamically adjusting maximum setting magnification of optical lens and non-transitory computer readable medium
US20220283401A1