Defocusing amount determination method and device, equipment and medium

By performing area division and confidence screening on the target laser image in the laser focusing system, the mean value of the defocus amount of the area image is calculated to determine the defocus amount of the laser focus, the problem of low accuracy in determining the defocus amount in the interfering image scene in the prior art is solved, and the focus accuracy and speed are improved.

CN120063666AInactive Publication Date: 2025-05-30BEIJING ZHONGKE HUIYI TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510227938.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-28
Publication Date
2025-05-30
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

When faced with interfering image scenes, the accuracy of the defocus amount determination method in the existing laser focusing system is low, resulting in inaccurate focus and slow focus speed, which cannot meet application scenarios with high requirements for imaging quality and focus efficiency.

Method used

By acquiring the target laser image and dividing the image into several area images perpendicular to the laser line direction, an area image with a confidence level of not less than a preset threshold is selected according to the confidence level of each area image, and the average defocus amount of these area images is calculated to determine the defocus amount of laser focus.

Benefits of technology

This method can accurately reflect the actual defocusing state, improve the focus accuracy and speed of the laser focusing system, and is suitable for application scenarios with high requirements for imaging quality and focus efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120063666A_ABST
    Figure CN120063666A_ABST
Patent Text Reader

Abstract

The invention discloses a defocusing amount determination method and device, equipment and a medium, and relates to the field of laser focusing, and the method comprises the steps: obtaining a target laser image; wherein the target laser image is a laser image of a first target object acquired under an actual focusing condition; dividing the target laser image according to a division rule to obtain a plurality of first region images; wherein the division rule means that the divided image is divided in the direction perpendicular to the laser line of the divided image; according to the confidence of each first area image, selecting the first area image of which the confidence is not less than a first threshold value to obtain a first target area image; according to the defocusing amount of each first target area image, calculating a defocusing amount mean value of all the first target area images to obtain a first defocusing amount mean value; determining the defocusing amount of laser focusing according to the first defocusing amount mean value; according to the invention, the accuracy of the determined defocusing amount of laser focusing is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of laser focusing, and in particular, to a method, device, equipment and medium for determining defocus amount. Background Art

[0002] Laser focusing systems utilize laser technology to achieve fast and accurate focusing, and are widely applied in fields such as cameras, smart phones, industrial inspection equipment, etc. Such systems usually emit a beam of laser onto a target object, and calculate the defocus amount (the distance difference between the actual focus position and the ideal focus position) based on the reflected laser signal, so as to adjust the lens position according to the defocus amount to achieve the best focus and realize focusing. Therefore, in a laser focusing system, accurately and quickly obtaining the defocus amount of laser focusing is the key to achieving precise focusing.

[0003] The existing method for determining the defocus amount of laser focusing is to use the difference between the centroid of the collected laser image and the centroid of the reference image as the defocus amount of laser focusing. When facing an image scene with interference (such as a complex image scene or an image scene with noise interference), the collected laser image will be blurred, jittery, or even skewed, resulting in deformation of the laser line in the collected laser image. Furthermore, it is difficult for the laser line in the laser image to accurately reflect the actual defocus state. At this time, the accuracy of the defocus amount of laser focusing obtained by using the existing defocus amount determination method is relatively low, resulting in inaccurate focusing and slow focusing speed of the laser focusing system, and it cannot meet the application scenarios with high requirements for imaging quality and focusing efficiency (such as semiconductor inspection, panel inspection, etc.). Summary of the Invention

[0004] The purpose of the present application is to provide a method, device, equipment and medium for determining defocus amount to solve the problem of low accuracy of the defocus amount of laser focusing obtained by using the existing defocus amount determination method when facing an image scene with interference.

[0005] To achieve the above purpose, the present application provides the following solutions:

[0006] In a first aspect, the present application provides a method for determining defocus amount, including:

[0007] Obtaining a target laser image; wherein, the target laser image refers to the laser image of a first target object obtained under actual focusing conditions;

[0008] Dividing the target laser image according to a division rule to obtain a plurality of first regional images; wherein, the division rule refers to dividing the image to be divided along the direction perpendicular to the laser line of the image to be divided;

[0009] Select the first region images with confidence levels not less than the first threshold according to the confidence levels of each of the first region images to obtain first target region images;

