A scanner depth of field detection method and device, electronic equipment and storage medium

CN122802629APending Publication Date: 2026-09-22SHINING 3D TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610931902.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-25
Publication Date
2026-09-22

AI Technical Summary

Benefits of technology

[0009]本公开实施例提供的技术方案与现有技术相比具有如下优点:

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122802629A_ABST
    Figure CN122802629A_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure relate to a scanner depth of field detection method and device, electronic equipment and storage medium, wherein the method comprises: in response to a depth of field detection instruction, controlling the scanner to project a preset depth of field detection image to a scanned object, based on the preset depth of field detection image reflected by the scanned object, obtaining a depth of field gray scale image collected by the scanner, and based on the depth of field gray scale image, performing depth of field detection on the scanner to obtain a depth of field detection result. Thus, the depth of field detection is performed based on the depth of field gray scale image collected by the scanner, so that the depth of field detection result of the scanner can be quickly and accurately obtained, and the efficiency and effect of the depth of field detection of the scanner are further improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of scanner technology, and in particular to a scanner depth detection method, apparatus, electronic device and storage medium. Background Technology

[0002] Typically, in real-world scanner applications, such as high-precision 3D reconstruction, the focus is on synchronized, clear imaging from binocular cameras. Therefore, it is necessary to ensure that the depth of field of the left and right cameras of the scanner is consistent, thereby guaranteeing synchronized, clear imaging from the binocular cameras and ultimately ensuring the accuracy of 3D reconstruction. Thus, depth detection of the scanner is required to obtain clear images and ensure the accuracy of 3D reconstruction. Summary of the Invention

[0003] To solve the above-mentioned technical problems, or at least partially solve them, this disclosure provides a scanner depth detection method, apparatus, electronic device, and storage medium.

[0004] This disclosure provides a depth detection method for a scanner, the method comprising: responding to a depth detection command, controlling the scanner to project a preset depth detection map onto a scanned object; acquiring a grayscale image of a depth scale based on the preset depth detection map reflected by the scanned object; and performing depth detection on the scanner based on the grayscale image of the depth scale to obtain a depth detection result.

[0005] This disclosure also provides a scanner depth detection device, comprising: a response control module, configured to control the scanner to project a preset depth detection image onto the object being scanned in response to a depth detection command; an acquisition module, configured to acquire a grayscale image of a depth scale captured by the scanner based on the preset depth detection image reflected by the object being scanned; and a detection module, configured to perform depth detection on the scanner based on the grayscale image of the depth scale to obtain a depth detection result.

[0006] This disclosure also provides an electronic device, the electronic device comprising: a processor; a memory for storing executable instructions of the processor; the processor being configured to read the executable instructions from the memory and execute the instructions to implement the scanner depth detection method as provided in this disclosure.

[0007] This disclosure also provides a computer-readable storage medium storing a computer program for performing the scanner depth detection method as provided in this disclosure.

[0008] This disclosure also provides a computer program product, including a computer program, wherein the computer program is executed by a processor as described in this disclosure, using a scanner depth detection method.

[0009] The technical solution provided in this disclosure has the following advantages compared with the prior art: The scanner depth detection scheme provided in this disclosure responds to a depth detection command by controlling the scanner to project a preset depth detection image onto the object being scanned. Based on the preset depth detection image reflected by the object, a grayscale image of a depth scale is acquired by the scanner. Depth detection is then performed on the scanner based on this grayscale image to obtain the depth detection result. Therefore, by performing depth detection using the grayscale image of the depth scale acquired by the scanner, the depth detection result can be obtained quickly and accurately, further improving the efficiency and effectiveness of scanner depth detection. Attached Figure Description

[0010] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.

[0011] Figure 1 A schematic flowchart of a scanner depth detection method provided in this embodiment of the present disclosure; Figure 2 A schematic flowchart of another scanner depth detection method provided in this embodiment of the present disclosure; Figure 3 A schematic flowchart illustrating yet another scanner depth detection method provided in this disclosure embodiment; Figure 4 A schematic flowchart illustrating another scanner depth detection method provided in this embodiment of the present disclosure; Figure 5 A schematic diagram of a black and white line image relative to a depth scale provided in an embodiment of this disclosure; Figure 6 A schematic diagram of grayscale distribution provided for embodiments of this disclosure; Figure 7 A schematic diagram of the gradient distribution provided in an embodiment of this disclosure; Figure 8 This is a schematic diagram of the structure of a scanner depth detection device provided in an embodiment of the present disclosure; Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. Detailed Implementation

[0012] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.

[0013] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.

[0014] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.

[0015] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.

[0016] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".

[0017] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.

[0018] To address the aforementioned problems, this disclosure provides a scanner depth detection method, which is described below with reference to specific embodiments. In this method, a scanner projects a preset depth detection image onto the object being scanned. Based on the preset depth detection image reflected by the object, a grayscale image of a depth scale is acquired by the scanner. Depth detection is then performed on the scanner based on this grayscale image to obtain the depth detection result. This method enables rapid and accurate acquisition of the scanner's depth detection results, further improving the efficiency and effectiveness of scanner depth detection.

[0019] The scanner depth detection method of this disclosure is applicable to 3D scanners such as dental scanners, facial scanners, industrial scanners, professional scanners, handheld scanners, and fixed scanners. It can realize 3D reconstruction of objects or scenes such as teeth, faces, bodies, industrial products, industrial equipment, cultural relics, artworks, prostheses, medical devices, and buildings. The electronic device can be understood by way of example as a 3D scanner, mobile phone, tablet computer, laptop computer, desktop computer, smart TV, etc.

[0020] Figure 1 This is a flowchart illustrating a scanner depth detection method according to an embodiment of the present disclosure. This method can be executed by a scanner depth detection device, which can be implemented in software and / or hardware, and is generally integrated into an electronic device. Figure 1 As shown, the method includes: Step 101: In response to the depth detection command, control the scanner to project a preset depth detection map onto the object being scanned.

[0021] In this embodiment of the disclosure, responding to a depth detection command from a scanner can be understood as receiving and responding to a depth detection command from the scanner. A calibration command can be triggered according to the actual application scenario requirements. As an example scenario, the scanner's camera needs to acquire a clear image, so a depth detection command is triggered through a preset button or preset control on the scanner control software, thereby responding to the depth detection command.

[0022] As another example scenario, a depth detection command is triggered when the scanner's camera detects that the image quality does not meet the preset image quality conditions, and / or, the depth position error of at least two cameras is greater than a preset error threshold, and / or, the reconstruction error based on the scan data is greater than a preset reconstruction threshold.

