Focusing method and system, electronic equipment and storage medium

By pre-calibrating the coding relationship of the imaging objective and calculating the defocus amount in the spectral confocal coaxial autofocus device, the focus adjustment is performed by moving the imaging objective alone, which solves the problem of low detection efficiency and realizes a more efficient autofocus process.

CN121784948APending Publication Date: 2026-04-03HEFEI I TEK OPTOELECTRONICS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-01-27
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

Existing internal coaxial autofocus devices based on spectral confocal autofocus suffer from low detection efficiency during autofocus due to the complex structure of the measurement optical path.

Method used

By pre-calibrating the coding relationship of the imaging objective at different heights and calculating the moving distance of the imaging objective based on the defocusing amount during autofocusing, the focus can be adjusted by moving the imaging objective alone, thereby improving detection efficiency.

Benefits of technology

It effectively improves the movement rate of the objective lens focus and enhances the detection efficiency of the spectral confocal coaxial autofocus device.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121784948A_ABST
    Figure CN121784948A_ABST
Patent Text Reader

Abstract

The invention discloses a focusing method and system, electronic equipment and a storage medium, and relates to the field of automatic focusing. The method is applied to an inner coaxial automatic focusing device based on spectral confocal, and comprises the following steps: acquiring a peak wavelength, and determining a corresponding coding relationship based on a first step length amount of an imaging objective lens moving from an initial height to a current height; according to the coding relation, the distance between the peak wavelength and the objective lens focus position corresponding to the target wavelength is calculated to serve as the defocusing amount; calculating a second step length amount corresponding to the defocusing amount; and the height of the imaging objective lens is adjusted according to the second step length amount, and the second step length amount and the first step length amount are added to serve as the first step length amount of the next adjustment process. Based on the above processing, the defocusing amount can be accurately calculated by pre-calibrating the coding relationship under different first step length amounts and updating the first step length amounts, the normal operation of the automatic focusing process is ensured, and the movement rate of the focus of the objective lens is improved by independently moving the objective lens.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of autofocus, and particularly relates to a focusing method, system, electronic device and storage medium. Background Technology

[0002] To improve the detection accuracy and applicability of autofocus devices, existing technology provides an internal coaxial autofocus device based on spectral confocal focusing, such as... Figure 1 As shown, the measurement module in this device uses light of different wavelengths focused at different distances, and calculates the defocus amount by collecting the wavelength information of the reflected light. However, during the autofocus process, this type of device often requires adjusting the focal plane of the ranging light by moving the entire measurement optical path.

[0003] Because the optical path structure in the measurement optical path is relatively complex and the overall movement speed is slow, it affects the working efficiency of the autofocus system.

[0004] Therefore, a focusing solution is urgently needed to improve the detection efficiency of this autofocus device. Summary of the Invention

[0005] This application proposes a focusing method, system, electronic device, and storage medium for improving the detection efficiency of an internal coaxial autofocus device based on spectral confocal focusing.

[0006] To achieve the above objectives, this application proposes the following technical solutions: In a first aspect of this application, a focusing method is provided for use in an internal coaxial autofocus device based on spectral confocal focusing, the method comprising: The peak wavelength in the spectrometer is obtained, and the corresponding coding relationship is determined based on the first step length of the imaging objective moving from the initial height to the current height; wherein, the coding relationship represents the correspondence between the wavelength and the focal position, and the coding relationship corresponds one-to-one with the value of the first step length, which is obtained after pre-calibration; Based on the encoding relationship, the distance between the peak wavelength and the focal position corresponding to the target wavelength is calculated as the defocusing amount; wherein, in the coaxial optical path of the autofocus device, the target wavelength light is parallel to the imaging light; Calculate the second step length corresponding to the defocus amount; Adjust the height of the imaging objective lens according to the second step length, and add the second step length to the first step length as the first step length in the next imaging objective lens adjustment process.

[0007] Optionally, the calibration process for the correspondence between the encoding relationship and the first step length includes: Adjust the focal point of the imaging objective lens to match the height of the first detection position on the surface of the object being measured, take the current height of the imaging objective lens as the initial height, and record the coding relationship at the initial height; The height of the imaging objective is adjusted according to the preset step size, and the coding relationship under each step size is recorded and stored. The step size represents the number of steps the objective moves, and is divided into positive and negative signs according to the direction of movement along the Z-axis.