[0010] Calculate the average defocus amount of all the first target region images based on the defocus amounts of each of the first target region images to obtain a first average defocus amount;

[0011] Determine the defocus amount for laser focusing based on the first average defocus amount.

[0012] Optionally, the defocus amount determination method further includes:

[0013] Before calculating the average defocus amount of all the first target region images based on the defocus amounts of each of the first target region images, calculate the defocus amount of each of the first region images;

[0014] Extract the defocus amount of each of the first target region images from the defocus amounts of the first region images.

[0015] Optionally, the defocus amount determination method further includes:

[0016] Before calculating the average defocus amount of all the first target region images based on the defocus amounts of each of the first target region images, calculate the defocus amount of each of the first target region images.

[0017] Optionally, the step of determining the defocus amount for laser focusing based on the first average defocus amount specifically includes:

[0018] Use the first average defocus amount as the defocus amount for laser focusing.

[0019] Optionally, the step of determining the defocus amount for laser focusing based on the first average defocus amount specifically includes:

[0020] Select the first target region images with the difference between the defocus amount and the first average defocus amount not greater than the second threshold to obtain second target region images;

[0021] Extract the defocus amount of each of the second target region images from the defocus amounts of the first region images or the defocus amounts of the first target region images;

[0022] Calculate the average defocus amount of all the second target region images based on the defocus amounts of each of the second target region images to obtain a second average defocus amount, and use the second average defocus amount as the defocus amount for laser focusing.

[0023] Optionally, calculate the defocus amount of each of the first region images or the first target region images according to the following steps:

[0024] By using the method for calculating the centroid of an image, calculate the centroid of each sub-region image and the centroid of the second-region image corresponding to each sub-region image; wherein, the sub-region image includes a first-region image or a first target-region image, and the second-region image refers to the region image obtained by dividing the reference image according to the division rule, and the reference image refers to the laser image of the second target object obtained under ideal focusing conditions;

[0025] Calculate the difference between the centroid of each sub-region image and the centroid of the second-region image corresponding thereto, to obtain the defocus amount of each sub-region image.

[0026] Optionally, the defocus amount determination method further includes:

[0027] Before selecting the first-region images with a confidence level not less than the first threshold according to the confidence level of each first-region image, calculate the confidence level of each first-region image; wherein, the confidence level of each first-region image is the mean square deviation of the pixel gray values of each first-region image or the laser line width of the first-region image.

[0028] In a second aspect, the present application provides a defocus amount determination device, including:

[0029] An acquisition module, configured to acquire a target laser image, wherein the target laser image refers to the laser image of a target object obtained under actual focusing conditions;

[0030] A processing module, configured to divide the target laser image according to a division rule, to obtain a plurality of first-region images; wherein, the division rule refers to dividing the image to be divided along the direction perpendicular to the laser line of the image to be divided;

[0031] According to the confidence level of each first-region image, select the first-region images with a confidence level not less than the first threshold, to obtain a first target-region image; wherein, the confidence level of each first-region image refers to the laser line width of each first-region image;

[0032] According to the defocus amount of each first target-region image, calculate the mean value of the defocus amounts of all the first target-region images, to obtain a first mean defocus amount;

[0033] Determine the defocus amount of laser focusing according to the first mean defocus amount.

[0034] In a third aspect, the present application provides a computer device, including: a memory, a processor, and a computer program stored on the memory and executable on the processor, and the processor executes the computer program to implement the steps of the defocus amount determination method described in any one of the above.

[0035] In a fourth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the defocus amount determination method described in any one of the above are implemented.

[0036] According to the specific embodiments provided by the present application, the following technical effects are disclosed in the present application:

[0037] The present application provides a defocus amount determination method, device, equipment and medium. By acquiring a target laser image and dividing the target laser image into a plurality of first region images according to a division rule, and selecting first region images with a confidence level not less than a preset first threshold according to the confidence level of each first region image, thereby discarding first region images with a confidence level less than the first threshold and retaining first region images with a confidence level not less than the first threshold. A confidence level less than the first threshold means that the laser line of the first region image undergoes a large deformation, and a confidence level not less than the first threshold means that the laser line of the first region image does not undergo a large deformation. Therefore, compared with the original target laser image, the first target region image retained after discarding the first region image with a confidence level less than the first threshold can accurately reflect the actual defocus state; by calculating the average defocus amount of all first target region images according to the defocus amount of each first target region image to obtain a first average defocus amount, and determining the defocus amount of laser focusing according to the first average defocus amount, it is realized to determine the defocus amount of laser focusing by using an image region that can accurately reflect the actual defocus state, ensuring the accuracy of the determined defocus amount of laser focusing; in addition, determining the defocus amount of laser focusing according to the first average defocus amount can further avoid noise interference and further improve the accuracy of the determined defocus amount of laser focusing; in summary, the embodiments of the present application solve the problem of low accuracy of the defocus amount of laser focusing obtained by using the existing defocus amount determination method in the face of an image scene with interference. Description of the Drawings