[0023] Image quality refers to the quality of images captured by the camera on the scanner. Image quality can be determined by image parameters such as resolution and pixel density. Preset image quality conditions can be preset resolution thresholds, pixel density thresholds, etc. For example, if the resolution of an image is greater than the preset resolution threshold, the image is determined to meet the preset image quality conditions; otherwise, the image is determined not to meet the preset image quality conditions, thereby automatically triggering a depth detection command.

[0024] The depth-of-field position error of at least two cameras is used to represent the depth-of-field matching degree between at least two cameras. It can be understood that the larger the depth-of-field position error, the worse the depth-of-field matching degree between at least two cameras. When the depth-of-field position error is greater than a preset error threshold, it is determined that the depth-of-field position of the camera needs to be re-determined. Therefore, when the depth-of-field position error is greater than the preset error threshold, the depth-of-field detection command is automatically triggered.

[0025] Among them, the reconstruction error based on scan data refers to the 3D reconstruction result obtained by performing 3D reconstruction based on the scan data acquired by the scanner. The 3D reconstruction result refers to the deviation value between the reconstructed model and the actual model, such as the root mean square error. When the reconstruction error is greater than the preset reconstruction threshold, it is determined that the depth position of the camera needs to be re-determined. Therefore, when the reconstruction error is greater than the preset reconstruction threshold, the depth detection command is automatically triggered.

[0026] In this embodiment of the present disclosure, after responding to the depth detection command, the scanner is controlled to project a preset depth detection image onto the object being scanned; wherein, the preset depth detection image refers to a black and white stripe image, which can be an image composed of multiple black and white lines of different densities; the object being scanned can be the object to be scanned or other preset objects, and the specific settings are selected according to the actual application scenario.

[0027] Specifically, in response to a depth detection command, the projector controls the scanner to project a preset depth detection map onto the object being scanned.

[0028] Step 102: Based on the preset depth detection map of the reflected object, acquire the grayscale image of the depth scale collected by the scanner.

[0029] In this embodiment of the disclosure, after the scanner projects a preset depth detection map onto the object being scanned, a grayscale image of the depth scale is obtained by capturing the preset depth detection map reflected by the object being scanned.

[0030] In this embodiment of the disclosure, a grayscale image of the depth scale corresponding to the target format of the camera on the scanner can be directly acquired, or a color image of the depth scale corresponding to the camera on the scanner can be acquired, and the color image of the depth scale can be converted into a grayscale image of the depth scale in the target format; wherein, the target format can be an 8-bit grayscale bitmap; in some embodiments, a standard black and white wide line pair is used as a preset depth detection map, the camera is moved along the optical axis, and images are acquired position by position to obtain a grayscale image or a color image of the depth scale.

[0031] It should be noted that the scanner can have one or more cameras to further meet different application scenarios and improve the user experience.

[0032] Step 103: Perform depth detection on the scanner based on the grayscale image of the depth scale to obtain the depth detection result.

[0033] The depth detection result refers to whether the depth detection passed or failed.

[0034] In this embodiment of the disclosure, depth detection is performed on the scanner based on the grayscale image of the depth scale. There are many ways to obtain the depth detection result, and different depth detection methods can be selected for different scanners. As an example, the scanner includes at least two cameras. Based on the grayscale image of the depth scale, grayscale projection curves and target depth positions are obtained. If the overlap of the grayscale projection curves between all cameras is greater than or equal to a preset overlap threshold and the position error of the target depth position is less than a preset error threshold, the depth detection is determined to be passed as the depth detection result. If the overlap of the grayscale projection curves between any two cameras is less than the preset overlap threshold, or the position error of the target depth position between any two cameras is greater than or equal to the preset error threshold, the depth detection is determined to be failed as the depth detection result.

[0035] As another example, the scanner includes at least one camera, which acquires a grayscale projection curve based on a grayscale image of a depth scale. If the target depth position is obtained based on the grayscale projection curve, the depth detection is determined to be passed as the depth detection result. If the target depth position cannot be obtained based on the grayscale projection curve, the depth detection is determined to be passed as the depth detection result.

[0036] In this embodiment of the disclosure, the depth detection result is "depth detection passed", which means that the scanner can acquire a clear image. The scanner can issue a first prompt message, such as "depth detection passed", to control the scanner to enter the scanning mode, or directly control the scanner to switch to the scanning mode for scanning, thereby further improving the flexibility of control.

[0037] In this embodiment of the disclosure, if the depth detection result is "depth detection fails", it means that the scanner cannot obtain a clear image, which may affect the scanning results of the scanner and thus affect the results of 3D reconstruction, etc. A second prompt message can be issued to prompt the user to refocus or prompt the user to return to the factory or the manufacturer to replace the lens, or directly control the scanner to perform a focusing operation, thereby further improving the flexibility of control.

[0038] In summary, the scanner depth detection method of this disclosure, in response to a depth detection command, controls the scanner to project a preset depth detection image onto the object being scanned. Based on the preset depth detection image reflected by the object being scanned, a grayscale image of a depth scale is acquired by the scanner. Depth detection is then performed on the scanner based on the grayscale image of the depth scale to obtain the depth detection result. Therefore, by performing depth detection using the grayscale image of the depth scale acquired by the scanner, the depth detection result of the scanner can be obtained quickly and accurately, further improving the efficiency and effectiveness of scanner depth detection.

[0039] Based on the foregoing description, the depth detection results obtained by scanning a scanner using a depth scale grayscale image can be processed in different ways according to the needs of the actual application scenario. See details below. Figure 2 The scanner is described in detail, including depth detection scenarios in at least two camera scenes, and see [link / reference]. Figure 3 The scanner is described in detail as including at least one depth detection scene in a camera scene.

[0040] Figure 2 This is a flowchart illustrating another scanner depth detection method provided in an embodiment of the present disclosure, as shown below. Figure 2 As shown, the method includes: Step 201: Obtain the grayscale projection curve and target depth position based on the grayscale image of the depth scale.

[0041] In this embodiment, the black and white stripe region corresponding to the grayscale image of the depth scale is determined. The black and white stripe region refers to the alternating black and white region including the target depth of field position. Gradient calculation is performed on the black and white stripe region according to a preset dimension to obtain a grayscale projection curve. The fitting center point is determined based on the grayscale projection curve, and multiple candidate fitting points are determined with the fitting center point as the center based on a preset symmetry rule. Multiple candidate fitting points are fitted based on multiple preset fitting models to obtain multiple fitting curves. The target fitting curve is determined from the multiple fitting curves, and the target depth of field position is determined based on the target fitting curve. The target depth of field position is used to instruct the camera to perform focusing processing.