[0008] Optionally, the movement distance of a single step does not exceed the depth of field range of the imaging objective.

[0009] Optionally, the movement distance of a single step is the depth of field range of the imaging objective.

[0010] Optionally, the greater the maximum height difference on the surface of the object being measured, the greater the distance traveled per step.

[0011] Optionally, calculating the second step length corresponding to the defocus amount includes: Calculate the ratio of the defocus amount to the length of a single step; The ratio is rounded to obtain the second step size; the rounding method includes rounding up or rounding down.

[0012] In a second aspect of this application, a focusing system is provided, comprising: The imaging module is used to acquire images of the surface of the object being measured. The measurement module detects the defocusing amount between the objective lens focal point and the surface of the object being measured based on the principle of spectral confocality; wherein, the imaging module and the measurement module share an imaging objective lens and have a coaxial optical path; The adjustment module, connected to the imaging objective, is used to adjust the height of the microscope objective. The processor, connected to the imaging module, the measurement module, and the adjustment module, is used to execute the focusing method described in any one of the first aspects.

[0013] Optionally, the imaging module includes an image sensor, an eyepiece, a filter, and an imaging objective; wherein, the reflected light from the surface of the object being measured passes sequentially through the imaging objective, the filter, and the eyepiece along the imaging optical path and is then focused onto the image sensor; The measurement module contains a polychromatic light source, a dispersive lens group, a collimating lens group, a first beam splitter, and a microscope objective, arranged sequentially along the measurement optical path. The first beam splitter is located in the imaging optical path, and the optical path from the first beam splitter to the surface of the object being measured is a coaxial optical path between the imaging optical path and the measurement optical path.

[0014] In a third aspect of this application, an electronic device is provided, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus. Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the focusing method described in any of the first aspects.

[0015] In a fourth aspect of this application, a computer-readable storage medium is provided, wherein a computer program is stored therein, and when executed by a processor, the computer program implements the focusing method described in any of the first aspects.

[0016] The beneficial effects of this application are as follows: This application provides a focusing method applied to an internal coaxial autofocus device based on spectral confocal focusing. The method includes: acquiring the peak wavelength in a spectrometer and determining a corresponding coding relationship based on a first step length of the imaging objective moving from an initial height to a current height; wherein the coding relationship represents the correspondence between the peak wavelength in the spectrometer and the focal position of the objective, and the coding relationship corresponds one-to-one with the value of the first step length, obtained after pre-calibration; calculating the distance between the peak wavelength and the focal position of the objective corresponding to the target wavelength according to the coding relationship, as a defocus amount; wherein, in the coaxial optical path of the autofocus device, the target wavelength light is parallel to the imaging light; calculating a second step length corresponding to the defocus amount; adjusting the height of the imaging objective according to the second step length, and adding the second step length to the first step length as the first step length in the next imaging objective adjustment process.

[0017] Based on the above processing, this application pre-calibrates the encoding relationship of the imaging objective at different first-step lengths compared to the initial height. During autofocus, the first-step length is updated based on the defocus amount and the second-step length used to calculate the movement distance of the imaging objective. This ensures that after the imaging objective height changes, the encoding relationship of the imaging objective at the current height can be determined based on the first-step length, thereby accurately calculating the defocus amount and enabling the normal operation of the autofocus process. Furthermore, the focusing scheme provided in this application achieves the adjustment of the objective lens focus by moving the imaging objective lens individually. Compared to the focusing method in the prior art that involves moving the entire measurement optical path, this effectively improves the movement rate of the objective lens focus and enhances the detection efficiency of the internal coaxial autofocus device based on spectral confocal focusing. Attached Figure Description

[0018] 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: Figure 1 This is a structural diagram of an internal coaxial autofocus device based on spectral confocal focusing provided in the prior art; Figure 2This is a flowchart of a focusing method provided in this application; Figure 3 This is a flowchart illustrating the labeling of an encoding relationship provided in this application; Figure 4 This is a structural diagram of an electronic device provided in this application. Detailed Implementation

[0019] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are some embodiments of this application, but not all embodiments.