[0038] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the embodiments. Obviously, the following described drawings are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0039] Figure 1 It is a schematic flowchart of a defocus amount determination method provided by an embodiment of the present application;

[0040] Figure 2 It is a schematic diagram of dividing a target laser image according to a division rule provided by an embodiment of the present application;

[0041] Figure 3 Schematic diagram of functional modules of a defocus amount determination device provided in an embodiment of the present application;

[0042] Figure 4 Schematic diagram of the structure of a computer device provided in an embodiment of the present application. Detailed implementation manners

[0043] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.

[0044] To make the above objects, features, and advantages of the present application more obvious and understandable, the present application will be further described in detail below in conjunction with the accompanying drawings and specific implementation manners.

[0045] In an exemplary embodiment, as Figure 1 shown, a defocus amount determination method is provided, including the following steps 101 to 105. Among them:

[0046] Step 101, obtain a target laser image, where the target laser image refers to a laser image of a first target object obtained under actual focusing conditions.

[0047] In the embodiment of the present application, the first target object refers to an object that needs to be imaged by a target imaging system in the application scenario, and the target imaging system is an imaging system that needs to use a laser focusing system for focusing. For example, in a detection scenario (such as semiconductor detection, panel detection, etc.), the object to be detected is the first target object.

[0048] Step 102, divide the target laser image according to the division rule to obtain a plurality of first region images; where the division rule refers to dividing the image to be divided along the direction perpendicular to the laser line of the image to be divided.

[0049] In the embodiment of the present application, the plurality of first region images do not overlap each other, and each first region image includes at least one row of pixel points of the target laser image. The image to be divided can be divided according to the characteristics of the laser line in the image to be divided. The characteristics of the laser line include shape, brightness, etc. For example, the region where the converging laser lines in the image to be divided are located is divided into an image region, and the region where the diverging laser lines in the image to be divided are located is divided into an image region. Another example is to divide the regions where the laser lines with different brightnesses are located into different image regions. The image to be divided includes the target laser image. There is no specific limitation on the number of rows of pixel points included in each first region image, and it can be set according to actual needs. For example, asFigure 2 As shown, the target laser image obtained at a certain moment is divided into 5 first region images (labeled 1, 2, 3, 4, 5). Among them, the white line is the laser line, and the red line is the boundary line of the 5 first region images divided.

[0050] Step 103: Select the first region images with a confidence level not less than the first threshold according to the confidence level of each first region image to obtain the first target region images.

[0051] In the embodiment of the present application, the defocus amount refers to the distance difference between the actual focal position and the ideal focal position. The first threshold is obtained by debugging within the value range. Specifically, the defocus amounts of laser focusing under different first thresholds are obtained by using the method of the present application. After the laser focusing system performs laser focusing using the defocus amounts of laser focusing under different first thresholds, the imaging system is respectively used to obtain the target laser images, and the value of the first threshold corresponding to the clearest target laser image obtained is used in the embodiment of the present application. The confidence level of each first region image refers to the mean square deviation of the laser line width or pixel gray value of each first region image.

[0052] Step 104: Calculate the mean value of the defocus amounts of all the first target region images according to the defocus amount of each first target region image to obtain the first defocus amount mean value.

[0053] Step 105: Determine the defocus amount of laser focusing according to the first defocus amount mean value.

[0054] In the embodiment of the present application, the defocus amount of laser focusing refers to the defocus amount used for the laser focusing system to perform laser focusing.