[0042] In this embodiment of the disclosure, the black and white striped area refers to the gray-scale transition area at the boundary between the black and white areas in the grayscale image of the depth scale. The gray level of the black area is around 0, and the gray level of the white area is 255. The gradient peak is obvious at the boundary between the two areas. Therefore, the target depth of field position is determined from the black and white striped area. The target depth of field position refers to the optimal focus position. The target depth of field position is used to instruct the camera to perform focusing processing.

[0043] In this embodiment of the disclosure, there are many ways to determine the black and white stripe region corresponding to the grayscale image of the depth scale. It can be determined by direct gradient value or edge gradient value. In some embodiments, the grayscale image of the depth scale is divided into multiple image regions, and the grayscale average value of each image region is calculated to obtain multiple grayscale average values. Based on the difference calculation of adjacent grayscale average values ​​among the multiple grayscale average values, multiple grayscale gradient values ​​are obtained. The black and white stripe region is determined based on the multiple grayscale gradient values ​​and a preset grayscale gradient threshold.

[0044] In other embodiments, the depth-of-field scale grayscale image is divided into multiple image regions. The grayscale value corresponding to each image region is calculated according to a preset edge gradient formula to obtain a spatial gradient value for each image region. Based on the spatial gradient value corresponding to each image region, an average edge intensity is calculated to obtain multiple average edge intensity values. Based on the difference between adjacent average edge intensity values ​​among the multiple average edge intensity values, multiple edge gradient values ​​are obtained. The black and white stripe regions are determined based on the multiple edge gradient values ​​and a preset edge gradient threshold. The above two methods are merely examples of determining the black and white stripe regions corresponding to the depth-of-field scale grayscale image. This disclosure does not impose specific limitations on the implementation method of determining the black and white stripe regions corresponding to the depth-of-field scale grayscale image.

[0045] Therefore, by determining the black and white stripe area and then processing it to determine the optimal focus position, background interference can be eliminated, and the processing accuracy can be further improved. In some embodiments, after obtaining the black and white stripe area, Gaussian filtering can be used to remove noise from the black and white stripe area while fully preserving the stripe edge information, avoiding noise interference problems when processing based on the black and white stripe area in the future, and further improving the accuracy of subsequent processing.

[0046] Furthermore, gradient calculations are performed on the black and white striped regions according to a preset dimension to obtain the grayscale projection curve.

[0047] Specifically, in some embodiments, the black and white striped area is divided into multiple regions, for example, by dividing the region according to each column of gray values, calculating the mean gray value of each column to obtain multiple gray average values, and performing difference calculation based on adjacent gray average values ​​among the multiple gray average values ​​to obtain a gray-scale projection curve; in other embodiments, the black and white striped area is divided into multiple regions, for example, by dividing the region according to each column of gray values ​​or a preset number of rows and columns, calculating the spatial gradient value corresponding to each region, and then performing average edge intensity calculation to obtain multiple average edge intensity values, and performing difference calculation based on the average edge intensity values ​​among the multiple average edge intensity values ​​to obtain a gray-scale projection curve.

[0048] Furthermore, the fitting center point is determined based on the grayscale projection curve, and multiple candidate fitting points are determined with the fitting center point as the center based on the preset symmetry rules.

[0049] In this embodiment of the disclosure, the fitting center point refers to determining a center position point from the black and white stripe area, and fitting the curve using this center position point.

[0050] In this embodiment of the disclosure, there are many ways to determine the fitting center point based on the grayscale projection curve. The maximum gradient maxima in the grayscale projection curve can be used as the fitting center point. The maximum gradient maxima can be a direct gradient maxima, i.e., a grayscale gradient maxima, or an edge gradient maxima. The specific choice and setting depends on the actual application scenario.

[0051] In some embodiments, multiple gray-level gradient values ​​corresponding to the gray-level projection curve are obtained, at least one gray-level gradient maxima is obtained based on the multiple gray-level gradient values, and the maximum gradient maxima is used as the fitting center point; in another embodiment, multiple edge gradient values ​​corresponding to the gray-level projection curve are obtained, at least one edge gradient maxima is obtained based on the multiple edge gradient values, and the maximum edge gradient maxima is used as the fitting center point. The above two methods are merely examples of determining the fitting center point based on the gray-level projection curve, and the embodiments of this disclosure do not impose specific limitations on the implementation method of determining the fitting center point based on the gray-level projection curve.

[0052] Furthermore, after determining the fitting center point, multiple candidate fitting points are determined based on a preset symmetry rule with the fitting center point as the center. Specifically, with the fitting center point as the center, an equal number of peak points (which can be gray-level gradient maxima or edge gradient maxima) are selected symmetrically on both sides as multiple candidate fitting points to ensure that the fitting data is distributed around the true peak and to suppress positioning offset. The specific number is selected and set according to the actual application scenario, and this embodiment does not impose specific limitations.

[0053] Furthermore, multiple candidate fitting points are fitted based on multiple preset fitting models to obtain multiple fitting curves, and a target fitting curve is determined from the multiple fitting curves, and a target depth of field position is determined based on the target fitting curve; wherein, the target depth of field position is used to instruct the camera to focus and shoot.

[0054] In this embodiment of the disclosure, the preset multiple fitting models may include Gaussian fitting models, quadratic polynomial fitting models, etc., and the specific model is selected and set according to the actual application scenario.

[0055] In this embodiment of the disclosure, different fitting models fit multiple candidate fitting points to obtain different fitting curves. In other words, the number of fitting models corresponds to the number of fitting curves.

[0056] Furthermore, after obtaining multiple fitted curves, a target fitted curve is determined from the multiple fitted curves to determine the target depth of field position. Specifically, the error value corresponding to each fitted curve, such as the root mean square error, is calculated, and the fitted curve corresponding to the minimum error value is taken as the target fitted curve.

[0057] Furthermore, the target depth-of-field position is determined based on the target fitting curve; the target depth-of-field position is used to instruct the camera to perform focusing processing. That is, after determining the target depth-of-field position, controlling the target depth-of-field position to be aligned with the preset position can achieve optimal focusing; the preset position is used to represent the target focus position, and can also mark the front and rear boundary positions of the depth of field. After controlling the target depth-of-field position to be aligned with the preset position, the camera achieves optimal focusing and captures the image with the highest resolution.