[0020] To improve the detection accuracy and applicability of autofocus devices, existing technology provides an internal coaxial autofocus device based on spectral confocality, which measures the defocus amount through the principle of spectral confocality. For example... Figure 1 As shown, the coaxial autofocus device includes a measurement module and an imaging module. The measurement module includes a point light source (or polychromatic light source), a second beam splitter, a dispersive lens group, a collimating lens group, a first beam splitter, and a microscope objective (i.e., the imaging objective of this application) arranged sequentially along the measurement optical path.

[0021] Specifically, the dispersive lens group is used to split the ranging light beam; the collimating lens group is used to make the light of the target wavelength parallel and collimated, and can be a negative lens group; the imaging objective lens is used to focus light of different wavelengths at different positions on the optical axis, and to make the focal plane of the light of the target wavelength coincide with the focal plane of the imaging light incident on the eyepiece, and to collect the ranging light and imaging light reflected from the surface under test; the first beam splitter is used to realize the coaxial coupling of the optical path of the ranging light and the optical path of the imaging light; the measurement module also includes a spectrometer set between the point light source and the dispersive lens group, used to collect the spectral information of the ranging light focused on the surface of the object under test.

[0022] The imaging module includes an image sensor, an eyepiece, a first beam splitter, and a microscope objective along the imaging optical path. The image sensor acquires an image of the surface of the object under test; the eyepiece couples the imaging light into the image sensor. Furthermore, a filter can be placed between the eyepiece and the first beam splitter to filter the imaging light reflected from the surface of the object under test. Note that the optical path between the first beam splitter and the surface of the object under test is a coaxial optical path between the imaging module and the measurement module.

[0023] For example Figure 1The coaxial autofocus device shown in the prior art requires the entire measurement optical path to be moved during focusing to ensure that the relationship between the peak wavelength in the spectrometer and the spatial position of the surface under test along the Z-axis remains unchanged. Here, the surface under test represents the horizontal plane where the objective lens focal point is located, and the spatial position of the surface under test is the focal point position of the objective lens. Due to the relatively complex structure of the measurement optical path, its overall movement speed is slow, reducing the detection efficiency of the coaxial autofocus device.

[0024] In response, this application provides a focusing method applicable to the aforementioned coaxial autofocus device, such as... Figure 2 As shown, the focusing method includes the following steps: S1. Obtain the peak wavelength in the spectrometer, and determine the corresponding encoding relationship based on the first step length of the imaging objective lens moving from the initial height to the current height. The encoding relationship represents the correspondence between the peak wavelength in the spectrometer and the focal position of the objective lens, and the encoding relationship corresponds one-to-one with the value of the first step length, obtained after pre-calibration.

[0025] S2. Based on the coding relationship, calculate the distance between the peak wavelength and the objective lens focal point corresponding to the target wavelength, as the defocusing amount. In the coaxial optical path of the autofocus device, the target wavelength light is parallel to the imaging light.

[0026] S3. Calculate the second step length corresponding to the defocus amount.

[0027] S4. Adjust the height of the imaging objective lens according to the second step length, and add the second step length to the first step length as the first step length in the next imaging objective lens adjustment process.

[0028] Based on the above processing, this application pre-calibrates the encoding relationship of the imaging objective at different first-step lengths compared to the initial height. During autofocus, the first-step length is updated based on the defocus amount and the second-step length used to calculate the movement distance of the imaging objective. This ensures that after the imaging objective height changes, the encoding relationship of the imaging objective at the current height can be determined based on the first-step length, thereby accurately calculating the defocus amount and enabling the normal operation of the autofocus process. Furthermore, the focusing scheme provided in this application achieves the adjustment of the objective lens focus by moving the imaging objective lens individually. Compared to the focusing method in the prior art that involves moving the entire measurement optical path, this effectively improves the movement rate of the objective lens focus and enhances the detection efficiency of the internal coaxial autofocus device based on spectral confocal focusing.

[0029] A spectrometer is one of the most commonly used spectral detection devices in spectral confocal measurement technology. It is an optical device that uses the lateral chromatic aberration of an optical system to measure spectral composition. In the aforementioned internal coaxial autofocus device, the polychromatic light incident on the objective lens is dispersed sequentially along the optical axis according to its wavelength and converges at different positions on the optical axis, forming a set of continuously distributed focal points of different wavelengths. The position of the focal point uniquely corresponds to the wavelength of the light wave, forming a definite coding relationship.