[0055] Implement the above steps 101 to 105. By obtaining the target laser image and dividing the target laser image into several first region images according to the division rule, and selecting the first region images with a confidence level not less than a preset first threshold according to the confidence level of each first region image, so as to discard the first region images with a confidence level less than the first threshold and retain the first region images with a confidence level not less than the first threshold. A confidence level less than the first threshold means that the laser line of the first region image undergoes a large deformation, and a confidence level not less than the first threshold means that the laser line of the first region image does not undergo a large deformation. Therefore, compared with the original target laser image, the first region images with a confidence level not less than the first threshold retained after discarding the first region images with a confidence level less than the first threshold, that is, the first target region images, can accurately reflect the actual defocus state; by calculating the average defocus amount of all the first target region images according to the defocus amount of each first target region image to obtain the first average defocus amount, and determining the defocus amount of laser focusing according to the first average defocus amount, it is realized to determine the defocus amount of laser focusing by using the image region that can accurately reflect the actual defocus state, ensuring the accuracy of the determined defocus amount of laser focusing; in addition, determining the defocus amount of laser focusing according to the first average defocus amount can further avoid noise interference and further improve the accuracy of the determined defocus amount of laser focusing; in summary, the embodiment of the present application solves the problem that the accuracy of the defocus amount of laser focusing obtained by using the existing defocus amount determination method is low in the face of an image scene with interference.

[0056] Optionally, in other embodiments of the present application, the above defocus amount determination method further includes the following steps 201 to 202. Wherein:

[0057] Step 201, before step 104, calculate the defocus amount of each first region image.

[0058] Step 202, extract the defocus amount of each first target region image from the defocus amounts of the first region images.

[0059] In the embodiment of the present application, extracting the defocus amount of each first target region image from the defocus amounts of the first region images means extracting the defocus amounts of the first region images with a confidence level not greater than the first threshold from the defocus amounts of the first region images.

[0060] Optionally, in other embodiments of the present application, the above defocus amount determination method further includes:

[0061] Before step 104, calculate the defocus amount of each first target region image.

[0062] Optionally, in other embodiments of the present application, calculate the defocus amount of each first region image or first target region image according to the following steps 301 to 302. Wherein:

[0063] Step 301: Calculate the centroid of each sub-region image and the centroid of the second-region image corresponding to each sub-region image through the image centroid calculation method. Herein, the sub-region image includes the first-region image or the first target-region image, and the second-region image refers to the region image obtained by dividing the reference image according to the above division rule. The reference image refers to the laser image of the second target object obtained under ideal focusing conditions.

[0064] In the embodiment of the present application, the image to be divided in the division rule includes the reference image. The several second-region images do not overlap with each other, and each second-region image includes at least one row of pixel points of the target laser image. The size of the reference image and the target laser image and the division rule are the same. The divided first-region images and second-region images correspond one by one. "Corresponding one by one" means that the number of rows of pixel points included in the corresponding first-region image and second-region image and the position of each row of pixel points are the same. For example, if the sizes of the reference image and the target laser image are 300*430, and the target laser image is divided into 5 first-region images, the first first-region image includes the pixel points of the 1st to 60th rows of the target laser image, the second first-region image includes the pixel points of the 61st to 120th rows of the target laser image, the third first-region image includes the pixel points of the 121st to 180th rows of the target laser image, the fourth first-region image includes the pixel points of the 181st to 240th rows of the target laser image, and the fifth first-region image includes the pixel points of the 241st to 300th rows of the target laser image, then the reference image is also divided into 5 second-region images, and the first second-region image includes the pixel points of the 1st to 60th rows of the reference image, the second second-region image includes the pixel points of the 61st to 120th rows of the reference image, the third second-region image includes the pixel points of the 121st to 180th rows of the reference image, the fourth second-region image includes the pixel points of the 181st to 240th rows of the reference image, and the fifth second-region image includes the pixel points of the 241st to 300th rows of the reference image.

[0065] The second-region image corresponding to each first target-region image refers to the second-region image corresponding to each first-region image with a confidence level not less than the first threshold.

[0066] The second target object uses the first target object or a mirror with a flat surface. Preferably, a mirror with a flat surface is used because the shape of the laser line in the reference image obtained when using a mirror with a flat surface as the second target object is better than the shape of the laser line in the reference image obtained when using the first target object as the second target object.

[0067] By using the method for calculating the centroid of an image, calculate the centroid of each sub-region image and the centroid of the second region image corresponding to each sub-region image, that is, calculate the centroid of each sub-region image and the centroid of the second region image corresponding to each sub-region image by using the following formula:

