Automatic focusing method and device and storage medium
By dynamically adjusting the range of motion of the objective lens according to the clarity changes of the target group image during the autofocus process, the problem of high memory and processor requirements and low focus efficiency in the prior art is solved, and a more efficient autofocus process is achieved.
Patent Information
- Application Number
- CN202411884535.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-18
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2044-12-18
AI Technical Summary
After setting the range of motion of the objective lens, the existing automatic focus method requires image acquisition step by step, resulting in high memory and processor requirements, prone to lag problems, and low focus efficiency.
By moving in a straight line and a step distance in a preset first motion range, the second motion range of the objective lens is determined according to the change in the sharpness of the newly acquired target group images, and the image is continued to be collected within the second motion range until the focus position is determined.
The number of images collected and analyzed during the focus search process is reduced, the memory and processor requirements are reduced, the focus search time is shortened, and the focus search efficiency is improved.
Smart Images

Figure CN119767139A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image acquisition, and in particular to an automatic focusing method, device and storage medium. Background Art
[0002] With the rapid development of optical technology, it is applied to more and more fields. In optical technology, the autofocus of the objective lens has always been one of the focuses of people's attention. The current autofocus method needs to control the objective lens to capture images step by step within the set range of motion after setting the range of motion of the objective lens. This method has high requirements for memory and processor, is prone to jamming problems, and the focus search process of the objective lens takes a long time and has low focus search efficiency. Summary of the invention
[0003] The present invention is proposed in view of the above problems. The present invention provides an automatic focusing method, device, and storage medium. This solution collects and analyzes a small number of images during the focus search process of the objective lens, has low requirements for memory and processor, and takes a short time to search for focus, with high efficiency.
[0004] According to one aspect of the present invention, an automatic focusing method is provided. The method includes: controlling an objective lens to move in a straight line within a preset first motion range, and during the motion process, performing image acquisition on a target object at intervals of a first step to obtain a target group image; determining a second motion range of the objective lens according to a change in the clarity of the target group image that has been acquired the latest, wherein the first position of the objective lens corresponding to the highest clarity of the image in the target group image is within the second motion range, the second motion range is within the first motion range, and the motion distance corresponding to the second motion range is less than the motion distance corresponding to the first motion range; controlling the objective lens to move in a straight line within the second motion range, and during the motion process, performing image acquisition on the target object at intervals of a second step corresponding to the second motion range to obtain a new target group image, and when the second step is greater than the target step, using the second motion range as the new first motion range, returning to the step of determining the second motion range of the objective lens according to the change in the clarity of the target group image that has been acquired the latest, and when the second step is equal to the target step, determining the focus position of the objective lens for the target object according to the change in the clarity of the target group image that has been acquired the latest, wherein the focus position is the second position of the objective lens corresponding to the highest clarity of the image in the target group image that has been acquired the latest.
[0005] Optionally, the second step length is obtained by: obtaining the second step length input by the user; or, determining the second step length based on the focus speed and the focus time, wherein one or both of the focus speed and the focus time are input by the user, and when the user inputs one of the focus speed and the focus time, the other is a preset value.
[0006] Optionally, each second step distance is smaller than the first step distance; the second step distance corresponding to the second motion range determined each time is smaller than the second step distance corresponding to the second motion range determined last time.
[0007] Optionally, according to the change in clarity of the target group image most recently acquired, the second movement range of the objective lens is determined, including: determining the first position according to the change in clarity of the target group image most recently acquired; determining the third position and the fourth position of the objective lens according to the first position, wherein the third position and the fourth position are respectively located on both sides of the first position, and the images acquired at the third position, the first position and the fourth position are respectively acquired images continuously; and determining the third position and the fourth position as boundaries of the second movement range to determine the second movement range.
[0008] Optionally, determining the second motion range of the objective lens according to a change in clarity of the most recently acquired target group image includes: determining the similarity between each image in the target group image and a reference image, wherein the reference image is an image acquired by the objective lens when the objective lens is located at a focusing position for a reference object, and the reference object and the target object are objects of the same type; determining the second motion range according to a change in the similarity between each image in the target group image and the reference image; wherein the change in clarity is represented by a change in similarity.
[0009] Optionally, before controlling the objective lens to move in a straight line within a preset first motion range, the method further includes: determining a first step distance in response to an input operation of a user.
[0010] Optionally, controlling the objective lens to move in a straight line within a preset first motion range includes: controlling the objective lens to move from a starting position to an end position, wherein the starting position and the end position are respectively located on both sides of a coarse focusing position, the coarse focusing position is a focusing position of the objective lens for a reference object, wherein the reference object and the target object are objects of the same type, and the focusing position for the reference object is a second position of the objective lens corresponding to a time when the clarity of an image captured for the reference object is the highest.
[0011] According to another aspect of the present invention, an autofocus device is also provided, comprising: a first control module, used to control the objective lens to move in a straight line within a preset first motion range, and during the motion process, image acquisition is performed on the target object at intervals of a first step distance to obtain a target group image; a determination module, used to determine a second motion range of the objective lens according to a change in the clarity of the target group image acquired most recently, wherein the first position of the objective lens corresponding to the highest image clarity in the target group image is within the second motion range, the second motion range is within the first motion range, and the motion distance corresponding to the second motion range is less than the motion distance corresponding to the first motion range; a second control module, used to control The objective lens is made to move in a straight line within a second motion range. During the motion, images of the target object are captured at intervals of a second step distance corresponding to the second motion range to obtain a new target group image. When the second step distance is greater than the target step distance, the second motion range is used as the new first motion range, and the step of determining the second motion range of the objective lens according to the change in clarity of the target group image captured most recently is returned to be executed. When the second step distance is equal to the target step distance, the focus position of the objective lens with respect to the target object is determined according to the change in clarity of the target group image captured most recently, wherein the focus position is the second position of the objective lens corresponding to the time when the clarity of the image in the target group image captured most recently is the highest.
[0012] According to yet another aspect of the present invention, a storage medium is provided, on which program instructions are stored, and the program instructions are used to execute the above-mentioned automatic focusing method when running.
[0013] The above technical solution determines the second movement range of the objective lens by the clarity change of the target group image collected within the first movement range, and determines the focus position of the objective lens with respect to the target object according to the clarity change of the target group image collected within the second movement range which is smaller than the first movement range. This method can perform multiple focus searches and reduce the movement range of the focus position of the objective lens with respect to the target object after each focus search, without having to perform image capture step by step within the set movement range. Therefore, on the premise that the accuracy of the determined focus position meets the requirements, the number of images captured and analyzed for clarity during the entire focusing process can be reduced, the requirements for memory and processor are low, the problem of jamming is not likely to occur, and the focus search time of the objective lens is short and the focus search efficiency is high.
[0014] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The above and other purposes, features and advantages of the present invention will become more apparent by describing the embodiments of the present invention in more detail in conjunction with the accompanying drawings. The accompanying drawings are used to provide a further understanding of the embodiments of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings, the same reference numerals generally represent the same components or steps.
[0016] Figure 1 A schematic diagram showing the position of an objective lens in a focus-finding process in a related art according to an embodiment of the present invention is shown;
[0017] Figure 2 A schematic flow chart of an automatic focusing method according to an embodiment of the present invention is shown;
[0018] Figure 3 A schematic diagram showing the position of an objective lens when capturing images within a first motion range according to an embodiment of the present invention is shown;
[0019] Figure 4 A schematic block diagram of an automatic focusing device according to an embodiment of the present invention is shown;
[0020] Figure 5 A schematic block diagram of an electronic device according to an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0021] In order to make the purpose, technical scheme and advantages of the present invention more obvious, the exemplary embodiments according to the present invention will be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments of the present invention, and it should be understood that the present invention is not limited to the exemplary embodiments described herein. Based on the embodiments of the present invention described in the present invention, all other embodiments obtained by those skilled in the art without creative work should fall within the protection scope of the present invention.
[0022] See also Figure 1 As shown in FIG. 1 , it is a schematic diagram of the position of the objective lens during the focusing process in the related art. Figure 1 In the example shown, the motion range set for the objective lens is from the acquisition start point to the acquisition end point, and the step distance is Figure 1It is shown as the distance between any two adjacent vertical arrows of the three vertical arrows located at one end of the acquisition starting point, or the distance between any two adjacent vertical arrows of the three vertical arrows located at one end of the acquisition end point. The distance from the acquisition starting point to the acquisition end point is the movement distance of the objective lens during the focus search process. The autofocus system may include an image acquisition device and a drive device, and the image acquisition device may include an objective lens. The drive device may control the objective lens to move from the acquisition starting point to the acquisition end point. During the movement of the objective lens, the image acquisition device may collect N images of the target object through the objective lens according to the step size, then N=1+(Z2-Z1) / s, where Z2 represents the measurement value of the grating ruler when the objective lens is located at the acquisition end point, Z1 represents the measurement value of the grating ruler when the objective lens is located at the acquisition starting point, and s represents the step size. Taking Z2=200μm, Z1=100μm, s=0.5μm as an example, then N=1+(200μm-100μm) / 0.5μm=201. The different images captured by the image capture device have a corresponding relationship with the position of the objective lens. If the objective lens is closer to its focus position for the target object, the captured image will be clearer. When the objective lens is at its focus position for the target object, the captured image is the clearest.
[0023] As described above, this method requires controlling the objective lens to perform image acquisition step by step within a set range of motion. The requirements for memory and processor are high, and the objective lens focus search process takes a long time. In order to at least partially solve the above technical problems, an embodiment of the present invention provides an automatic focusing method, device, and storage medium. This solution collects and analyzes a small number of images during the focus search process of the objective lens, has low requirements for memory and processor, and takes a short time to focus, and is highly efficient.
[0024] See also Figure 2 As shown, it is a schematic flow chart of an auto-focus method according to an embodiment of the present invention. According to one aspect of the present invention, an auto-focus method is provided, and the method includes: step S210, step S220 and step S230.
[0025] In step S210, the objective lens is controlled to move in a straight line within a preset first movement range. During the movement, images of the target object are captured at intervals of the first step to obtain a target group image.
[0026] Exemplarily, the target object may be any object on which the objective lens focuses, such as a wafer, a chip, etc. In some embodiments, the preset first motion range may be preset by the user at the starting position and the end position of the objective lens. In other embodiments, the first motion range may be determined based on the position of the objective lens when acquiring the reference image, for example, the starting position and the end position of the first motion range may be located on both sides of the coarse focus position corresponding to the reference image. The distance between the starting position and the end position and the coarse focus position may be set as required, for example, a preset default distance. The reference image may be an image acquired when the reference object is pre-placed at the focus position of the objective lens, and the reference object may be any one of a plurality of target objects of the same type, or an object of the same type as the target object other than the target object. Specifically, when acquiring an image for the reference object, the reference object may be placed in the image acquisition range of the image acquisition device along the optical axis direction of the objective lens, and the distance between the objective lens and the reference object may be adjusted. During the adjustment process, the image acquisition device may acquire an image for the reference object, and use the image with the highest definition as the reference image, then the position of the objective lens when acquiring the reference image may be used as the coarse focus position of the objective lens. In other words, the coarse focus position of the objective lens is the position where the image collected for the reference object is the clearest when it is located at this position. The clarity of the image collected for the reference object can be determined by the user, or the clarity of each image can be evaluated by a clarity evaluation method. The clarity evaluation method can be, for example, the variance of the Laplace operator of the image, or the sum of the squares of the gradient amplitude of the image calculated based on the Sobel operator. It can be understood that the reason why the position of the objective lens when collecting the reference image is the coarse focus position is that the surface flatness of different target objects is different, and the flatness of the platform for placing the target object is not absolutely horizontal, so the position of the objective lens when collecting the reference image is the coarse focus position. The focus position of the objective lens for the target object is near the coarse focus position, and the starting position and the end position of the movement of the objective lens can be determined according to the coarse focus position, so the first range of motion can be from the starting position to the end position. In other embodiments, the first range of motion can also be determined based on the theoretical focal length in the factory parameters of the objective lens. Specifically, taking the theoretical focal length of the objective lens as 200 μm as an example, the reference object is placed in the image acquisition range of the image acquisition device along the optical axis direction of the objective lens, and the distance between the objective lens and the reference object is adjusted until the distance between the objective lens and the reference object is equal to 200 μm, and then the objective lens is stopped from moving. At this time, the position of the objective lens can be used as the coarse focus position of the objective lens. In other words, the coarse focus position of the objective lens is the position where the distance from the reference object is equal to the theoretical focal length when it is located at this position. The starting position and the end position of the movement of the objective lens can be determined according to the coarse focus position, and the first movement range can be from the starting position to the end position.
[0027] Exemplarily, the autofocus system may include a driving device and a grating ruler. The grating ruler may determine the real-time position information of the objective lens during the process of the driving device driving the objective lens to move. The position information may be obtained by reading the corresponding value on the grating ruler. The grating ruler and the objective lens may be coaxially arranged on the driving shaft. At the same time, a reading head may be arranged on the grating ruler. The measurement value read from the reading head may represent the position information of the objective lens. The driving device may obtain the position information and drive the objective lens to move according to the position information. During the movement of the objective lens, the measurement value read on the reading head may change. The read measurement value may represent the current real-time position information of the objective lens. For the grating ruler, any high-precision grating ruler may be selected. For example, the precision of the grating ruler may be 0.1 μm. The step length of the objective lens may be equal to the precision of the grating ruler. The higher the precision of the grating ruler, the more precisely the objective lens may be controlled to move from the starting position to the end position. That is, during the entire movement process, the higher the precision of the grating ruler, the smaller the step length of the objective lens, and the more images collected. Exemplarily, the step of controlling the objective lens to move in a straight line within a preset first range of motion may include: controlling the objective lens to move in a straight line from a starting position to an end position according to the measurement value of the grating ruler; wherein, during the movement, the grating ruler is used to determine the position of the objective lens when the image is collected. The objective lens can be driven to move by a motor, and the motor is driven or controlled to rotate by a driving device, and the driving device can control the motor to rotate according to the measurement value of the grating ruler. For example, according to the measurement value of the grating ruler, when the measurement value returned by the grating ruler to the driving device indicates that the current position of the objective lens is the starting position, the driving device drives the motor to start rotating, thereby controlling the objective lens to start moving, and when the measurement value returned by the grating ruler to the driving device indicates that the current position of the objective lens is the end position, the driving device stops driving the motor to rotate, thereby controlling the objective lens to stop moving. In addition, during the movement, the grating ruler is used to determine the position of the objective lens when the image is collected, so that according to the measurement value of the grating ruler, the image acquisition device can be controlled to capture the image of the target object at a specified position, thereby enabling the image acquisition device to capture the image of the target object at the first step interval to obtain the target group image. The target group image may include multiple images, and for any two continuously captured images, the distance between the positions of the objective lens when the two images are captured is the first step distance. The first step distance may be an integer multiple of the minimum step distance of the objective lens, and the first step distance is greater than the minimum step distance of the objective lens. For example, the first step distance may be 20 times the minimum step distance of the objective lens. Taking the minimum step distance of the objective lens as 0.5 μm as an example, the first step distance may be an integer multiple of 0.5 μm, for example, it may be 10 μm. The first step distance may be set according to actual needs. For example, when the minimum step distance of the objective lens is small, the first step distance may be larger. In some embodiments, the minimum step distance of the objective lens may be equal to the accuracy of the grating ruler.
[0028] In step S220, the second movement range of the objective lens is determined according to the change in clarity of the most recently acquired target group image, wherein the first position of the objective lens corresponding to the time when the clarity of the image in the target group image is the highest is within the second movement range, the second movement range is within the first movement range, and the movement distance corresponding to the second movement range is smaller than the movement distance corresponding to the first movement range.
[0029] Exemplarily, multiple images collected within the current motion range can be used as the latest collected target group images. Specifically, the current motion range can be a preset first motion range, or a second motion range determined each time. For each image in the target group images collected within the first motion range, the clarity of the image can be evaluated. Specifically, for each image of the target group images, the clarity of the image can be evaluated by a method of calculating the variance of the Laplace operator of the image, and the larger the variance, the clearer the image; or, the clarity of the image can be evaluated by a method based on the sum of squared gradient amplitudes of a Sobel operator, and the larger the sum of squared gradient amplitudes, the clearer the image; or, the similarity between the reference image and the image can be calculated, and the clarity of the image can be evaluated based on the similarity, and the larger the similarity, the clearer the image. Exemplarily, after obtaining the clarity of each image in the latest collected target group images, the second motion range of the objective lens can be determined according to the change in clarity of the target group images. It can be understood that during the movement of the objective lens within the first movement range, the distance between the objective lens and the focusing position may first decrease and then increase. Accordingly, the images of the target group image are arranged in order from near to far from the starting position, and the clarity change of the target group image may be that the clarity first increases and then decreases.
[0030] Exemplarily, according to the change of the definition of the target group image, the image with the highest definition can be obtained in the target group image, and the position of the objective lens when the image with the highest definition is collected is obtained, and the position can be recorded as the first position. A new starting position and a new end position can be obtained on both sides of the first position along the optical axis direction of the objective lens, and the distances between the new starting position and the new end position and the first position are respectively the first preset distances, wherein the first preset distance corresponding to the new starting position and the first preset distance corresponding to the new end position can be the same or different. The second motion range can be from the new starting position to the new end position. Specifically, the first preset distance corresponding to the starting position of the second motion range can be less than or equal to the distance between the starting position of the first motion range and the first position, and the first preset distance corresponding to the end position of the second motion range can be less than the distance between the end position of the first motion range and the first position; or, the first preset distance corresponding to the starting position of the second motion range can be less than the distance between the starting position of the first motion range and the first position, and the first preset distance corresponding to the end position of the second motion range can be less than or equal to the distance between the end position of the first motion range and the first position. It can be understood that the second movement range is within the first movement range, and the movement distance corresponding to the second movement range is smaller than the movement distance corresponding to the first movement range. More specifically, the movement distance corresponding to the first movement range is equal to the distance between the starting position and the end position corresponding to the first movement range, and the movement distance corresponding to the second movement range is equal to the distance between the starting position and the end position corresponding to the second movement range.
[0031] In step S230, the objective lens is controlled to move in a straight line within a second motion range. During the motion, images of the target object are captured at intervals of a second step size corresponding to the second motion range to obtain a new target group image. When the second step size is greater than the target step size, the second motion range is used as the new first motion range, and the process returns to the step of determining the second motion range of the objective lens according to the change in clarity of the target group image captured most recently. When the second step size is equal to the target step size, the focus position of the objective lens with respect to the target object is determined according to the change in clarity of the target group image captured most recently, wherein the focus position is the second position of the objective lens corresponding to the highest image clarity in the target group image captured most recently.
[0032] Exemplarily, after determining the second range of motion of the objective lens, the objective lens can be controlled to move in a straight line within the second range of motion. The process of controlling the objective lens to move in a straight line within the second range of motion can refer to the process of controlling the objective lens to move in a straight line within the preset first range of motion in the aforementioned embodiment, which will not be described in detail. During the motion process, the image acquisition device can perform image acquisition on the target object at intervals of the second step distance to obtain a new target group image. The second step distance can be less than or equal to the first step distance, and the second step distance can be an integer multiple of the minimum step distance of the objective lens. Specifically, the target step distance can be defined by the user based on actual focusing needs, which can be equal to the minimum step distance of the objective lens, or it can be equal to the minimum step distance of the objective lens of an integer multiple. For the second step distance corresponding to the second range of motion determined each time, the second step distance is greater than or equal to the target step distance. When the second step distance is equal to the target step distance, the image with the highest clarity can be obtained in the latest acquired target group image according to the change in clarity of the latest acquired target group image, and the position of the objective lens when acquiring the image with the highest clarity is obtained, which can be recorded as the second position, and the second position can be used as the focusing position of the objective lens for the target object. When the second step distance is greater than the target step distance, the current second range of motion can be used as a new first range of motion to return to the step of determining the second range of motion of the object lens according to the definition change of the target group image that has been newly acquired, until the second step distance corresponding to the determined second range of motion is equal to the target step distance. In other words, the above steps S220 and S230 can be performed once or multiple times, and each time after acquiring a new target group image according to the current second step distance, that is, the next time according to the target group image that has been newly acquired, a new second range of motion is determined and the object lens is controlled to move within the new second range of motion. After any execution of the above steps S220 and S230, if it is found that the current second step distance is equal to the target step distance, the execution of steps S220 and S230 next time will no longer be started. That is, the repeated execution of steps S220 and S230 can stop when the current second step distance is equal to the target step distance. After executing steps S220 and S230 for the last time, the image with the highest clarity can be obtained from the latest acquired target group images based on the change in clarity of the latest acquired target group images, and the position of the objective lens when the image with the highest clarity is acquired can be obtained. This position can be recorded as the second position, and the second position can be used as the focusing position of the objective lens for the target object.
[0033] The above technical solution determines the second movement range of the objective lens by the clarity change of the target group image collected within the first movement range, and determines the focus position of the objective lens with respect to the target object according to the clarity change of the target group image collected within the second movement range which is smaller than the first movement range. This method can perform multiple focus searches and reduce the movement range of the focus position of the objective lens with respect to the target object after each focus search, without having to perform image capture step by step within the set movement range. Therefore, on the premise that the accuracy of the determined focus position meets the requirements, the number of images captured and analyzed for clarity during the entire focusing process can be reduced, the requirements for memory and processor are low, the problem of jamming is not likely to occur, and the focus search time of the objective lens is short and the focus search efficiency is high.
[0034] Optionally, the second step length is obtained by: obtaining the second step length input by the user; or, determining the second step length based on the focus speed and the focus time, wherein one or both of the focus speed and the focus time are input by the user, and when the user inputs one of the focus speed and the focus time, the other is a preset value.
[0035] Exemplarily, the second step distance corresponding to the second range of motion determined each time can be determined by the information input by the user. Specifically, the autofocus system may include an interactive device (such as a keyboard, a touch screen, etc.), and the user may directly input the second step distance through the interactive device, and the processor of the autofocus system may obtain the second step distance input by the user. In some embodiments, the user may set the second step distance for the second range of motion determined each time, and input the set second step distance through the interactive device. In other embodiments, the user may only use the second step distance corresponding to the second range of motion determined last time, and the second step distance may be equal to the target step distance. In this case, the processor of the interactive device may calculate the second step distance corresponding to the second range of motion determined each time based on the preset rules according to the first step distance and the second step distance corresponding to the second range of motion determined last time. The second step distance calculated according to the preset rules can satisfy: for the second step distance corresponding to the second range of motion determined for the first time, the second step distance may be less than or equal to the first step distance, and be an integer multiple of the minimum step distance of the objective lens, for the second step distance corresponding to the second range of motion determined not for the first time, the second step distance may be less than or equal to the second step distance corresponding to the second range of motion determined last time, and be an integer multiple of the minimum step distance of the objective lens.
[0036] Exemplarily, for the second step corresponding to the second motion range determined for the first time, when the starting position and / or the end position of the determined second motion range do not coincide with the position of the objective lens corresponding to each image in the target group image collected within the first motion range, the second step may be equal to the first step. In a specific embodiment, the starting position of the preset first motion range may be the position of the objective lens when it is located at 0 μm, the end position may be the position of the objective lens when it is located at 25 μm, and the first step is 5 μm. The image acquisition device performs image acquisition for the target object when the objective lens is located at 0 μm, 5 μm, 10 μm, 15 μm, 20 μm, and 25 μm, respectively, and the obtained target group image includes six images. In the target group image, the clarity of the image collected when the objective lens is located at 15 μm is the highest, and the position of the objective lens at 15 μm can be used as the first position. The starting position of the determined second motion range may be the position when the objective lens is located at 8 μm, and the end position may be the position when the objective lens is located at 23 μm. In this embodiment, the second step size can be 5 μm, and the second motion range can be used as a new first motion range. Then, during the movement of the objective lens in the new first motion range, the image acquisition device can respectively acquire images of the target object when the objective lens is located at 8 μm, 13 μm, 18 μm, and 23 μm, and the obtained new target group image includes four images. In the target group image, the image acquired when the objective lens is located at 13 μm has the highest clarity, and the position of the objective lens at 13 μm can be used as a new first position. Similarly, for the second step size corresponding to the second motion range that is not determined for the first time, the second step size can be equal to the second step size corresponding to the second motion range determined last time.
[0037] Exemplarily, the user may input the focus speed and / or the focus time through the interactive device, and the processor of the autofocus system may obtain the focus speed and / or the focus time input by the user. Specifically, the user may set the focus speed for the second motion range currently determined, and the focus time may be equal to the ratio of the motion distance corresponding to the second motion range currently determined to the focus speed. In this case, the second motion range currently determined may be used as the second motion range determined last time, and the image acquisition device continuously takes pictures at a preset image acquisition speed m, where the unit of m is sheets / second. The motion distance corresponding to the second motion range currently determined is recorded as S, the focus speed is recorded as v, and the second step distance is recorded as s, then s=S / [(S / v)*m-1]. The user may also set the focus time for the second motion range currently determined, and the focus speed may be equal to the ratio of the motion distance corresponding to the second motion range currently determined to the focus time. Similarly, the second motion range currently determined may be used as the second motion range determined last time, and the image acquisition device continuously takes pictures at a preset image acquisition speed m, where the unit of m is sheets / second. The movement distance corresponding to the currently determined second movement range is recorded as S, the focus time is recorded as t, and the second step distance is recorded as s, then s=S / (t*m-1). The user can also set the focus speed and focus time for the currently determined second movement range, and the product of the set focus speed and focus time is equal to the movement distance corresponding to the currently determined second movement range. Similarly, the currently determined second movement range can be used as the second movement range determined for the last time, and the image acquisition device continuously takes pictures at a preset image acquisition speed m, where the unit of m is pictures / second. The movement distance corresponding to the currently determined second movement range is recorded as S, the focus time is recorded as t, the second step distance is recorded as s, and the focus speed is recorded as v, then s=S / [(S / v)*m-1] or s=S / (t*m-1).
[0038] The above technical solution determines the second step length according to the user's input information, so that the user can define the numerical size of the second step length according to the actual focusing effect, so that the user can control the time from starting focusing to determining the focusing position of the objective lens for the target object. It has high flexibility and can adapt to a variety of focusing scenarios.
[0039] Optionally, each second step distance is smaller than the first step distance; the second step distance corresponding to the second motion range determined each time is smaller than the second step distance corresponding to the second motion range determined last time.
[0040] Exemplarily, the second step distance corresponding to the second motion range determined each time is smaller than the first step distance. For example, when the first step distance is equal to 10 μm, the second step distance corresponding to the second motion range determined each time may be equal to 8 μm, 5 μm, 2 μm, etc. The second step distance corresponding to each second motion range determined not for the first time is smaller than the second step distance corresponding to the second motion range determined last time. For example, when the second step distance corresponding to the second motion range determined for the first time is equal to 5 μm, the second step distance corresponding to the second motion range determined for the second time may be 2 μm, and the second step distance corresponding to the second motion range determined for the third time may be 0.5 μm.
[0041] In the above technical solution, the second step size corresponding to the determined second motion range can gradually approach the target step size of the objective lens, so that the distance between the position of the objective lens corresponding to the highest image clarity in the target group image and the theoretical position of the objective lens corresponding to the maximum image clarity can be gradually reduced, until the distance between the determined focusing position and the theoretical position of the objective lens corresponding to the maximum image clarity does not exceed the target step size. When the objective lens is located at the finally determined focusing position, the clarity of the captured image can be extremely close to the theoretical maximum clarity of the captured image.
[0042] Optionally, according to the change in clarity of the target group image most recently acquired, the second movement range of the objective lens is determined, including: determining the first position according to the change in clarity of the target group image most recently acquired; determining the third position and the fourth position of the objective lens according to the first position, wherein the third position and the fourth position are respectively located on both sides of the first position, and the images acquired at the third position, the first position and the fourth position are respectively acquired images continuously; and determining the third position and the fourth position as boundaries of the second movement range to determine the second movement range.
[0043] Exemplarily, for the latest acquired target group image, the image with the highest clarity can be obtained according to the change of its clarity, and the position of the objective lens when acquiring the image with the highest clarity can be determined as the first position. After determining the first position, the third position and the fourth position can be determined on both sides of the first position, respectively, and the image acquired when the objective lens is at the third position is continuous with the image acquired when the objective lens is at the first position, and the image acquired when the objective lens is at the first position is continuous with the image acquired when the objective lens is at the fourth position. In other words, the images acquired at the third position, the first position, and the fourth position are images acquired continuously. The third position and the fourth position can be determined as the boundaries of the second motion range, that is, the third position can be used as the starting position corresponding to the second motion range, and the fourth position can be used as the end position corresponding to the second motion range. For example, during the process of the objective lens moving in a straight line within the first motion range, the image acquisition device acquires images of the target object at the positions where the objective lens is located at 150μm, 160μm, 170μm, 180μm, 190μm, and 200μm, respectively, and the obtained target group image includes six images. In this embodiment, the definition of the image collected when the objective lens is at 180 μm is the highest, so the first position is the position when the objective lens is at 180 μm, the third position is the position when the objective lens is at 170 μm, and the fourth position is the position when the objective lens is at 190 μm. The boundaries of the second motion range determined based on the target group image are the position when the objective lens is at 170 μm and the position when the objective lens is at 190 μm.
[0044] The above technical solution determines the third position and the fourth position on both sides of the first position as the boundaries of the second motion range, and the image captured when the objective lens is at the third position and the image captured when the objective lens is at the fourth position are respectively continuous with the image captured when the objective lens is at the first position. In this way, the motion distance corresponding to the determined second motion range can be greatly smaller than the motion distance corresponding to the first motion range, which is beneficial to saving focusing time and can ensure that the theoretical position of the objective lens corresponding to the maximum image clarity is within the second motion range.
[0045] Optionally, determining the second motion range of the objective lens according to a change in clarity of the most recently acquired target group image includes: determining the similarity between each image in the target group image and a reference image, wherein the reference image is an image acquired by the objective lens when the objective lens is located at a focusing position for a reference object, and the reference object and the target object are objects of the same type; determining the second motion range according to a change in the similarity between each image in the target group image and the reference image; wherein the change in clarity is represented by a change in similarity.
[0046] Exemplarily, the reference image can be an image collected when the reference object is in the focusing position of the object lens in advance, and the reference object can be any target object in a plurality of target objects of the same type, or the reference object can be an object of the same type as the target object other than the target object. For example, when the target object is a plurality of wafers of the same model, the reference object can be one of the wafers in the plurality of wafers as the target object, or the reference object can be a wafer of the same model as the plurality of wafers. The specific process of obtaining the reference image can refer to the aforementioned embodiment, and this is not repeated. The clarity of each image in the target group image can be represented by the similarity between the image and the reference image, and the similarity can be quantified by scoring, and the higher the score, the greater the similarity can be represented. Accordingly, the change in the clarity of the target group image can be represented by the change in the similarity of the target group image. According to the change in the similarity of the target group image, the second range of motion of the object lens can be determined, and the first position of the object lens corresponding to the image with the highest similarity to the reference image in the target group image is within the second range of motion. The embodiment of the present invention does not specifically limit the method for obtaining similarity. The method for obtaining similarity may be, for example, calculating the mean square error between each image in the target group of images and the reference image, or calculating the structural similarity index between each image in the target group of images and the reference image.
[0047] The above technical solution determines the clarity of each image by comparing the similarity between each image in the target group image and the reference image, and can quickly and accurately quantify the clarity change of each image, so that the second motion range can be determined intuitively and accurately based on the clarity change of each image.
[0048] Optionally, before controlling the objective lens to move in a straight line within a preset first motion range, the method further includes: determining a first step distance in response to an input operation of a user.
[0049] Exemplarily, the first step distance may be input by a user through an interactive device of the autofocus system, and a processor of the autofocus system may determine the first step distance in response to the user's input operation. Specifically, the autofocus system may further include a display device, and an input box for inputting the first step distance may be provided on a display interface of the display device, and the user may set the first step distance on the input box through the interactive device.
[0050] The above technical solution can determine the first step distance according to the user's input information, and can enable the user to define the numerical value of the first step distance according to the actual focusing effect, which helps the user to control the time from starting focusing to determining the focusing position of the objective lens for the target object. It has high flexibility and can adapt to a variety of focusing scenarios.
[0051] Optionally, after determining the first step, before controlling the objective lens to move in a straight line within the second motion range, the method also includes: determining the second step corresponding to the second motion range determined each time based on the first step and the target step of the objective lens; wherein the second step corresponding to the second motion range determined for the last time is equal to the target step.
[0052] Exemplarily, the processor of the interactive device can determine the second step distance corresponding to the second motion range determined each time according to the first step distance and the target step distance of the objective lens. The second step distance corresponding to the second motion range determined for the last time is equal to the target step distance of the objective lens. Specifically, for the second step distance corresponding to the second motion range determined for the first time, the second step distance can be less than or equal to the first step distance, and be an integer multiple of the minimum step distance of the objective lens. For the second step distance corresponding to the second motion range not determined for the first time, the second step distance can be less than or equal to the second step distance corresponding to the second motion range determined last time, and be an integer multiple of the minimum step distance of the objective lens.
[0053] Exemplarily, the second step distance corresponding to the second motion range determined each time can be determined according to the preset rules based on the first step distance and the target step distance. For example, the first step distance can be 10 μm, the target step distance can be 0.5 μm, and the preset rules can include: the multiple of the first step distance relative to the second step distance corresponding to the second motion range determined for the first time is an integer greater than 4, the multiple of the second step distance corresponding to the second motion range determined each time relative to the second step distance corresponding to the second motion range determined next time is an integer greater than 2, the second step distance corresponding to the second motion range determined each time is an integer multiple of the minimum step distance of the objective lens, and the second step distance corresponding to the second motion range determined for the last time is equal to the target step distance. In this case, the second step distance corresponding to the second motion range determined for the first time can be 2 μm, and the second step distance corresponding to the second motion range determined for the second time can be 0.5 μm.
[0054] For another example, the first step pitch may be 10 μm, the target step pitch may be 0.5 μm, and the preset rules may include: the first step pitch is a multiple of 2 relative to the second step pitch corresponding to the first determined second motion range, and for each second motion range determined except the last determined second motion range, the second step pitch corresponding to the second motion range determined this time is a multiple of 0.5 relative to the second step pitch corresponding to the last determined second motion range, and the maximum number of focus searches is 4. In this case, the second step pitch corresponding to the first determined second motion range may be 5 μm, the second step pitch corresponding to the second motion range determined for the second time may be 2.5 μm, and the second step pitch corresponding to the second motion range determined for the third time may be 0.5 μm.
[0055] For another example, the first step distance may be 10 μm, and the target step distance may be 0.5 μm. The preset rules may include: the second step distance corresponding to the second motion range determined for the first time is equal to the first step distance, and the second step distance corresponding to the second motion range determined each time is an integer greater than 2 in multiples of the second step distance corresponding to the second motion range determined next time, and the maximum number of focus searches is 4, the second step distance corresponding to the second motion range determined each time is an integer multiple of the minimum step distance of the objective lens, and the second step distance corresponding to the second motion range determined for the last time is equal to the target step distance. In this case, the second step distance corresponding to the second motion range determined for the first time may be 10 μm, the second step distance corresponding to the second motion range determined for the second time may be 2 μm, and the second step distance corresponding to the second motion range determined for the third time may be 0.5 μm.
[0056] In the above embodiment, if the preset rule may include a maximum number of focus searches, the maximum number of focus searches may be input by the user, or it may be a pre-set default value, or it may be determined based on the movement distance corresponding to the first preset first movement range. For example, the maximum number of focus searches may be determined based on the preset numerical interval in which the movement distance corresponding to the preset first movement range falls. Different preset numerical intervals may correspond to different maximum number of focus searches. The larger the mean / median / extreme value of the preset numerical interval, the larger the corresponding maximum number of focus searches.
[0057] It can be understood that the preset rules described in the above embodiment are only examples, and the preset rules may also include, for example: the difference between the first step and the second step corresponding to the second motion range determined for the first time is a first preset difference (for example, 5 μm), the difference between the second step corresponding to the second motion range determined each time and the second step corresponding to the second motion range determined next time is a second preset difference (for example, 3 μm), the second step corresponding to the second motion range determined each time is an integer multiple of the minimum step of the objective lens, and the second step corresponding to the second motion range determined last time is equal to the target step. For another example, the preset rules may also include: the difference between the first step and the second step corresponding to the second motion range determined for the first time, and the difference between the second step corresponding to the second motion range determined each time and the second step corresponding to the second motion range determined next time are equal, the second step corresponding to the second motion range determined each time is an integer multiple of the minimum step of the objective lens, and the second step corresponding to the second motion range determined last time is equal to the target step. The embodiment of the present invention does not make specific limitations on the preset rules. It satisfies that according to the preset rules, the second step distance corresponding to the second motion range determined each time can be determined according to the first step distance and the target step distance of the objective lens, and the second step distance corresponding to the second motion range determined for the last time is equal to the target step distance.
[0058] The above technical solution can determine each second step distance according to the first step distance and the target step distance, which can realize the automatic realization of the second step distance with less operation amount for the user.
[0059] Optionally, controlling the objective lens to move in a straight line within a preset first motion range includes: controlling the objective lens to move from a starting position to an end position, wherein the starting position and the end position are respectively located on both sides of a coarse focusing position, the coarse focusing position is a focusing position of the objective lens for a reference object, wherein the reference object and the target object are objects of the same type, and the focusing position for the reference object is a second position of the objective lens corresponding to a time when the clarity of an image captured for the reference object is the highest.
[0060] Exemplarily, the reference object may be any target object among a plurality of target objects of the same type, or an object of the same type as the target object other than the target object. The starting position and the end position may be located on both sides of the coarse focus position along the optical axis direction of the objective lens, respectively. The distances between the starting position and the end position and the coarse focus position may be recorded as the second preset distance, and the second preset distance corresponding to the starting position and the second preset distance corresponding to the end position may be the same or different. The starting position, the coarse focus position and the end position are located on the same straight line, which is parallel to the optical axis direction of the objective lens, and the focus position of the objective lens is located between the starting position and the end position. The second preset distance may be any value, which may be set according to various parameters in the application scenario, such as the thickness difference of different target objects. If the thickness difference of different target objects is large, the second preset distance may be set larger. Exemplarily, the second preset distances between the starting position and the end position and the coarse focus position may be equal. In the above embodiment in which the reference object is placed within the image acquisition range of the image acquisition device along the optical axis direction of the objective lens, the second preset distance may be equal to 50 μm. The position information corresponding to the starting position can be expressed as the difference between the coarse focus position and the second preset distance, that is, the position of 150 μm. In other words, when the distance between the objective lens and the target object is equal to 150 μm, it is located at the starting position. The position information corresponding to the end position can be expressed as the sum of the coarse focus position and the second preset distance, that is, the position of 250 μm. When the distance between the objective lens and the target object is equal to 250 μm, it is located at the end position. It can be understood that the starting position can also be interchanged with the end position, that is, the starting position is 250 μm away from the target object, and the end position is 150 μm away from the target object.
[0061] The above technical solution uses the focusing position for the reference object as the coarse focusing position, and can find the coarse focusing position without a high-cost device. This can quickly and accurately determine the first movement range and ensure that the theoretical position of the objective lens corresponding to the maximum image clarity is within the first movement range.
[0062] See also Figure 3 , which is a schematic diagram of the position of the objective lens when capturing images within the first motion range according to one embodiment of the present invention. Figure 3 In the embodiment shown, the preset first motion range for the objective lens is from the starting position to the end position, and the starting position is Figure 3 The leftmost vertical arrow indicates the location (i.e., the collection start point) and the end point is Figure 3 The position indicated by the rightmost vertical arrow is shown in the figure (i.e., the end point of the acquisition). The objective lens can move from the starting position to the end point in a straight line. In this embodiment, the measurement value of the acquisition start point on the grating ruler is 100 μm, and the measurement value of the acquisition end point on the grating ruler is 200 μm. The first step is Figure 3 , which is shown as the distance between any two adjacent vertical arrows of the three vertical arrows at one end of the starting position, or the distance between any two adjacent vertical arrows of the two vertical arrows at one end of the terminal position. In this embodiment, the first step distance is equal to 10 μm. The movement distance corresponding to the first motion range is the distance from the starting position to the terminal position. In the process of controlling the objective lens to move in a straight line within the preset first motion range, the target object can be imaged at intervals of the first step distance to obtain a target group image (recorded as the first target group image). The clarity score of each image in the obtained first target group image is shown in Table 1:
[0063] Table 1 Clarity scores of each image in the first target group
[0064] id 1 2 3 4 5 6 7 8 9 10 11 Z 100 110 120 130 140 150 160 170 180 190 200 score 60 65 70 75 80 85 90 95 85 80 75
[0065] The number of images in the first target group image collected within the preset first motion range is recorded as N1, then N1 = (200μm-100μm) / 10μm+1 = 11, arranged from small to large in terms of distance from the collection starting point, the serial number value (id) of the first image in Table 1 is 1, the serial number value of the second image in Table 1 is 2, ..., and the serial number value of the eleventh image in Table 1 is 11. In Table 1, Z represents the measurement value of the objective lens on the grating ruler when the corresponding image is collected, and the measurement value can represent the position of the objective lens, and its unit of measurement is μm; Score represents the clarity score of the corresponding image. It can be seen from Table 1 that the image with the highest clarity score is the eighth image (id = 8), and the corresponding clarity score is 95. The position of the objective lens when collecting the eighth image is at 170μm, which can be used as the first position. After determining the first position, the third position and the fourth position of the objective lens can be determined according to the first position, wherein the third position and the fourth position are respectively located on both sides of the first position. In the present embodiment, the third position is the position when the objective lens is located at 160 μm, and the fourth position is the position when the objective lens is located at 180 μm. The third position and the fourth position are determined as the boundaries of the second motion range to determine the second motion range. After determining the second motion range, the objective lens can be controlled to move in a straight line within the second motion range. During the motion process, the target object is imaged at intervals corresponding to the second step distance of the second motion range to obtain a new target group image (recorded as the second target group image). In the present embodiment, the second step distance corresponding to the currently determined second motion range is 2 μm. The clarity scores of each image in the obtained second target group image are shown in Table 2:
[0066] Table 2 Clarity scores of each image in the second target group
[0067] id 1 2 3 4 5 6 7 8 9 10 11 Z 160 162 164 166 168 170 172 174 176 178 180 score 90 94 97 99 98 95 94 92 90 88 85
[0068] The number of images in the second target group image collected within the second motion range is recorded as N2, then N2 = (180μm-160μm) / 2μm+1 = 11, arranged from small to large according to the distance from the third position, the serial number value (id) of the first image in Table 1 is 1, the serial number value of the second image in Table 2 is 2, ..., the serial number value of the eleventh image in Table 1 is 11. In Table 2, Z represents the measurement value of the objective lens on the grating ruler when the corresponding image is collected. The measurement value can represent the position of the objective lens, and its unit of measurement is μm; Score represents the clarity score of the corresponding image. In this embodiment, the target step size is 0.5μm, and the second step size is greater than the target step size. The currently determined second motion range is used as the first motion range, and the second motion range of the objective lens is determined again according to the change in clarity of the second target group image. As can be seen from Table 2, the image with the highest clarity score is the fourth image (id=4), and the corresponding clarity score is 99. The position of the objective lens when capturing the fourth image is the position at 166 μm, which can be used as the first position. After determining the first position, the third position and the fourth position of the objective lens can be determined according to the first position, wherein the third position and the fourth position are respectively located on both sides of the first position. In this embodiment, the third position is the position when the objective lens is located at 164 μm, and the fourth position is the position when the objective lens is located at 168 μm. The third position and the fourth position are determined as the boundaries of the second motion range to determine the second motion range. After determining the second motion range, the objective lens can be controlled to move in a straight line within the second motion range. During the motion process, the target object is imaged at intervals corresponding to the second motion range to obtain a new target group image (recorded as the third target group image). In this embodiment, the second step corresponding to the currently determined second motion range is 0.5 μm. The clarity scores of each image in the obtained third target group image are shown in Table 3:
[0069] Table 3 Clarity scores of each image in the third target group
[0070] id 1 2 3 4 5 6 7 8 9 Z 164 164.5 165 165.5 166 166.5 167 167.5 168 score 97 98 98.5 99 100 99.5 98.5 98.5 98
[0071] The number of images in the third target group image is recorded as N3, then N3 = (168μm-164μm) / 0.5μm+1 = 9, and the first image in Table 3 is arranged from small to large according to the distance from the third position. The serial number value (id) is 1, the serial number value of the second image in Table 3 is 2, ..., and the serial number value of the ninth image in Table 3 is 9. In Table 3, Z represents the measurement value of the objective lens on the grating ruler when the corresponding image is collected. The measurement value can represent the position of the objective lens, and its unit of measurement is μm; Score represents the clarity score of the corresponding image. In this embodiment, the target step size is 0.5μm, and the second step size is equal to the target step size. The focus position of the objective lens for the target object can be determined according to the change in the clarity of the third target group image. It can be seen from Table 3 that the image with the highest clarity score is the fifth image (id = 5), and the corresponding clarity score is 100. The position of the objective lens when collecting the fifth image is the position at 166μm, so this position can be used as the focus position of the objective lens for the target object.
[0072] See also Figure 4 As shown, it is a schematic block diagram of an automatic focusing device according to an embodiment of the present invention. According to another aspect of the present invention, an automatic focusing device 400 is also provided, including:
[0073] The first control module 410 is used to control the objective lens to move along a straight line within a preset first movement range, and during the movement, the image of the target object is captured at a first step interval to obtain a target group image;
[0074] A determination module 420 is used to determine a second motion range of the objective lens according to a change in the clarity of the target group image acquired most recently, wherein the first position of the objective lens corresponding to the time when the clarity of the image in the target group image is the highest is within the second motion range, the second motion range is within the first motion range, and the motion distance corresponding to the second motion range is less than the motion distance corresponding to the first motion range;
[0075] The second control module 430 is used to control the objective lens to move in a straight line within a second motion range. During the motion, images of the target object are captured at intervals of a second step size corresponding to the second motion range to obtain a new target group image. When the second step size is greater than the target step size, the second motion range is used as the new first motion range, and the module returns to execute the step of determining the second motion range of the objective lens according to the change in clarity of the target group image captured most recently. When the second step size is equal to the target step size, the focusing position of the objective lens with respect to the target object is determined according to the change in clarity of the target group image captured most recently, wherein the focusing position is the second position of the objective lens corresponding to the highest image clarity in the target group image captured most recently.
[0076] See also Figure 5As shown, it is a schematic block diagram of an electronic device according to an embodiment of the present invention. According to another aspect of the present invention, an electronic device 500 is also provided, including: a processor 510 and a memory 520, wherein the memory 520 stores computer program instructions, and the computer program instructions are used by the processor 510 to execute the above-mentioned autofocus method when running.
[0077] According to another aspect of the present invention, a storage medium is also provided, on which program instructions are stored, and when the program instructions are executed by a computer or a processor, the computer or the processor executes the corresponding steps of the above-mentioned autofocus method of the embodiment of the present invention, and is used to implement the corresponding module in the above-mentioned autofocus device according to the embodiment of the present invention or the corresponding module in the above-mentioned autofocus device. The storage medium may include, for example, a memory card of a smart phone, a storage component of a tablet computer, a hard disk of a personal computer, a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a portable compact disk read-only memory (CD-ROM), a USB memory, or any combination of the above storage media. The computer-readable storage medium may be any combination of one or more computer-readable storage media.
[0078] According to yet another aspect of the present invention, a computer program product is provided, comprising computer program instructions, wherein the computer program instructions are used to execute the above-mentioned automatic focusing method when being run.
[0079] A person skilled in the art can understand the specific implementation and beneficial effects of the above-mentioned auto-focusing device by reading the above-mentioned specific description of the auto-focusing method, and for the sake of brevity, it will not be described in detail here.
[0080] Although example embodiments have been described herein with reference to the accompanying drawings, it should be understood that the above example embodiments are merely exemplary and are not intended to limit the scope of the present invention thereto. Various changes and modifications may be made therein by one of ordinary skill in the art without departing from the scope and spirit of the present invention. All such changes and modifications are intended to be included within the scope of the present invention as required by the appended claims.
[0081] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0082] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed.
[0083] In the description provided herein, a large number of specific details are described. However, it is understood that embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.
[0084] Similarly, it should be understood that in order to streamline the present invention and help understand one or more of the various inventive aspects, in the description of the exemplary embodiments of the present invention, the various features of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, the method of the present invention should not be interpreted as reflecting the following intention: the claimed invention requires more features than the features explicitly stated in each claim. More specifically, as reflected in the corresponding claims, the inventive point is that the corresponding technical problem can be solved with less than all the features of a single disclosed embodiment. Therefore, the claims following the specific embodiment are hereby expressly incorporated into the specific embodiment, wherein each claim itself serves as a separate embodiment of the present invention.
[0085] It will be understood by those skilled in the art that, except for mutually exclusive features, all features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed in this specification may be combined in any combination. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature that provides the same, equivalent or similar purpose.
[0086] In addition, those skilled in the art will appreciate that, although some embodiments herein include certain features included in other embodiments but not other features, the combination of features of different embodiments is meant to be within the scope of the present invention and form different embodiments. For example, in the claims, any one of the claimed embodiments may be used in any combination.
[0087] The various component embodiments of the present invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that a microprocessor or a digital signal processor (DSP) may be used in practice to implement some or all of the functions of some modules in an autofocus device according to an embodiment of the present invention. The present invention may also be implemented as a device program (e.g., a computer program and a computer program product) for executing part or all of the methods described herein. Such a program for implementing the present invention may be stored on a computer-readable medium, or may be in the form of one or more signals. Such a signal may be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.
[0088] It should be noted that the above embodiments illustrate the present invention rather than limit it, and that those skilled in the art may devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbol between brackets shall not be construed as a limitation on the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "one" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present invention may be implemented by means of hardware comprising a number of different elements and by means of a suitably programmed computer. In a unit claim enumerating a number of devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, and third, etc., does not indicate any order. These words may be interpreted as names.
[0089] The above is only a specific embodiment or description of a specific embodiment of the present invention, and the protection scope of the present invention is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. The protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. An automatic focusing method, characterized in that: include: Controlling the objective lens to move in a straight line within a preset first movement range, and during the movement, capturing images of the target object at intervals of the first step to obtain a target group image; Determining a second movement range of the objective lens according to a change in the clarity of the target group image acquired most recently, wherein a first position of the objective lens corresponding to a time when the clarity of an image in the target group image is the highest is within the second movement range, the second movement range is within the first movement range, and a movement distance corresponding to the second movement range is less than a movement distance corresponding to the first movement range; The objective lens is controlled to move in a straight line within the second motion range. During the motion, the image of the target object is captured at intervals of a second step size corresponding to the second motion range to obtain a new target group image. When the second step size is greater than the target step size, the second motion range is used as the new first motion range. The step of determining the second motion range of the objective lens according to the change in clarity of the target group image captured most recently is returned to the step of determining the focus position of the objective lens for the target object according to the change in clarity of the target group image captured most recently is determined when the second step size is equal to the target step size, wherein the focus position is the second position of the objective lens corresponding to the highest image clarity in the target group image captured most recently.
2. The method according to claim 1, characterized in that The second step distance is obtained by: Obtain the second step distance input by the user; or, The second step length is determined based on a focus speed and a focus time, wherein one or both of the focus speed and the focus time are input by a user, and when the user inputs one of the focus speed and the focus time, the other is a preset value.
3. The method according to claim 1, characterized in that Each of the second step distances is smaller than the first step distance; The second step distance corresponding to the second motion range determined each time is smaller than the second step distance corresponding to the second motion range determined last time.
4. The method according to claim 1, characterized in that: The step of determining the second motion range of the objective lens according to the definition change of the target group image acquired most recently comprises: Determining the first position according to a change in clarity of the most recently acquired target group image; Determining a third position and a fourth position of the objective lens according to the first position, wherein the third position and the fourth position are located at two sides of the first position, respectively, and images acquired at the third position, the first position, and the fourth position are images acquired continuously; The third position and the fourth position are determined as boundaries of the second motion range to determine the second motion range.
5. The method according to claim 1, characterized in that The step of determining the second motion range of the objective lens according to the definition change of the target group image acquired most recently comprises: Determining a similarity between each image in the target group of images and a reference image, wherein the reference image is an image captured by the objective lens when the objective lens is located at a focus position for a reference object, and the reference object and the target object are objects of the same type; determining the second motion range according to a change in similarity between each image in the target group of images and the reference image; The change in clarity is represented by the change in similarity.
6. The method according to any one of claims 1 to 5, characterized in that: Before controlling the objective lens to move in a straight line within a preset first motion range, the method further includes: In response to an input operation of a user, the first step is determined.
7. The method according to claim 6 as referred to claim 2 or 3, characterized in that After determining the first step and before controlling the objective lens to move in a straight line within the second motion range, the method further includes: Determining the second step distance corresponding to the second motion range determined each time according to the first step distance and the target step distance of the objective lens; The second step length corresponding to the second motion range determined last time is equal to the target step length.
8. The method according to any one of claims 1 to 5, characterized in that: The controlling the objective lens to move along a straight line within a preset first motion range comprises: Control the objective lens to move from a starting position to an end position, wherein the starting position and the end position are respectively located on both sides of a coarse focusing position, and the coarse focusing position is a focusing position of the objective lens for a reference object, wherein the reference object and the target object are objects of the same type, and the focusing position for the reference object is a position of the objective lens corresponding to a maximum clarity of an image captured for the reference object.
9. An automatic focusing device, characterized in that: include: A first control module is used to control the objective lens to move in a straight line within a preset first movement range, and during the movement, the image of the target object is captured at a first step interval to obtain a target group image; A determination module, configured to determine a second motion range of the objective lens according to a change in the clarity of the target group image acquired most recently, wherein a first position of the objective lens corresponding to a time when the clarity of an image in the target group image is the highest is within the second motion range, the second motion range is within the first motion range, and a motion distance corresponding to the second motion range is less than a motion distance corresponding to the first motion range; A second control module is used to control the objective lens to move in a straight line within the second motion range. During the motion, the target object is imaged at intervals of a second step size corresponding to the second motion range to obtain a new target group image. When the second step size is greater than the target step size, the second motion range is used as the new first motion range, and the step of determining the second motion range of the objective lens according to the change in clarity of the target group image acquired most recently is returned to execute. When the second step size is equal to the target step size, the focus position of the objective lens with respect to the target object is determined according to the change in clarity of the target group image acquired most recently, wherein the focus position is the second position of the objective lens corresponding to the highest image clarity in the target group image acquired most recently.
10. A storage medium having program instructions stored thereon, characterized in that: The program instructions are used to execute the method according to any one of claims 1 to 8 when running.
Citation Information
Patent Citations
Focusing method and device, electronic equipment and storage medium
CN114460791A
Automatic focusing method, system and device, electronic equipment and storage medium
CN116243448A
Focusing method and terminal, storage medium
WO2018045945A1