[0030] When polychromatic light emitted from a point source passes through the objective lens, only one wavelength is precisely focused onto the surface of the sample, serving as the peak wavelength. Other wavelengths are defocused, projecting a diffused spot onto the surface. The light reflected from the sample surface re-enters the imaging path and is reflected by the second beam splitter to the conjugate aperture. Since most wavelengths are defocused on the sample surface, only a portion of the reflected light reaches the conjugate aperture, and even then, remains defocused. The vast majority of the remaining light energy is blocked by the aperture, resulting in very little light energy being detected by the spectrometer. Only the light focused on the sample surface is reflected almost entirely along the original measurement path, converging again at the aperture, and can be captured by the spectrometer with near-lossless passage. Thus, the spectrometer can detect a sharp, single-peak signal. The wavelength of the light focused on the sample surface can be determined from the peak wavelength, meaning the wavelength uniquely corresponds to its focal position on the optical axis.

[0031] In this application, the correspondence between wavelength and focal position is used as a coding relationship. It can be understood that the focal position formed by the peak wavelength light in the spectrometer falls on the surface of the object being measured within the current detection range.

[0032] Regarding step S1, the first step length represents the step size required to move the imaging objective from the initial height to the current height based on a preset step size. The initial height represents the height of the imaging objective along the Z-axis when the focus of the imaging objective is aligned with the height of the first detection position on the surface of the object being measured. Alternatively, it can be understood as the height at which the imaging objective completes focusing with the first detection position on the surface of the object during the initial operation of the autofocus device. The first detection position represents the first point on the surface of the object being measured, typically an edge point of the object.

[0033] In the focusing scheme provided in this application, the step size is determined by the direction of movement of the imaging objective along the Z-axis, and its absolute value represents the total step size during the movement. Specifically, the first step size represents the step size when the imaging objective moves from the initial height to the current position; the second step size represents the step size required for the imaging objective to move to the defocus position.

[0034] For example, during the initial focusing process, when the imaging objective moves down two steps along the Z-axis relative to its initial height based on the defocus amount, both the first and second step values ​​are -2. Subsequently, in the next focusing process, the imaging objective needs to move up three steps along the Z-axis based on the defocus amount. After the imaging objective is focused, the value of the first step value is +1, and the value of the second step value is +3. It can be understood that in each focusing process of the imaging objective, the first step value is the sum of all previous second step values.

[0035] In addition, the defocusing amount retains its positive or negative sign to indicate the direction of objective lens movement along the Z-axis (i.e., the vertical direction), consistent with the step size.

[0036] In some embodiments, the process of determining the correspondence between the encoding relationship and the first step length includes the following steps: Step 1: Adjust the focal point of the imaging objective lens to match the height of the first detection position on the surface of the object being measured. Use the current height of the imaging objective lens as the initial height and record the coding relationship at the initial height.

[0037] In this method, with the imaging objective lens remaining at a constant height, the corresponding wavelength can be recorded by moving the calibration object, thus obtaining the encoding relationship. Specifically, for example... Figure 3 As shown, the recording process of encoding relationships can include the following: Step a: Keeping the height of the imaging objective lens constant, a displacement stage is set parallel to the imaging objective lens below it, and an optical flat is set on the surface of the displacement stage. The displacement stage moves along the Z-axis.

[0038] Step b: The displacement stage moves gradually within the dispersion range of the polychromatic light at a fixed distance, records the complete spectral signal returned from the spectrometer at different distances, and calculates the peak wavelength at that step position according to the peak finding algorithm.

[0039] Step c: Collect all data points (h, λ) at different distances, and perform curve fitting on all data points to obtain a polynomial formula f(h, λ), which serves as the spectral relationship. Here, h represents the distance between the optical flat and the imaging objective lens surface, i.e., the focal point; λ represents the peak wavelength at the current distance.

[0040] Step 2: Adjust the height of the imaging objective lens according to the preset step size, and record and store the encoding relationship for each step size. The step size represents the number of steps the imaging objective lens moves, and is positive or negative depending on the direction of movement along the Z-axis.