[0068]

[0069] Wherein, is the abscissa of the centroid of the image, is the ordinate of the centroid of the image. The image includes each first target region image or its corresponding second region image. x and y are the abscissa and ordinate of a single pixel of the image, p(x, y) is the gray value of a single pixel of the image, W is the width of the image, H is the height of the image, and the units of W and H are the number of pixels.

[0070] Step 302: Calculate the difference between the centroid of each sub-region image and the centroid of the second region image corresponding thereto, to obtain the defocus amount of each sub-region image.

[0071] In the embodiment of the present application, calculating the difference between the centroid of each sub-region image and the centroid of the second region image corresponding thereto means calculating the difference between the centroid of each sub-region image and the centroid of the second region image corresponding to this sub-region image.

[0072] Optionally, in other embodiments of the present application, the above-mentioned determining the defocus amount of laser focusing according to the first average defocus amount includes:

[0073] Taking the first average defocus amount as the defocus amount of laser focusing.

[0074] Optionally, in other embodiments of the present application, the above-mentioned determining the defocus amount of laser focusing according to the first average defocus amount includes the following steps 401 to 403. Wherein:

[0075] Step 401: Select the first target region images whose difference between the defocus amount and the first average defocus amount is not greater than the second threshold, to obtain the second target region images.

[0076] In the embodiment of the present application, the second threshold is obtained by debugging within the value range. Specifically, the defocus amount of laser focusing under the same first threshold and different second thresholds is obtained by using the method of the present application. After the laser focusing system performs laser focusing by using the defocus amount of laser focusing under the same first threshold and different second thresholds, the imaging system is respectively used to obtain the target laser images, and the numerical value of the second threshold corresponding to the clearest target laser image obtained is used in the embodiment of the present application.

[0077] Step 402: Extract the defocus amount of each second target region image from the defocus amount of the first region image or the defocus amount of the first target region image.

[0078] In the embodiments of the present application, the defocus amount of each second target region image is extracted from the defocus amount of the first region image, that is, the defocus amount of the first region image with a confidence level not less than the first threshold and the difference between the defocus amount and the average value of the first defocus amount not greater than the second threshold is extracted from the defocus amount of the first region image. The defocus amount of each second target region image is extracted from the defocus amount of the first target region image, that is, the defocus amount of the first target region image with the difference between the defocus amount and the average value of the first defocus amount not greater than the second threshold is extracted from the defocus amount of the first target region image.

[0079] Step 403, according to the defocus amount of each second target region image, calculate the average value of the defocus amounts of all second target region images to obtain a second average defocus amount, and use the second average defocus amount as the defocus amount for laser focusing.

[0080] In the embodiments of the present application, by further discarding the first target region images with the difference between the defocus amount and the average value of the first defocus amount greater than the second threshold and retaining the first target region images with the difference between the defocus amount and the average value of the first defocus amount not greater than the second threshold, there is a certain deformation of the laser line in the first target region images with the difference between the defocus amount and the average value of the first defocus amount greater than the second threshold, while the laser line in the first target region images with the difference between the defocus amount and the average value of the first defocus amount not greater than the second threshold is basically not deformed. Compared with the first region images with a confidence level not less than the first threshold, the first target region images with the difference between the defocus amount and the average value of the first defocus amount not greater than the second threshold retained after discarding the first target region images with the difference between the defocus amount and the average value of the first defocus amount greater than the second threshold in the embodiments of the present application, that is, the second target region images, can more accurately reflect the actual defocus state. And by calculating the average value of the defocus amounts of all second target region images, a second average defocus amount is obtained, and the second average defocus amount is used as the defocus amount for laser focusing, so as to realize determining the defocus amount for laser focusing by using the image region that can more accurately reflect the actual defocus state, and further ensure the accuracy of the determined defocus amount for laser focusing; in addition, determining the defocus amount for laser focusing according to the second average defocus amount can further avoid noise interference and further improve the accuracy of the determined defocus amount for laser focusing.

[0081] Optionally, in other embodiments of the present application, the above-mentioned division of the divided image along the direction of the laser line perpendicular to the divided image includes the following steps 501 to 503. Among them:

[0082] Step 501, preprocess the divided image.

[0083] In the embodiments of the present application, the divided image includes a target laser image or a reference image, and the preprocessing includes steps such as grayscale conversion and filtering to reduce noise and enhance laser line features.