[0058] In this embodiment of the disclosure, there are many ways to determine the target depth of field position based on the target fitting curve. One method is to obtain the position point corresponding to the minimum root mean square error value in the target fitting curve as the target depth of field position; another method is to obtain the position point corresponding to the minimum residual value in the target fitting curve as the target depth of field position. The specific method can be selected and set according to the actual application scenario.

[0059] Therefore, by determining the fitting center point and symmetrically selecting the data fitting curve, the validity of the fitting data is ensured, and unilateral data offset is avoided. Furthermore, by fitting multiple models with multiple fitting curves to determine the final fitting curve, the target depth position is determined, thereby further improving the detection stability.

[0060] Step 202: Based on the grayscale projection curve, the target depth position is obtained. If the overlap of the grayscale projection curves between all cameras is greater than or equal to a preset overlap threshold and the position error of the target depth position is less than a preset error threshold, the depth detection is determined to be passed as the depth detection result.

[0061] Step 203: If the overlap of the grayscale projection curves between any two cameras is less than a preset overlap threshold, or if the positional error of the target depth of field between any two cameras is greater than or equal to a preset error threshold, the depth of field detection is determined to fail as the depth of field detection result.

[0062] In this embodiment, if the overlap of the grayscale projection curves between all cameras is greater than or equal to a preset overlap threshold and the position error of the target depth of field is less than a preset error threshold, it means that the depth of field ranges between all cameras are highly overlapping and the sharp point is consistently located. Thus, even under complex conditions such as uneven lighting, near-bright and far-dark, and stripe distortion, it can still stably output accurate peak values ​​without obvious flat-top effects and positioning offsets, further improving the depth of field detection effect and efficiency.

[0063] In summary, the depth-of-field detection method of this disclosure obtains the grayscale projection curve and the target depth-of-field position based on the grayscale image of the depth scale. The target depth-of-field position is obtained based on the grayscale projection curve. When the overlap of the grayscale projection curves between all cameras is greater than or equal to a preset overlap threshold and the positional error of the target depth-of-field position is less than a preset error threshold, the depth-of-field detection is deemed successful as the depth-of-field detection result. In this technical solution, the fact that the overlap of the grayscale projection curves between all cameras is greater than or equal to a preset overlap threshold and the positional error of the target depth-of-field position is less than a preset error threshold indicates that the depth-of-field ranges of all cameras highly overlap and the sharp point is consistently located. Therefore, even under complex conditions such as uneven lighting, near-bright and far-dark conditions, and fringe distortion, it can still stably output accurate peak values ​​without significant flat-top effects or positioning offsets, further improving the depth-of-field detection effect and efficiency.

[0064] Figure 3 This is a flowchart illustrating another scanner depth detection method provided in an embodiment of the present disclosure, as shown below. Figure 3 As shown, the method includes: Step 301: Obtain the grayscale projection curve based on the grayscale image of the depth scale.

[0065] In this embodiment of the disclosure, the black and white stripe region corresponding to the grayscale image of the depth scale is determined, and the gradient is calculated based on the black and white stripe region according to a preset dimension to obtain the grayscale projection curve.

[0066] There are many ways to determine the black and white stripe regions corresponding to the grayscale image of the depth scale. They can be determined by direct gradient values ​​or edge gradient values. In some embodiments, the grayscale image of the depth scale is divided into multiple image regions, and the grayscale average value of each image region is calculated to obtain multiple grayscale average values. Based on the difference calculation of adjacent grayscale average values ​​among the multiple grayscale average values, multiple grayscale gradient values ​​are obtained. The black and white stripe regions are determined based on the multiple grayscale gradient values ​​and a preset grayscale gradient threshold.

[0067] In other embodiments, the depth-of-field scale grayscale image is divided into multiple image regions. The grayscale value corresponding to each image region is calculated according to a preset edge gradient formula to obtain a spatial gradient value for each image region. Based on the spatial gradient value corresponding to each image region, an average edge intensity is calculated to obtain multiple average edge intensity values. Based on the difference between adjacent average edge intensity values ​​among the multiple average edge intensity values, multiple edge gradient values ​​are obtained. The black and white stripe regions are determined based on the multiple edge gradient values ​​and a preset edge gradient threshold. The above two methods are merely examples of determining the black and white stripe regions corresponding to the depth-of-field scale grayscale image. This disclosure does not impose specific limitations on the implementation method of determining the black and white stripe regions corresponding to the depth-of-field scale grayscale image.

[0068] Furthermore, gradient calculations are performed on the black and white striped regions according to a preset dimension to obtain the grayscale projection curve.

[0069] Specifically, in some embodiments, the black and white striped area is divided into multiple regions, for example, by dividing the region according to each column of gray values, calculating the mean gray value of each column to obtain multiple gray average values, and performing difference calculation based on adjacent gray average values ​​among the multiple gray average values ​​to obtain a gray-scale projection curve; in other embodiments, the black and white striped area is divided into multiple regions, for example, by dividing the region according to each column of gray values ​​or a preset number of rows and columns, calculating the spatial gradient value corresponding to each region, and then performing average edge intensity calculation to obtain multiple average edge intensity values, and performing difference calculation based on the average edge intensity values ​​among the multiple average edge intensity values ​​to obtain a gray-scale projection curve.

[0070] Step 302: After obtaining the target depth position based on the grayscale projection curve, determine the depth detection pass as the depth detection result.

[0071] Step 303: If the target depth position cannot be obtained based on the grayscale projection curve, determine that the depth detection has passed as the depth detection result.

[0072] Furthermore, the fitting center point is determined based on the grayscale projection curve, and multiple candidate fitting points are determined with the fitting center point as the center based on the preset symmetry rule. Multiple candidate fitting points are fitted based on multiple preset fitting models to obtain multiple fitting curves. The target fitting curve is determined from the multiple fitting curves, and the target depth of field position is determined based on the target fitting curve. The target depth of field position is used to instruct the camera to perform focusing processing.

[0073] Specifically, if the target depth position is obtained based on the grayscale projection curve, the depth detection is considered successful as the depth detection result; if the target depth position cannot be obtained based on the grayscale projection curve, the depth detection is considered successful as the depth detection result.

[0074] In summary, the scanner depth detection method of this disclosure obtains a grayscale projection curve based on a grayscale image of a depth scale. If the target depth position is obtained based on the grayscale projection curve, the depth detection is deemed successful as the depth detection result. If the target depth position cannot be obtained based on the grayscale projection curve, the depth detection is also deemed successful as the depth detection result. In this technical solution, by determining the depth detection result based on whether the target depth position is obtained from the grayscale projection curve, the depth detection effect and efficiency are further improved.