[0041] For step two, adjust the height of the imaging objective lens according to the preset step size, changing the step size step by step, and record the encoding relationship at each step size position. For example, within the step size range of -20 to +20, record and store the encoding relationship at each step size.

[0042] In the focusing scheme provided in this application, the range of step size during calibration is not less than the maximum height difference between the surfaces of the object being measured. When the step size of the moving imaging objective lens is larger, the range of step size during calibration is smaller, and the total amount of encoded relationships that need to be stored is smaller. Therefore, in order to reduce the storage space of the encoded relationships, the larger the maximum height difference between the surfaces of the object being measured, the larger the movement distance of a single step.

[0043] Meanwhile, to ensure that the surface of the object being measured remains within the depth of field of the imaging objective (i.e., focusing) after the imaging objective moves in steps at different defocusing amounts, this application limits the movement distance of a single step to no more than the depth of field of the imaging objective. Preferably, to minimize the number of required buffer coding relationships, the movement distance of a single step can be set to the depth of field of the imaging objective. In practice, the movement distance of a single step can also be one-half or one-third of the depth of field.

[0044] For example, when inspecting a wafer using an autofocus device, the maximum height difference on the wafer surface is 100µm, and the depth of field range of the imaging objective is 4µm. When applying the focusing scheme provided in this application, the movement distance of a single step can be set to 4µm or 2µm. If the step size is 2µm, this application needs to pre-calibrate the coding relationships at 50 step sizes. To avoid the initial height being the highest or lowest point of the surface being measured, based on the initial height, 100 coding relationships can be pre-calibrated within a step size range of -50 to +50.

[0045] The encoding relationships for different movement amounts are pre-stored in the processor. During the focusing process, the corresponding encoding relationship is obtained from the processor's storage space based on the first step length.

[0046] In some embodiments, the target wavelength light is collimated and parallel to the imaging light in the coaxial optical path portion. Here, the coaxial optical path refers to the coaxial portion between the measurement optical path and the imaging optical path, such as... Figure 1 As shown, this coaxial optical path represents the optical path between the first beam splitter and the surface of the object under test. Since the target wavelength is collimated and parallel to the imaging ray, the focal position corresponding to the target wavelength is the position of the objective lens focal point in the imaging optical path.

[0047] In step S2, the peak wavelength λ1 and the target wavelength λ0 are substituted into the encoding relationship to obtain the corresponding focal positions h1 and h0. Then, the difference between h1 and h0 is calculated as the defocus amount.

[0048] In some embodiments, step S3 includes the following: S301. Calculate the ratio between the defocus amount and the length of a single step.

[0049] S302. Round the comparison value to obtain the second step length. The rounding method can be either rounding up or rounding down.

[0050] For step S4, after obtaining the second step length corresponding to the focus amount, the height of the imaging objective lens is adjusted along the Z-axis according to the second step length.

[0051] Simultaneously, the second step length is added to the first step length obtained in step S1, and the sum is used as the first step length in the next focusing process. It can be understood that when the autofocus device initially operates, since the imaging objective lens is focused on the first detection position, the first step length is 0. The defocus amount is calculated based on the coding relationship corresponding to the first step length being 0, resulting in the second step length. Then, the height of the imaging objective lens is adjusted according to the second step length, and this second step length is used as the first step length in the next focusing process. In subsequent focusing processes, the first step length in step S1 is obtained by accumulating all the second step lengths from previous focusing processes.

[0052] In some embodiments, this application also provides a focusing system, including: The imaging module is used to acquire images of the surface of the object being measured. The measurement module detects the defocusing amount between the objective lens focal point and the surface of the object being measured based on the principle of spectral confocality; wherein, the imaging module and the measurement module share an imaging objective lens and have a coaxial optical path; The adjustment module, connected to the imaging objective, is used to adjust the height of the microscope objective. The processor, connected to the imaging module, measurement module, and adjustment module, is used to execute the aforementioned focusing method.

[0053] In some embodiments, the imaging module includes an image sensor, an eyepiece, a filter, and an imaging objective; wherein the reflected light from the surface of the object being measured passes sequentially through the imaging objective, the filter, and the eyepiece along the imaging optical path and is then focused onto the image sensor.