[0084] Step 502: Identify the edges of the laser line in the pre-processed divided image through an edge detection algorithm, and extract the boundaries on both sides of the laser line.

[0085] In the embodiment of the present application, by identifying the boundaries on both sides of the laser line in the pre-processed divided image along its length direction, the position of the laser line can be determined.

[0086] Step 503: According to the boundaries on both sides of the laser line, divide the divided image into several slices in the direction perpendicular to the laser line, and each slice is a first region image or a second region image.

[0087] Optionally, in other embodiments of the present application, the above defocus amount determination method further includes:

[0088] Before step 102, calculate the confidence of each first region image.

[0089] In the embodiment of the present application, the confidence of each first region image is the mean square deviation of the pixel gray values of each first region image or the laser line width of the first region image. The mean square deviation of the pixel gray values of each first region image is the average of the sum of the squares of the differences between the gray values of all pixel points in each first region image and the average gray value of the first region image. The consistency of the gray values inside the laser line and the clarity of the boundary can be understood according to the change of the mean square deviation. Generally speaking, the narrower the laser line and the higher the contrast, the more drastic the gray change at its boundary, and the higher the mean square deviation.

[0090] Optionally, in other embodiments of the present application, in order to improve the accuracy of the confidence, the laser line width of each first region image is calculated according to the following steps 601 to 603. Wherein:

[0091] Step 601: According to the boundaries on both sides of the laser line of each first region image, perform binarization processing on each first region image to obtain a binary image.

[0092] Step 602: Perform connected component analysis on each binary image, find all connected regions of each binary image, and identify the connected region representing the laser line from them.

[0093] Step 603: Measure the width of the connected region representing the laser line in each binary image to obtain the laser line width of each first region image.

[0094] In the embodiments of the present application, the laser line width can be measured in various ways. For example, the contour extraction method can be used to extract the contour of the laser line from the connected region representing the laser line, and then the distance between two corresponding points on the contour can be calculated to estimate the line width. Another example is to use a pixel-based method. For each pixel row perpendicular to the laser line direction, the number of pixels belonging to the laser line within it is counted, and the maximum or average value of these numbers can be regarded as the line width.

[0095] Optionally, in other embodiments of the present application, the above defocus amount determination method further includes:

[0096] Determine the focusing data according to the defocus amount of the laser focusing;

[0097] Control the laser focusing system to perform laser focusing according to the focusing data.

[0098] In the embodiments of the present application, controlling the laser focusing system to perform laser focusing according to the focusing data means controlling the mechanical device (such as a motor) of the laser focusing system to move the lens to an appropriate position according to the focusing data to complete the automatic focusing process.

[0099] Based on the same inventive concept, the embodiments of the present application also provide a defocus amount determination device for implementing the above-mentioned defocus amount determination method. The solution provided by this device to solve the problem is similar to the solution described in the above method. Therefore, the specific limitations in one or more embodiments of the defocus amount determination device provided below can refer to the limitations on the defocus amount determination method in the above text, and will not be repeated here.

[0100] In an exemplary embodiment, as Figure 3 shown, a defocus amount determination device 80 is provided, including:

[0101] An acquisition module 801, configured to acquire a target laser image, where the target laser image refers to a laser image of a target object acquired under actual focusing conditions;

[0102] A processing module 802, configured to divide the target laser image according to a division rule to obtain a plurality of first region images; where the division rule refers to dividing the image to be divided along the direction perpendicular to the laser line of the image to be divided;

[0103] Select the first region images with a confidence level not less than a first threshold according to the confidence level of each first region image to obtain first target region images; where the confidence level of each first region image refers to the laser line width of each first region image;

[0104] Calculate the mean defocus amount of all the first target region images according to the defocus amount of each first target region image to obtain a first mean defocus amount;

[0105] Determine the defocus amount of laser focusing according to the average value of the first defocus amount.

[0106] Optionally, in other embodiments of the present application, the above processing module 802 is further configured to calculate the defocus amount of each first region image before calculating the average value of the defocus amounts of all first target region images according to the defocus amount of each first target region image;

[0107] Extract the defocus amount of each first target region image from the defocus amounts of the first region images.

[0108] Optionally, in other embodiments of the present application, the above processing module 802 is further configured to calculate the defocus amount of each first target region image before calculating the average value of the defocus amounts of all first target region images according to the defocus amount of each first target region image.