[0075] Figure 4 This is a flowchart illustrating another scanner depth detection method provided in an embodiment of the present disclosure, as shown below. Figure 4 As shown, the method includes: Step 401: In response to the depth detection command, control the scanner to project a preset depth detection map onto the object being scanned, and acquire the grayscale image of the depth scale captured by the scanner based on the preset depth detection map reflected by the object being scanned.

[0076] It should be noted that step 201 is the same as the aforementioned steps 101-102. For a detailed description, please refer to steps 101-102, which will not be elaborated here.

[0077] It should be noted that step 402 or step 403 can be executed after step 401.

[0078] Step 402: Divide the grayscale image of the depth scale into multiple image regions and calculate the average grayscale value of each image region to obtain multiple average grayscale values. Perform difference calculation on adjacent average grayscale values ​​to obtain multiple grayscale gradient values. Determine the black and white stripe region based on the multiple grayscale gradient values ​​and the preset grayscale gradient threshold.

[0079] In this embodiment of the disclosure, the grayscale image of the depth scale is divided into multiple image regions, for example, the image regions are divided according to the grayscale values ​​of each row, the grayscale mean of each row is calculated, and multiple grayscale average values ​​are obtained. Based on the difference calculation of adjacent grayscale average values ​​among the multiple grayscale average values, multiple grayscale gradient values ​​are obtained. Based on the multiple grayscale gradient values ​​and a preset grayscale gradient threshold, the black and white stripe regions are determined. Usually, there will be a gradient abrupt change at the boundary of the black and white stripe regions. That is to say, the region corresponding to the grayscale gradient value greater than the preset grayscale gradient threshold is taken as the black and white stripe region.

[0080] In this embodiment of the disclosure, there are many ways to obtain multiple gray-level gradient values ​​by performing differential calculations based on adjacent gray-level average values ​​among multiple gray-level average values. As one example, the absolute difference between adjacent gray-level average values ​​is calculated as a gray-level gradient value, thereby obtaining multiple gray-level gradient values. As another example, the average difference between adjacent gray-level average values ​​is calculated as a gray-level gradient value, thereby obtaining multiple gray-level gradient values. The above are merely examples of obtaining multiple gray-level gradient values ​​by performing differential calculations based on adjacent gray-level average values ​​among multiple gray-level average values. This embodiment of the disclosure does not impose specific limitations on the implementation method of obtaining multiple gray-level gradient values ​​by performing differential calculations based on adjacent gray-level average values ​​among multiple gray-level average values.

[0081] Step 403: Divide the grayscale image of the depth scale into multiple image regions, calculate the grayscale value corresponding to each image region according to the preset edge gradient formula, obtain the spatial gradient value corresponding to each image region, calculate the average edge intensity based on the spatial gradient value corresponding to each image region, obtain multiple average edge intensity values, perform difference calculation based on the adjacent average edge intensity values ​​among the multiple average edge intensity values, obtain multiple edge gradient values, and determine the black and white stripe region based on the multiple edge gradient values ​​and the preset edge gradient threshold.

[0082] In this embodiment of the disclosure, the depth scale grayscale image is divided into multiple image regions, for example, by dividing the image regions according to the grayscale values ​​of each row or by dividing them into a preset number of rows and columns. Then, the grayscale values ​​corresponding to each image region are calculated according to a preset edge gradient formula to obtain the spatial gradient value corresponding to each image region. For example, the first-order discrete differential operator is used as the preset edge gradient formula to calculate the grayscale values ​​corresponding to each image region to obtain the spatial gradient value corresponding to each image region.

[0083] Furthermore, based on the difference calculation of adjacent average edge intensity values ​​among multiple average edge intensity values, multiple edge gradient values ​​are obtained, and the black and white stripe regions are determined based on the multiple edge gradient values ​​and the preset edge gradient threshold. Usually, the boundary of the black and white stripe regions will show a gradient abrupt change. That is to say, the region corresponding to the edge gradient value greater than the preset edge gradient threshold is taken as the black and white stripe region.

[0084] In this embodiment of the disclosure, there are many ways to obtain multiple edge gradient values ​​by performing differential calculations on adjacent average edge intensity values ​​among multiple average edge intensity values. As one example, the absolute difference between adjacent average edge intensity values ​​is calculated as an edge gradient value, thereby obtaining multiple edge gradient values. As another example, the average difference between adjacent average edge intensity values ​​is calculated as an edge gradient value, thereby obtaining multiple edge gradient values. The above are merely examples of obtaining multiple edge gradient values ​​by performing differential calculations on adjacent average edge intensity values ​​among multiple average edge intensity values. This embodiment of the disclosure does not impose specific limitations on the implementation method of obtaining multiple edge gradient values ​​by performing differential calculations on adjacent average edge intensity values ​​among multiple average edge intensity values.

[0085] Step 404: Obtain the grayscale projection curve corresponding to the black and white stripe region, obtain at least one target gradient maximum point based on the grayscale projection curve, take the maximum target gradient maximum point as the fitting center point, and determine multiple candidate fitting points based on the preset symmetry rule with the fitting center point as the center.

[0086] Specifically, after determining the black and white stripe region, the grayscale projection curve corresponding to the black and white stripe region is obtained, i.e., multiple target grayscale gradient values. In some embodiments, the black and white stripe region is divided into multiple regions, for example, according to each column of grayscale values. The mean grayscale value of each column is calculated to obtain multiple grayscale average values. Based on the difference calculation of adjacent grayscale average values ​​among the multiple grayscale average values, the grayscale projection curve is obtained, i.e., multiple target grayscale gradient values. In other embodiments, the black and white stripe region is divided into multiple regions, for example, according to each column of grayscale values ​​or a preset number of rows and columns. After calculating the spatial gradient value corresponding to each region, the average edge intensity is calculated to obtain multiple average edge intensity values. Based on the difference calculation of the average edge intensity values ​​among the multiple average edge intensity values, the grayscale projection curve is obtained, i.e., multiple target grayscale gradient values.

[0087] Furthermore, by analyzing the grayscale projection curve, i.e. multiple target grayscale gradient values, at least one target gradient maximum point is obtained, and the maximum target gradient maximum point is accurately extracted as the fitting center point. Based on the preset symmetry rule, multiple candidate fitting points are determined with the fitting center point as the center.

[0088] Among them, the preset symmetry rule refers to taking the fitting center point as the center and determining the same number of target gradient maxima points from multiple target gray-level gradient values ​​as multiple candidate fitting points on both sides.