[0054] The measurement module contains a polychromatic light source, a dispersive lens group, a collimating lens group, a first beam splitter, and a microscope objective, arranged sequentially along the measurement optical path. The first beam splitter is located in the imaging optical path, and the optical path from the first beam splitter to the surface of the object being measured is a coaxial optical path between the imaging optical path and the measurement optical path.

[0055] This application also provides an electronic device, such as... Figure 4As shown, it includes a processor 401, a communication interface 402, a memory 403, and a communication bus 404, wherein the processor 401, the communication interface 402, and the memory 403 communicate with each other through the communication bus 404. Memory 403 is used to store computer programs; The processor 401, when executing the program stored in the memory 403, implements any of the above-mentioned focusing methods.

[0056] The communication bus mentioned in the above electronic devices can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not indicate that there is only one bus or one type of bus.

[0057] The communication interface is used for communication between the aforementioned electronic devices and other devices.

[0058] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.

[0059] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0060] 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 focusing method steps described above.

[0061] In another embodiment provided in this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to perform any of the focusing method steps in the above embodiments.

[0062] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A focusing method, characterized in that, The method, applied to an internal coaxial autofocus device based on spectral confocal focusing, includes: The peak wavelength in the spectrometer is obtained, and the corresponding coding relationship is determined based on the first step length of the imaging objective moving from the initial height to the current height; wherein, the coding relationship represents the correspondence between the wavelength and the focal position, and the coding relationship corresponds one-to-one with the value of the first step length, which is obtained after pre-calibration; Based on the encoding relationship, the distance between the peak wavelength and the focal position corresponding to the target wavelength is calculated as the defocusing amount; wherein, in the coaxial optical path of the autofocus device, the target wavelength light is parallel to the imaging light; Calculate the second step length corresponding to the defocusing amount; Adjust the height of the imaging objective lens according to the second step length, and add the second step length to the first step length as the first step length in the next imaging objective lens adjustment process.

2. The focusing method according to claim 1, characterized in that, The process of determining the correspondence between the encoding relationship and the first step length quantity includes: Adjust the focal point of the imaging objective lens to match the height of the first detection position on the surface of the object being measured, take the current height of the imaging objective lens as the initial height, and record the coding relationship at the initial height; The height of the imaging objective is adjusted according to the preset step size, and the coding relationship under each step size is recorded and stored. The step size represents the number of steps the objective moves, and is divided into positive and negative signs according to the direction of movement along the Z-axis.

3. The focusing method according to claim 1, characterized in that, The movement distance of a single step does not exceed the depth of field range of the imaging objective.

4. The focusing method according to claim 3, characterized in that, The distance moved by a single step is the depth of field range of the imaging objective.

5. The focusing method according to claim 3, characterized in that, The greater the maximum height difference on the surface of the object being measured, the greater the distance traveled in a single step.

6. The focusing method according to claim 1, characterized in that, The calculation of the second step length corresponding to the defocus amount includes: Calculate the ratio of the defocus amount to the length of a single step; The ratio is rounded to obtain the second step size; the rounding method includes rounding up or rounding down.

7. A focusing system, characterized in that, include: The imaging module is used to acquire images of the surface of the object being measured. The measurement module detects the defocusing amount between the objective lens focal point and the surface of the object being measured based on the principle of spectral confocality; wherein, the imaging module and the measurement module share an imaging objective lens and have a coaxial optical path; The adjustment module, connected to the imaging objective, is used to adjust the height of the microscope objective. A processor, connected to an imaging module, a measurement module, and an adjustment module, is used to execute the focusing method according to any one of claims 1-6.

8. The focusing system according to claim 7, characterized in that, The imaging module includes an image sensor, an eyepiece, a filter, and an imaging objective; wherein, the reflected light from the surface of the object being measured passes sequentially through the imaging objective, the filter, and the eyepiece along the imaging optical path and is then focused onto the image sensor; The measurement module contains a polychromatic light source, a dispersive lens group, a collimating lens group, a first beam splitter, and a microscope objective, arranged sequentially along the measurement optical path. The first beam splitter is located in the imaging optical path, and the optical path from the first beam splitter to the surface of the object being measured is a coaxial optical path between the imaging optical path and the measurement optical path.

9. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the focusing method according to any one of claims 1-6.

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 focusing method according to any one of claims 1-6.