[0109] Optionally, in other embodiments of the present application, the above processing module 802 is further configured to calculate the defocus amount of each first region image or first target region image according to the following steps:

[0110] Calculate the center of gravity of each sub-region image and the center of gravity of the second region image corresponding to each sub-region image through the image center-of-gravity calculation method; wherein, the sub-region image includes the first region image or the first target region image, and the second region image refers to the region image obtained by dividing the reference image according to the above division rule, and the reference image refers to the laser image of the target object obtained under ideal focusing conditions;

[0111] Calculate the difference between the center of gravity of each sub-region image and the center of gravity of the second region image corresponding to it to obtain the defocus amount of each sub-region image.

[0112] In the embodiments of the present application, the relevant introduction of the steps of calculating the center of gravity of each sub-region image and the center of gravity of the second region image corresponding to each sub-region image through the image center-of-gravity calculation method can be found in the description of the above method embodiments, and will not be repeated here.

[0113] Optionally, in other embodiments of the present application, the above processing module 802 is further configured to use the average value of the first defocus amount as the defocus amount of laser focusing.

[0114] Optionally, in other embodiments of the present application, the above processing module 802 is further configured to select the first target region images whose difference between the defocus amount and the average value of the first defocus amount is not greater than the second threshold to obtain the second target region images;

[0115] Extract the defocus amount of each second target region image from the defocus amounts of the first region images or the first target region images;

[0116] Calculate the average defocus amount of all the second target area images according to the defocus amount of each second target area image, obtain the second average defocus amount, and use the second average defocus amount as the defocus amount for laser focusing.

[0117] Optionally, in other embodiments of the present application, the above processing module 802 is further configured to preprocess the divided image, where the divided image includes a target laser image or a reference image;

[0118] Identify the edges of the laser line in the preprocessed divided image through an edge detection algorithm, and extract the boundaries on both sides of the laser line;

[0119] According to the boundaries on both sides of the laser line, divide the divided image into several slices in a direction perpendicular to the laser line, and each slice is a first area image or a second area image.

[0120] In the embodiments of the present application, the preprocessing includes steps such as grayscale conversion and filtering to reduce noise and enhance the laser line features. Identifying the boundaries on both sides of the laser line in the preprocessed divided image along its length direction can determine the position of the laser line.

[0121] Optionally, in other embodiments of the present application, the above processing module 802 is further configured to calculate the confidence of each first area image before dividing the target laser image according to the division rule to obtain several first area images.

[0122] Optionally, in other embodiments of the present application, the above processing module 802 is further configured to calculate the laser line width of each first area image according to the following steps:

[0123] Perform binary processing on each first area image according to the boundaries on both sides of the laser line in each first area image to obtain a binary image;

[0124] Perform connected component analysis on each binary image, find all connected regions of each binary image, and identify the connected region representing the laser line from them;

[0125] Measure the width of the connected region representing the laser line in each binary image to obtain the laser line width of each first area image.

[0126] Optionally, in other embodiments of the present application, the above processing module 802 is further configured to determine the focusing data according to the defocus amount of laser focusing.

[0127] Optionally, in other embodiments of the present application, the above defocus amount determination device 80 further includes:

[0128] A data communication module 803 for sending the focusing data;

[0129] The control module 804 is configured to control the laser focusing system to perform laser focusing according to the received focusing data. For the relevant description, please refer to the description in the above method embodiments and will not be elaborated here.

[0130] In an exemplary embodiment, a computer device is provided. The computer device can be a server or a terminal, and its internal structure diagram can be as Figure 4 shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O), and a communication interface. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data of the defocus amount determination method. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, it implements a defocus amount determination method.

[0131] Those skilled in the art can understand that Figure 4 the structure shown in

[0132] In an exemplary embodiment, a computer device is further provided, including a memory and a processor. A computer program is stored in the memory, and when the processor executes the computer program, the steps in the above method embodiments are implemented.

[0133] In an exemplary embodiment, a computer-readable storage medium is provided, storing a computer program, and when the computer program is executed by the processor, the steps in the above method embodiments are implemented.

[0134] In an exemplary embodiment, a computer program product is provided, including a computer program, and when the computer program is executed by the processor, the steps in the above method embodiments are implemented.