[0089] Therefore, the maximum target gradient point (global maximum peak) is used as the fitting center point, and equal number of peak points (target gradient maximum points) are selected symmetrically on the left and right sides to ensure that the fitted data is distributed around the true peak and suppress the positioning offset.

[0090] Step 405: Fit multiple candidate fitting points based on multiple preset fitting models to obtain multiple fitting curves, calculate the error value corresponding to each fitting curve, and take the fitting curve corresponding to the minimum error value as the target fitting curve.

[0091] The system allows for the selection and setting of multiple preset fitting models based on actual application needs, such as performing Gaussian fitting, quadratic polynomial fitting, etc., thereby obtaining multiple fitting curves.

[0092] Furthermore, the error value corresponding to each fitted curve is calculated, and the fitted curve corresponding to the minimum error value is taken as the target fitted curve; where the error value can be the root mean square error value, which is calculated by using the coordinates of the actual pixel point and the coordinates calculated from the fitted curve using the root mean square error formula.

[0093] Specifically, the smaller the error value, the better the curve fit, and the fitted curve corresponding to the minimum error value is taken as the target fitted curve.

[0094] Therefore, by calculating the error values ​​corresponding to multiple fitting curves for each fitting model, the fitting curve with the smallest error value is selected as the target curve, thus realizing the fitting of multiple fitting models and selecting the optimal fitting curve based on the error value. This can adapt to complex scenarios such as noise, stripe distortion, and lighting changes.

[0095] Step 406: Obtain the local maxima of the target fitted curve, and use the target axis coordinates of the local maxima as the target depth position.

[0096] Specifically, the first derivative is calculated based on the target fitting curve to obtain the position point where the first derivative is 0. Then, the second derivative is calculated for the first derivative being 0, and the position point where the second derivative is less than 0 is the local maximum point. The target axis position coordinates of the local maximum point, i.e., the horizontal axis pixel coordinates, are used as the target depth of field position, i.e., the optimal depth of field position of the camera.

[0097] Step 407: In response to the camera focusing command, control the target depth-of-field position corresponding to each camera to align with the preset position marked on the camera; wherein, the preset position is used to indicate the target focusing position.

[0098] In this embodiment of the disclosure, for depth detection scenarios with at least two cameras, such as high-precision 3D reconstruction scenarios, 3D scanning is highly dependent on a fixed bounding box (the effective point cloud data generation range). If the focus position is offset, it will cause the effective depth range to be misaligned with the bounding box range, resulting in problems such as point cloud data errors, decreased reconstruction accuracy, and data quality degradation. Therefore, the depth of field of the front and rear of the binocular camera needs to be matched to avoid one side being clear and the other side being blurry, and ultimately to ensure the accuracy of point cloud matching.

[0099] Specifically, the binocular cameras are calibrated in a coordinated manner, and the camera positions are continuously adjusted so that the target depth of field position corresponding to each camera is aligned with the preset position marked on the camera. The left and right cameras are operated in the same way, which can ensure high depth of field overlap and low misalignment between the two cameras and between the camera and the fixed bounding box.

[0100] This solves the problems of uneven illumination (near bright, far dark) in existing depth-of-field scales, positioning offset caused by the near-bright-far-dark characteristic, flat-top phenomenon within the depth of field that makes it impossible to accurately identify the true peak value, poor detection stability and accuracy due to the fitting result deviating from the true point of sharpness, and inability to stably output the optimal depth-of-field position in complex scenes such as noise, fringe distortion, and changes in illumination. It can accurately focus to the optimal point of sharpness, meeting the focusing requirements that need to accurately match the depth of field position.

[0101] The scanner depth detection method of this disclosure is based on black and white line to depth scale, gradient maximum fitting, symmetry screening, and multi-model selection, which improves the depth positioning accuracy, robustness and consistency, and meets the high-precision requirements of binocular 3D reconstruction.

[0102] As an example scenario, obtaining a depth-of-field scale grayscale image, specifically, obtaining... Figure 5 The black and white lines shown correspond to the depth scale image. Figure 5 The image also displays a preset position. Further, the grayscale image of the depth scale is processed to obtain a grayscale image of the depth scale. The corresponding black and white stripe regions of the grayscale image of the depth scale are determined, and multiple target grayscale gradient values ​​corresponding to the black and white stripe regions are obtained. Based on the multiple target grayscale gradient values, at least one target gradient maximum point is obtained, and the maximum target gradient maximum point is used as the fitting center point, such as... Figure 6 As shown, there are multiple gradient maxima on the horizontal gradient, and the maximum target gradient maxima can be used as the fitting center point.

[0103] Furthermore, based on preset symmetry rules, multiple candidate fitting points are determined with the fitting center point as the center, such as... Figure 7 As shown, the mean gray level of the black and white striped regions is calculated column by column to generate a one-dimensional gray-level projection vector as multiple gray-level gradient values. Figure 7 The paper presents a comparison between the original peak (gradient maximum point) and the symmetrical peak (gradient maximum point). Data is selected symmetrically with the global peak (maximum target gradient maximum point) as the center to ensure the effectiveness of the fitted data and avoid one-sided data bias.

[0104] Furthermore, multiple candidate fitting points are fitted based on multiple preset fitting models to obtain multiple fitting curves, and a target fitting curve is determined from the multiple fitting curves. The target depth of field position is determined based on the target fitting curve. Specifically, the target axis position coordinates of the local maximum point of the target fitting curve are taken as the target depth of field position.

[0105] Therefore, the system employs a gradient maxima fitting and localization approach, using projected gradient maxima fitting to address localization errors caused by flat grayscale and uneven illumination. A peak symmetry selection strategy selects data symmetrically around the global peak value to ensure the effectiveness of the fitted data and avoid unilateral data shifts. A multi-model fitting approach combines error value optimization, simultaneously performing Gaussian, quadratic, cubic, and quartic polynomial fitting, automatically selecting the model with the highest accuracy, adapting to complex scenarios such as noise, stripe distortion, and illumination variations. Gradient maxima symmetric sampling fitting, using the gradient peak value as the center, selects a fixed number of points on both sides to participate in the fitting, improving detection stability. In short, the combination of gradient maxima fitting and symmetric selection significantly reduces localization errors in flat-top and uneven illumination scenarios, supporting batch processing, automatic localization, and automatic output without manual intervention. It also accurately matches the depth of field of the left and right scanners, greatly improving the accuracy of 3D reconstructed point clouds.

[0106] To achieve the above embodiments, this disclosure also proposes a scanner depth detection device.