[0135] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data need to comply with relevant regulations.

[0136] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memories. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.

[0137] The databases involved in the embodiments provided in this application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in this application can be general-purpose processors, central processors, graphics processors, digital signal processors, programmable logic devices, data processing logics based on quantum computing, etc., without limitation.

[0138] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope described in this specification.

[0139] In this article, specific examples are used to elaborate on the principles and implementation manners of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application; at the same time, for those of ordinary skill in the art, according to the idea of the present application, there will be changes in the specific implementation manners and application scopes. In summary, the content of this specification should not be construed as a limitation to the present application.

Claims

1. A method for determining a defocus amount, characterized in that: The method for determining the defocus amount comprises: Acquire a target laser image; wherein the target laser image refers to a laser image of a first target object acquired under actual focusing conditions; The target laser image is divided according to a division rule to obtain a plurality of first region images; wherein the division rule refers to dividing the divided image along a laser line direction perpendicular to the divided image; According to the confidence of each of the first region images, a first region image whose confidence is not less than a first threshold is selected to obtain a first target region image; Calculating a defocus amount average of all the first target area images according to the defocus amount of each first target area image to obtain a first defocus amount average; The defocus amount of laser focusing is determined according to the first defocus amount average value.

2. The method for determining the defocus amount according to claim 1, characterized in that: Also includes: Before calculating the defocus amount average of all the first target area images according to the defocus amount of each first target area image, calculating the defocus amount of each first area image; The defocus amount of each of the first target area images is extracted from the defocus amount of the first area image.

3. The method for determining the defocus amount according to claim 1, characterized in that: Also includes: Before calculating the average of the defocus amounts of all the first target area images according to the defocus amount of each first target area image, the defocus amount of each first target area image is calculated.

4. The method for determining the defocus amount according to claim 1, characterized in that: The step of determining the defocus amount of laser focusing according to the first defocus amount mean value specifically includes: The first defocus amount average value is used as the defocus amount of the laser focusing.

5. The method for determining the defocus amount according to claim 1, characterized in that: The step of determining the defocus amount of laser focusing according to the first defocus amount mean value specifically includes: Selecting a first target area image whose difference between the defocus amount and the first defocus amount mean is not greater than a second threshold value to obtain a second target area image; Extracting the defocus amount of each of the second target area images from the defocus amount of the first area image or the defocus amount of the first target area image; According to the defocus amount of each second target area image, the average defocus amount of all the second target area images is calculated to obtain a second defocus amount average, and the second defocus amount average is used as the defocus amount of the laser focusing.

6. The method for determining the defocus amount according to claim 1, characterized in that: The defocus amount of each of the first region images or the first target region images is calculated according to the following steps: The centroid of each sub-region image and the centroid of the second region image corresponding to each sub-region image are calculated by an image centroid calculation method; wherein the sub-region image includes a first region image or a first target region image, the second region image refers to a region image obtained by dividing a reference image according to the division rule, and the reference image refers to a laser image of the second target object acquired under ideal focus conditions; The difference between the center of gravity of each sub-region image and the corresponding second region image is calculated to obtain the defocus amount of each sub-region image.

7. The method for determining the defocus amount according to claim 1, characterized in that: Also includes: Before selecting a first area image whose confidence is not less than a first threshold according to the confidence of each first area image, the confidence of each first area image is calculated; wherein the confidence of each first area image is the mean square error of the pixel grayscale values ​​of each first area image or the laser line width of the first area image.

8. A device for determining a defocus amount, characterized in that: The defocus amount determining device comprises: An acquisition module, used to acquire a target laser image, wherein the target laser image refers to a laser image of a target object acquired under actual focusing conditions; A processing module, used for dividing the target laser image according to a division rule to obtain a plurality of first region images; wherein the division rule refers to dividing the divided image along a laser line direction perpendicular to the divided image; According to the confidence of each first region image, a first region image whose confidence is not less than a first threshold is selected to obtain a first target region image; wherein the confidence of each first region image refers to the laser line width of each first region image; Calculating a defocus amount average of all the first target area images according to the defocus amount of each first target area image to obtain a first defocus amount average; The defocus amount of laser focusing is determined according to the first defocus amount average value.

9. A computer device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the method for determining the defocus amount according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for determining the defocus amount according to any one of claims 1 to 7 are implemented.