[0107] Figure 8 This is a schematic diagram of a scanner depth detection device provided in an embodiment of the present disclosure. The device can be implemented by software and / or hardware and is generally integrated into an electronic device. Figure 8 As shown, the device includes: The response control module 801 is used to respond to the depth detection command and control the scanner to project a preset depth detection image onto the scanned object. The acquisition module 802 is used to acquire the grayscale image of the depth scale collected by the scanner based on the preset depth detection map reflected by the scanned object. The detection module 803 is used to perform depth detection on the scanner based on the grayscale image of the depth scale, and obtain the depth detection result.

[0108] Optionally, if the depth detection result is that the depth detection is successful, a first prompt message is issued or the scanner is controlled to switch to scanning mode; if the depth detection result is that the depth detection is unsuccessful, a second prompt message is issued or the scanner is controlled to perform a focusing operation.

[0109] Optionally, the depth detection command is triggered based on a preset button or preset control on the scanner control software; or, the scanner detects that the image quality does not meet the preset image quality conditions, and / or, the depth position error of at least two cameras is greater than a preset error threshold, and / or, the depth detection command is triggered when the reconstruction error based on the scan data is greater than a preset reconstruction threshold.

[0110] Optionally, the scanner includes at least two cameras, and the detection module 803 includes: a first acquisition unit, configured to acquire a grayscale projection curve and a target depth-of-field position based on the grayscale image of the depth scale; a first determination unit, configured to determine that the depth-of-field detection passes as the depth-of-field detection result when the overlap of the grayscale projection curves between all cameras is greater than or equal to a preset overlap threshold and the position error of the target depth-of-field position is less than a preset error threshold; and a second determination unit, configured to determine that the depth-of-field detection fails as the depth-of-field detection result when the overlap of the grayscale projection curves between any two cameras is less than the preset overlap threshold, or the position error of the target depth-of-field position between any two cameras is greater than or equal to the preset error threshold.

[0111] Optionally, the scanner includes at least one camera, and the detection module 803 includes: a second acquisition unit, configured to acquire a grayscale projection curve based on the grayscale image of the depth scale; a third determination unit, configured to determine that the depth detection is passed as the depth detection result when the target depth position is acquired based on the grayscale projection curve; and a fourth determination unit, configured to determine that the depth detection is passed as the depth detection result when the target depth position cannot be acquired based on the grayscale projection curve.

[0112] Optionally, the first acquisition unit includes: a first determining subunit, configured to determine the black and white stripe region corresponding to the grayscale image of the depth scale; wherein the black and white stripe region refers to a black and white alternating region including the target depth of field position; a calculation subunit, configured to perform gradient calculation based on the black and white stripe region according to a preset dimension to obtain the grayscale projection curve; a second determining subunit, configured to determine the fitting center point based on the grayscale projection curve; a third determining subunit, configured to determine multiple candidate fitting points centered on the fitting center point based on a preset symmetry rule; a fitting subunit, configured to fit the multiple candidate fitting points based on multiple preset fitting models to obtain multiple fitting curves; a fourth determining subunit, configured to determine the target fitting curve from the multiple fitting curves; and a fifth determining subunit, configured to determine the target depth of field position based on the target fitting curve; wherein the target depth of field position is used to instruct the camera to perform focusing processing.

[0113] Optionally, the first determining subunit is specifically used to: divide the depth scale grayscale image into multiple image regions, and calculate the average grayscale value of each image region to obtain multiple average grayscale values; perform difference calculation based on adjacent average grayscale values ​​among the multiple average grayscale values ​​to obtain multiple grayscale gradient values; and determine the black and white stripe region based on the multiple grayscale gradient values ​​and a preset grayscale gradient threshold.

[0114] Optionally, the first determining subunit is specifically used for: dividing the depth-of-field grayscale image into multiple image regions; calculating the grayscale value corresponding to each image region according to a preset edge gradient formula to obtain a spatial gradient value corresponding to each image region; calculating the average edge intensity based on the spatial gradient value corresponding to each image region to obtain multiple average edge intensity values; performing difference calculation based on adjacent average edge intensity values ​​among the multiple average edge intensity values ​​to obtain multiple edge gradient values; and determining the black and white stripe region based on the multiple edge gradient values ​​and a preset edge gradient threshold.

[0115] Optionally, the second determining subunit is specifically used to: obtain multiple target gray-level gradient values ​​corresponding to the gray-level projection curve; obtain at least one target gradient maximum point based on the multiple target gray-level gradient values, and use the maximum target gradient maximum point as the fitting center point.

[0116] Optionally, the fourth determining subunit is specifically used for: calculating the error value corresponding to each of the fitted curves; and taking the fitted curve corresponding to the minimum error value as the target fitted curve.

[0117] Optionally, the fifth determining subunit is specifically used to: obtain the local maximum point of the target fitting curve; and use the target axis position coordinates of the local maximum point as the target depth of field position.

[0118] Optionally, the device further includes: a response control module, configured to, in response to a camera focusing command, control the target depth-of-field position corresponding to each camera to align with a preset position marked on the camera; wherein the preset position is used to represent the target focusing position.

[0119] The scanner depth detection device provided in this disclosure can execute the scanner depth detection method provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects for executing the method.

[0120] To implement the above embodiments, this disclosure also proposes a computer program product, including a computer program / instructions, which, when executed by a processor, implements the scanner depth detection method in the above embodiments.

[0121] Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure.

[0122] The following is a detailed reference. Figure 9 The diagram illustrates a structural schematic suitable for implementing the electronic device 900 in the embodiments of this disclosure. The electronic device 900 in the embodiments of this disclosure may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 9 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.

[0123] like Figure 9As shown, the electronic device 900 may include a processor (e.g., a central processing unit, a graphics processing unit, etc.) 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a memory 908 into a random access memory (RAM) 903. The RAM 903 also stores various programs and data required for the operation of the electronic device 900. The processor 901, ROM 902, and RAM 903 are interconnected via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.

[0124] Typically, the following devices can be connected to I / O interface 905: input devices 906 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 907 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; memory devices 908 including, for example, magnetic tapes, hard disks, etc.; and communication devices 909. Communication device 909 allows electronic device 900 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 9 An electronic device 900 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.

[0125] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 909, or installed from a memory 908, or installed from a ROM 902. When the computer program is executed by the processor 901, it performs the functions defined in the scanner depth detection method of embodiments of this disclosure.

[0126] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.

[0127] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.

[0128] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.

[0129] The aforementioned computer-readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to perform the aforementioned scanner depth detection method.

[0130] Electronic devices can be programmed with computer program code in one or more programming languages ​​or combinations thereof to perform the operations of this disclosure. These programming languages ​​include, but are not limited to, object-oriented programming languages ​​such as Java, Smalltalk, and C++, as well as conventional procedural programming languages ​​such as "C" or similar languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0131] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0132] The units described in the embodiments of this disclosure can be implemented in software or hardware. The names of the units are not, in some cases, intended to limit the specific unit.

[0133] The functions described above in this document can be performed at least in part by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), system-on-a-chip (SoCs), complex programmable logic devices (CPLDs), and so on.

[0134] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0135] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.

[0136] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.

[0137] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.

Claims

1. A depth detection method for a scanner, characterized in that, The method includes: In response to a depth detection command, control the scanner to project a preset depth detection map onto the object being scanned; Based on the preset depth detection map reflected by the scanned object, the depth scale grayscale image acquired by the scanner is obtained. The scanner is used to perform depth detection based on the grayscale image of the depth scale to obtain the depth detection result.

2. The method as described in claim 1, characterized in that, The method further includes: If the depth detection result is that the depth detection is successful, then a first prompt message is issued or the scanner is controlled to switch to scanning mode; If the depth-of-field detection result is that the depth-of-field detection fails, a second prompt message will be issued or the scanner will be controlled to perform a focusing operation.

3. The method as described in claim 1, characterized in that, The triggering methods for the depth detection command include: The depth detection command is triggered based on a preset button or preset control on the scanner control software; and / or, the scanner detects that the image quality does not meet the preset image quality conditions; and / or, the depth position error of at least two cameras is greater than a preset error threshold; and / or, the depth detection command is triggered when the reconstruction error based on the scan data is greater than a preset reconstruction threshold.

4. The method as described in claim 1, characterized in that, The scanner includes at least two cameras. The depth detection performed on the scanner based on the grayscale image from the depth scale to obtain the depth detection result includes: The grayscale projection curve and target depth of field position are obtained based on the grayscale image of the depth scale. If the overlap of the grayscale projection curves between all cameras is greater than or equal to a preset overlap threshold and the position error of the target depth of field is less than a preset error threshold, then the depth of field detection is determined to be passed as the depth of field detection result. If the overlap of the grayscale projection curves between any two cameras is less than the preset overlap threshold, or the positional error of the target depth-of-field position between any two cameras is greater than or equal to the preset error threshold, the depth-of-field detection is determined to fail as the depth-of-field detection result.

5. The method as described in claim 1, characterized in that, The scanner includes at least one camera. The process of performing depth detection on the scanner based on the grayscale image of the depth scale to obtain a depth detection result includes: The grayscale projection curve is obtained based on the grayscale image of the depth scale; If the target depth position is obtained based on the grayscale projection curve, the depth detection is determined as the depth detection result. If the target depth position cannot be obtained based on the grayscale projection curve, the depth detection is determined to be passed as the depth detection result.

6. The method as described in claim 4, characterized in that, The step of obtaining the grayscale projection curve and target depth position based on the grayscale image of the depth scale includes: Determine the black and white stripe region corresponding to the grayscale image of the depth scale; wherein, the black and white stripe region refers to the alternating black and white region including the target depth of field position; The grayscale projection curve is obtained by performing gradient calculations on the black and white striped regions according to a preset dimension. The fitting center point is determined based on the grayscale projection curve, and multiple candidate fitting points are determined with the fitting center point as the center based on the preset symmetry rule. The candidate fitting points are fitted using multiple preset fitting models to obtain multiple fitting curves. A target fitting curve is determined from the multiple fitting curves, and the target depth of field position is determined based on the target fitting curve. The target depth of field position is used to instruct the camera to perform focusing processing.

7. The method as described in claim 6, characterized in that, Determining the black and white stripe region corresponding to the grayscale image of the depth scale includes: The depth-of-field scale grayscale image is divided into multiple image regions, and the average grayscale value of each image region is calculated to obtain multiple average grayscale values; Multiple gray-level gradient values ​​are obtained by performing difference calculations on adjacent gray-level average values ​​among the multiple gray-level average values; The black and white stripe region is determined based on the multiple grayscale gradient values ​​and the preset grayscale gradient threshold.

8. The method as described in claim 6, characterized in that, Determining the black and white stripe region corresponding to the grayscale image of the depth scale includes: The depth-of-field grayscale image is divided into multiple image regions, and the grayscale value corresponding to each image region is calculated according to a preset edge gradient formula to obtain the spatial gradient value corresponding to each image region. The average edge intensity is calculated based on the spatial gradient value corresponding to each image region to obtain multiple average edge intensity values. Multiple edge gradient values ​​are obtained by performing differential calculations on adjacent average edge intensity values ​​among the multiple average edge intensity values; The black and white stripe region is determined based on the multiple edge gradient values ​​and the preset edge gradient threshold.

9. The method as described in claim 6, characterized in that, Determining the fitting center point based on the grayscale projection curve includes: Obtain multiple target grayscale gradient values ​​corresponding to the grayscale projection curve; At least one target gradient maximum point is obtained based on the multiple target gray-level gradient values, and the maximum target gradient maximum point is used as the fitting center point.

10. The method as described in claim 6, characterized in that, Determining the target fitting curve from the plurality of fitting curves includes: Calculate the error value corresponding to each of the fitted curves; The fitted curve corresponding to the minimum error value is taken as the target fitted curve.

11. The method as described in claim 6, characterized in that, Determining the target depth-of-field position based on the target fitting curve includes: Obtain the local maxima of the target fitted curve; The target axis position coordinates of the local maximum point are used as the target depth position.

12. The method as described in claim 6, characterized in that, After determining the target depth-of-field position based on the target fitting curve, the method further includes: In response to a camera focusing command, the target depth-of-field position corresponding to each camera is aligned with a preset position marked on the camera; wherein the preset position is used to indicate the target focusing position.

13. A scanner depth detection device, characterized in that, The response control module is used to respond to depth detection commands and control the scanner to project a preset depth detection map onto the object being scanned. The acquisition module is used to acquire a grayscale image of the depth scale collected by the scanner based on a preset depth detection map reflected by the scanned object. The detection module is used to perform depth detection on the scanner based on the grayscale image of the depth scale, and obtain the depth detection result.

14. An electronic device, characterized in that, The electronic device includes: processor; Memory used to store the processor's executable instructions; The processor is configured to read the executable instructions from the memory and execute the executable instructions to implement the scanner depth detection method according to any one of claims 1-12.

15. A computer-readable storage medium, characterized in that, The storage medium stores a computer program for executing the scanner depth detection method according to any one of claims 1-12.