Depth measurement method and device of target object, computer device and storage medium
By receiving structured light images to obtain phase and edge coding information, and combining this with the principle of triangulation, the most reliable depth value is selected. This solves the measurement error problem caused by pixel brightness changes in phase-shift profilometry, and improves the accuracy and precision of depth measurement of target objects.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- GUANGZHOU SHIYUAN ELECTRONICS CO LTD
- Filing Date
- 2022-04-11
- Publication Date
- 2026-06-23
AI Technical Summary
In the existing technology, the three-dimensional contour measurement method based on phase-shifting profilometry is easily affected by changes in pixel brightness, resulting in low accuracy of the measurement results. In particular, when the texture and reflectivity of the target object are uneven, there are errors and mistakes in the phase encoding information.
By receiving structured light images, the phase encoding information and edge encoding information of the target object are obtained. The first and second depths of the target object are calculated using the triangulation principle, and the most reliable depth value is selected according to preset screening conditions to improve measurement accuracy.
When the grayscale value of structured light pixels is abnormal, reliable measurement is achieved by utilizing edge coding information, which improves the accuracy and precision of depth measurement of target objects and adapts to different measurement accuracy requirements.
Smart Images

Figure CN116934824B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer equipment technology, and in particular to a method, apparatus, computer equipment, and storage medium for measuring the depth of a target object. Background Technology
[0002] Compared to two-dimensional texture information, the three-dimensional contour of an object can more fully represent its geometric structure. With the development of fields such as industrial automation, biomedical 3D imaging, entertainment, and security, the technology of measuring object surface contours using structured light methods is receiving increasing attention. Phase-Shifting Profilometry (PSP), as a widely used structured light 3D measurement technique, encodes the measurement range using pre-designed structured light phase information and establishes a phase-to-distance mapping based on the relative positional relationship between the camera and the projection device to achieve object surface contour measurement. Typically, 3D contour measurement technology based on phase-shifting profilometry mainly includes the following processes: phase-shifting mode design and generation, structured light projection and imaging, phase extraction (wrap phase extraction and phase unwrapping), and distance mapping. During measurement, phase-shifting profilometry projects a structured light mode that satisfies a certain functional distribution (such as a trigonometric function) over time, and uses a camera to image at each moment.
[0003] When measuring the depth of a target object, phase-shifting profilometry is highly susceptible to variations in pixel brightness. Typically, due to factors such as the texture and reflectivity of the target object itself, structured light inevitably suffers from pixel grayscale anomalies (such as low contrast or oversaturation), leading to errors and inaccuracies in the obtained phase encoding information, and consequently, lower measurement accuracy. Summary of the Invention
[0004] The purpose of this application is to provide a method, apparatus, computer device, and storage medium for measuring the depth of a target object, so as to improve the accuracy of depth measurement of the target object.
[0005] To achieve the above objectives, this application provides a method for measuring the depth of a target object, comprising the following steps:
[0006] When it is detected that the projection device projects structured light onto the target object according to the preset structured light mode, the image of the target object captured by the camera is received.
[0007] The phase encoding information of the target object is determined based on the image, and the first depth of the target object is calculated using the phase encoding information;
[0008] The edges of the structured light in the image are obtained, and the edge coding information is constructed based on the edges to obtain edge coding information;
[0009] The second depth of the target object is calculated based on the edge encoding information;
[0010] The target depth of the target object is determined from the first depth and the second depth according to the preset filtering conditions.
[0011] This application also provides a depth measuring device for a target object, comprising:
[0012] The receiving module is used to receive an image of the target object captured by the camera when it is detected that the projection device is projecting structured light onto the target object in a preset structured light mode.
[0013] The first calculation module is used to determine the phase encoding information of the target object based on the image, and to calculate the first depth of the target object using the phase encoding information;
[0014] A construction module is used to acquire the edges of the structured light in the image, construct encoding information based on the edges, and obtain edge encoding information;
[0015] The second calculation module is used to calculate the second depth of the target object based on the edge encoding information;
[0016] The determination module is used to determine the target depth of the target object from the first depth and the second depth according to preset filtering conditions.
[0017] This application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the depth measurement method for a target object as described in any of the preceding claims.
[0018] This application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the depth measurement method for a target object as described in any of the preceding claims.
[0019] The method, apparatus, computer device, and storage medium for measuring the depth of a target object disclosed in this application, when a projection device projects structured light onto a target object according to a preset structured light mode, receive an image of the target object captured by a camera, determine the phase encoding information of the target object based on the image, calculate the first depth of the target object using the phase encoding information, obtain the edge of the structured light in the image, construct edge-based encoding information, obtain edge encoding information, calculate the second depth of the target object based on the edge encoding information, and determine the target depth of the target object from the first and second depths according to preset filtering conditions. This can be flexibly adjusted according to measurement accuracy requirements. Furthermore, even when the grayscale value of the structured light pixels is abnormal, the edges of the structured light still have good distinguishability, thus enabling reliable measurement of areas with abnormal pixel values based on the edge encoding information, thereby improving the measurement accuracy of the target object's depth. Attached Figure Description
[0020] Figure 1 This is a schematic diagram illustrating the steps of a method for measuring the depth of a target object.
[0021] Figure 2 This is a schematic diagram of sinusoidal structured light in an image;
[0022] Figure 3 A schematic diagram of the edge distribution of a single-frequency four-step phase-shift mode;
[0023] Figure 4 This is a binary stripe pattern obtained by binarizing an image based on edge pairs in a four-step phase-shifting process.
[0024] Figure 5 A schematic block diagram of a depth measuring device for a target object;
[0025] Figure 6 This is a schematic block diagram of the structure of a computer device.
[0026] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0027] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0028] Reference Figure 1 This is a schematic diagram of the steps of a method for measuring the depth of a target object in one embodiment of this application, with a computer device as the executing entity. The method includes:
[0029] S11. When it is detected that the projection device projects structured light onto the target object according to the preset structured light mode, the image of the target object captured by the camera is received.
[0030] S12. Determine the phase encoding information of the target object based on the image, and calculate the first depth of the target object using the phase encoding information;
[0031] S13. Obtain the edges of the structured light in the image, construct encoding information based on the edges, and obtain edge encoding information;
[0032] S14. Calculate the second depth of the target object based on the edge encoding information;
[0033] S15. Determine the target depth of the target object from the first depth and the second depth according to the preset filtering conditions.
[0034] As described in steps S11-S12 above, this application can realize the depth measurement of a target object based on a grating projection three-dimensional measurement system to construct the three-dimensional information of the target object. The grating projection three-dimensional measurement system mainly consists of a camera and a projection device. In a preset structured light mode, the projection device projects structured light onto the target object. The structured light is a set of coded patterns. The coded patterns are modulated by the change in the height of the target object surface. The camera captures the modulated coded patterns and then decodes them to obtain the pixel coordinates of each point on the target object surface in the image coordinate system of the projection device. Finally, the three-dimensional coordinates of each point on the target object surface in the world coordinate system are calculated according to the triangulation principle.
[0035] It should be noted that the most common method in structured light 3D reconstruction is the phase-shifting method. Phase shifting is achieved by projecting a series of phase-shifting grating images to encode the relative or absolute position of a point on the object's surface on the projection device image.
[0036] The structured light can be time-coded structured light, which means that within a certain time range, a series of structured lights with different brightness are projected onto the target object through a projection device. Each projection is imaged by a camera. Assuming there are n images in total, and the part covered by shadow is encoded with a value of 1, and the part not covered is encoded with a value of 0, the phase encoding information of the target object is generated, and the first depth of the target object is calculated using the structure method.
[0037] Structured light method works by combining images captured by a camera with triangulation and image processing techniques to calculate the depth data of the target object. This method utilizes images as information carriers and uses controllable light sources to form obvious texture features, which can greatly reduce the difficulty of matching surface areas such as those lacking texture, smooth surfaces, or areas without obvious grayscale.
[0038] Under different structured light modes, structured light methods can be divided into point structured light, line structured light, and area structured light based on the different types of structured light projected. Point structured light projects a point light source onto the target object and obtains the depth data of the target object by scanning point by point. However, this method requires a long scanning time and cannot be used for depth acquisition of dynamically changing objects. Line structured light projects a line of structured light into the target object, requiring only one-dimensional scanning, which shortens the scanning time, but its resistance to interference from external stray light is relatively poor. Area structured light uses a two-dimensional image as an encoding template, avoiding long scanning times and enabling rapid depth measurement of target objects throughout the scene. This method improves measurement efficiency and also has high measurement accuracy, making it suitable for high-precision depth measurement of dynamic objects.
[0039] As described in steps S13-S15 above, when the grayscale value of structured light pixels in an image is abnormal, since the edges of the structured light still have good distinguishability, all edges of the structured light in the image can be obtained, and encoding information based on all edges can be constructed. For example, all edges can be encoded according to the Gray code encoding principle to obtain edge encoding information. The second depth of the target object can be calculated based on the edge encoding information. Thus, reliable measurement of pixel value abnormal areas can be achieved based on the edge encoding information, improving the measurement accuracy of the depth of the target object. At the same time, the edge encoding information is extracted based only on the characteristics of the structured light itself, without the need for additional projection of the structured light mode, making the operation simple.
[0040] Gray code is a quasi-weighted code. If the least significant bit of a Gray code is n = 1, then the absolute value of the weights in a Gray code is (2^n) - 1, and the sign alternates between positive and negative from left to right. A typical Gray code is a single-step self-complementary code with reflective and cyclic properties. Its cyclic and single-step properties eliminate the possibility of significant errors when randomly selecting numbers, and its reflective and self-complementary properties make inversion very convenient.
[0041] Finally, based on preset screening conditions, the target depth of the target object is determined from the first depth and the second depth, and the first depth and the second depth are fused to achieve reliable measurement. For example, following the multi-frequency multi-step phase-shifting method measurement process, multiple structured lights of different frequencies can be projected, such as the three-frequency four-step phase-shifting method, and a camera can be used to simultaneously acquire the reflection image of the target under the projection illumination. During the imaging process, due to factors such as large differences in object reflectivity, texture changes, projection and camera noise, exposure time, and limited camera dynamic range, some pixel values in the image may have large errors or be incorrect. This will lead to errors in the phase encoding information obtained from the image. Therefore, when there is a large difference between the first depth calculated based on phase and the second depth calculated based on edge, it indicates that the structured light has a serious problem with abnormal pixel grayscale values (such as low contrast, oversaturation, etc.), which will lead to large errors and mistakes in the obtained phase encoding information, resulting in low accuracy of the measurement results. In this case, the second depth is selected as the target depth of the target object. When there is a large difference between the first depth calculated based on phase and the second depth calculated based on edge, the first depth is selected as the target depth of the target object. This allows for flexible adjustment according to the measurement accuracy requirements, with only a small increase in measurement time and only an increase in algorithm processing complexity.
[0042] The depth measurement method for the target object of this application involves receiving an image of the target object captured by a camera when a projection device projects structured light onto the target object according to a preset structured light mode. The method determines the phase encoding information of the target object based on the image, calculates the first depth of the target object using the phase encoding information, obtains the edge of the structured light in the image, constructs edge-based encoding information, calculates the second depth of the target object based on the edge encoding information, and determines the target depth of the target object from the first and second depths according to preset filtering conditions. This method can be flexibly adjusted according to measurement accuracy requirements. Furthermore, even when the grayscale value of the structured light pixels is abnormal, the edges of the structured light still have good distinguishability, thus enabling reliable measurement of areas with abnormal pixel values based on the edge encoding information, thereby improving the measurement accuracy of the target object's depth.
[0043] In one embodiment, the step of determining the phase encoding information of the target object based on the image includes the following steps:
[0044] Based on the image, the phase encoding information of the target object is obtained using a multi-frequency, multi-step phase-shifting structured light algorithm.
[0045] In this embodiment, phase encoding information can be obtained based on a multi-frequency, multi-step phase-shifting structured light algorithm, and the target depth can be calculated using this phase encoding information. Under normal circumstances, if the image recorded by the camera strictly satisfies the sinusoidal relationship required by phase-shifting structured light, the three-dimensional information of the object under test can be accurately obtained based on the phase encoding information.
[0046] The multi-frequency, multi-step phase-shifting structured light algorithm can be a three-step phase-shifting algorithm, a four-step phase-shifting algorithm, a dual three-step phase-shifting algorithm, or an improved 2+1-step phase-shifting algorithm. These phase-shifting algorithms use different numbers of grating images, but they also share some similar characteristics: they can achieve pixel-level measurement accuracy, reduce the influence of ambient light, and the higher the number of grating images used, the higher the accuracy. Among these phase-shifting algorithms, the three-step phase-shifting method is widely used in high-speed measurement fields because it uses the fewest number of grating images.
[0047] In one embodiment, the step of obtaining the edge of the structured light in the image includes the following steps:
[0048] When the structured light is a sinusoidal phase-shift structured light, the derivative of the sinusoidal phase-shift structured light at each position in the image is calculated to obtain the derivative at each position;
[0049] The extreme values of the sinusoidal phase-shifting structured light in the image are determined based on the derivative at each position, and the positions corresponding to the extreme values are taken as the edges of the image.
[0050] In this embodiment, edge-based encoded information can be constructed using the edges of structured light, and the target depth can be calculated using the triangulation principle. Specifically, the mode edges of all frequencies and phase shift steps are extracted sequentially. For sinusoidal phase-shift structured light, its brightness distribution at the projection end satisfies a sinusoidal periodic arrangement, and each period contains, for example, the edge-based encoding information based on .... Figure 2 The rising and falling edges are shown. According to the properties of trigonometric functions, if the derivative of brightness is taken along the vertical stripe direction, an extreme value will be obtained at the edge point shown in the figure. The location of the extreme point is defined as the edge. Although the derivative has stationary points, it is not suitable to consider stationary points as edge points due to potential image oversaturation. When the image is oversaturated, the extracted stationary point location is inaccurate. In contrast, the point where the derivative takes an extreme value often retains good properties even under oversaturation conditions.
[0051] In one embodiment, the step of constructing edge-based encoded information to obtain edge encoded information includes the following steps:
[0052] The image is binarized based on the edges to obtain a binary stripe pattern.
[0053] Based on the binary stripe pattern, a codeword consisting of 0s and 1s is constructed to obtain the edge coding information.
[0054] In this embodiment, for the multi-frequency, multi-step phase shift mode (taking a three-frequency, four-step phase shift as an example), each phase shift step has a different edge position, and the spacing between adjacent edges at each frequency is also different. For example... Figure 3As shown, each step extracts the edge positions of the periodic distribution, and the edges of adjacent phase shift steps are exactly one-quarter of a fringe period apart. Then, based on the extracted edges, the image of each step is binarized to obtain a binary fringe pattern. Specifically, each period can be alternately set to 1 or 0, with the first period of each step set to 1 and the second period set to 0.
[0055] like Figure 4 As shown, based on the obtained binary fringe pattern, codewords composed of 0s and 1s are constructed to obtain the edge encoding information. Similar to the Gray code structured light measurement method, the codewords encode the position of the corresponding pixels, and the resolution of the codewords is related to the width of the fringe itself. Obviously, a single frequency can only form 4 codewords in each fringe period.
[0056] In one embodiment, the step of determining the target depth of the target object from the first depth and the second depth according to preset filtering conditions includes the following steps:
[0057] Calculate the difference between the first depth and the second depth;
[0058] Determine whether the absolute value of the difference is greater than a preset difference; wherein the preset difference is a positive number;
[0059] When the absolute value of the difference is determined to be greater than a preset difference, the second depth is taken as the target depth of the target object;
[0060] When it is determined that the absolute value of the difference is not greater than a preset difference, the first depth is taken as the target depth of the target object.
[0061] During the imaging process, due to factors such as large differences in object reflectivity, texture changes, projection and camera noise, exposure time, and limited camera dynamic range, some pixel values in the image may have large errors or be incorrect. This will lead to errors in the phase encoding information obtained from the image. Therefore, when there is a large difference between the first depth calculated based on phase and the second depth calculated based on edge, it indicates that the structured light has a serious problem with abnormal pixel grayscale values (such as low contrast, oversaturation, etc.), which will lead to large errors and mistakes in the obtained phase encoding information, resulting in low accuracy of the measurement results. In this case, the second depth is selected as the target depth of the target object. When there is a large difference between the first depth calculated based on phase and the second depth calculated based on edge, the first depth is selected as the target depth of the target object. This allows for flexible adjustment according to the measurement accuracy requirements, with only a small increase in measurement time and only an increase in algorithm processing complexity.
[0062] In one embodiment, the step of determining the target depth of the target object from the first depth and the second depth according to preset filtering conditions includes the following steps:
[0063] Obtain the pixel grayscale values of the image;
[0064] Determine whether the pixel grayscale value meets the requirements;
[0065] When it is determined that the pixel grayscale value does not meet the requirements, the second depth is taken as the target depth of the target object;
[0066] When the pixel grayscale value is determined to meet the requirements, the first depth is taken as the target depth of the target object.
[0067] This embodiment can acquire the pixel grayscale values of an image and determine whether the pixel grayscale values meet the requirements, such as whether the pixel grayscale values are too low. If the pixel grayscale values do not meet the requirements, it indicates that the structured light has a serious problem with abnormal pixel grayscale values (such as low contrast, oversaturation, etc.), which will lead to large errors and mistakes in the obtained phase coding information, resulting in low accuracy of the measurement results. In this case, the second depth is used as the target depth of the target object. When the pixel grayscale values meet the requirements, the first depth is used as the target depth of the target object, so that it can be flexibly adjusted according to the measurement accuracy requirements, while the measurement time increases only slightly and only the algorithm processing complexity is increased.
[0068] In one embodiment, the step of calculating the second depth of the target object based on the edge encoding information includes the following steps:
[0069] The target depth of the target object is calculated using the principle of triangulation based on the edge encoding information.
[0070] In this embodiment, edge-based encoded information can be constructed using the edge of structured light, and the target depth can be calculated using the principle of triangulation. The depth information of the target point is calculated by the angle change caused by the offset of any test point of the target object relative to the optical reference line, thereby calculating the depth information of all test points of the target object.
[0071] In trigonometry, the principle of measurement is a method in trigonometry and geometry for measuring the distance to a target point by measuring the angle between the target point and a known endpoint of a fixed baseline. It does not involve directly measuring the distance to a specific location (trilateration). When one side length and two observation angles are known, the target point can be designated as the third point of a triangle.
[0072] Reference Figure 5 This is a structural block diagram of a depth measurement device for a target object disclosed in this application. The device includes:
[0073] The receiving module 11 is used to receive the image of the target object captured by the camera when it is detected that the projection device projects structured light onto the target object according to the preset structured light mode;
[0074] The first calculation module 12 is used to determine the phase encoding information of the target object based on the image, and to calculate the first depth of the target object using the phase encoding information;
[0075] Construction module 13 is used to acquire the edges of the structured light in the image, construct encoding information based on the edges, and obtain edge encoding information;
[0076] The second calculation module 14 is used to calculate the second depth of the target object based on the edge encoding information;
[0077] The determination module 15 is used to determine the target depth of the target object from the first depth and the second depth according to preset filtering conditions.
[0078] In one embodiment, the first computing module 12 is specifically configured as follows:
[0079] Based on the image, the phase encoding information of the target object is obtained using a multi-frequency, multi-step phase-shifting structured light algorithm.
[0080] In one embodiment, the construction module 13 is specifically configured as follows:
[0081] When the structured light is a sinusoidal phase-shift structured light, the derivative of the sinusoidal phase-shift structured light at each position in the image is calculated to obtain the derivative at each position;
[0082] The extreme values of the sinusoidal phase-shifting structured light in the image are determined based on the derivative at each position, and the positions corresponding to the extreme values are taken as the edges of the image.
[0083] In one embodiment, the building module 13 is further configured to:
[0084] The image is binarized based on the edges to obtain a binary stripe pattern.
[0085] Based on the binary stripe pattern, a codeword consisting of 0s and 1s is constructed to obtain the edge coding information.
[0086] In one embodiment, the determining module 15 is specifically configured as follows:
[0087] Calculate the difference between the first depth and the second depth;
[0088] Determine whether the absolute value of the difference is greater than a preset difference; wherein the preset difference is a positive number;
[0089] When the absolute value of the difference is determined to be greater than a preset difference, the second depth is taken as the target depth of the target object;
[0090] When it is determined that the absolute value of the difference is not greater than a preset difference, the first depth is taken as the target depth of the target object.
[0091] In one embodiment, the determining module 15 is further configured to:
[0092] Obtain the pixel grayscale values of the image;
[0093] Determine whether the pixel grayscale value meets the requirements;
[0094] When it is determined that the pixel grayscale value does not meet the requirements, the second depth is taken as the target depth of the target object;
[0095] When the pixel grayscale value is determined to meet the requirements, the first depth is taken as the target depth of the target object.
[0096] In one embodiment, the second computing module 14 is specifically configured as follows:
[0097] The target depth of the target object is calculated using the principle of triangulation based on the edge encoding information.
[0098] As described above, it is understood that each component of the depth measuring device for the target object proposed in this application can realize the function of any of the depth measuring methods for the target object described above, and the specific structure will not be described in detail.
[0099] Reference Figure 6 This application also provides a computer device whose internal structure can be as follows: Figure 6As shown. The computer device includes a processor, memory, and network interface connected via a system bus. The processor is designed to provide computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used to communicate with external terminals via a network connection. When the computer program is executed by the processor, it implements a method for measuring the depth of a target object. The method for measuring the depth of a target object includes: when a projection device projects structured light onto a target object according to a preset structured light mode, receiving an image of the target object captured by a camera; determining the phase encoding information of the target object based on the image, and calculating a first depth of the target object using the phase encoding information; acquiring the edges of the structured light in the image, constructing encoding information based on the edges, and obtaining edge encoding information; calculating a second depth of the target object based on the edge encoding information; and determining a target depth of the target object from the first depth and the second depth according to preset filtering conditions.
[0100] One embodiment of this application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements a method for measuring the depth of a target object. It is understood that the computer-readable storage medium in this embodiment can be a volatile readable storage medium or a non-volatile readable storage medium. The method for measuring the depth of the target object includes: when a projection device projects structured light onto a target object according to a preset structured light mode, receiving an image of the target object captured by a camera; determining phase encoding information of the target object based on the image, and calculating a first depth of the target object using the phase encoding information; acquiring the edges of the structured light in the image, constructing encoding information based on the edges, and obtaining edge encoding information; calculating a second depth of the target object based on the edge encoding information; and determining a target depth of the target object from the first depth and the second depth according to preset filtering conditions.
[0101] In summary, the depth measurement method, apparatus, computer device, and storage medium of this application, when detecting that a projection device is projecting structured light onto a target object according to a preset structured light mode, receive an image of the target object captured by a camera, determine the phase encoding information of the target object based on the image, calculate the first depth of the target object using the phase encoding information, obtain the edge of the structured light in the image, construct edge-based encoding information, obtain edge encoding information, calculate the second depth of the target object based on the edge encoding information, and determine the target depth of the target object from the first and second depths according to preset filtering conditions. This can be flexibly adjusted according to measurement accuracy requirements. Furthermore, even when the grayscale value of the structured light pixels is abnormal, since the edge of the structured light still has good distinguishability, reliable measurement of areas with abnormal pixel values can be achieved based on the edge encoding information, thus improving the measurement accuracy of the target object's depth.
[0102] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the methods described above. Any references to memory, storage, databases, or other media provided in this application and in the embodiments may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual-speed SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0103] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, apparatus, article, or method. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, apparatus, article, or method that includes that element.
[0104] The above description is only a preferred embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural changes made based on the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.
Claims
1. A method for measuring the depth of a target object, characterized in that, Includes the following steps: When it is detected that the projection device projects structured light onto the target object according to the preset structured light mode, the image of the target object captured by the camera is received. The phase encoding information of the target object is determined based on the image, and the first depth of the target object is calculated using the phase encoding information; The edges of the structured light in the image are obtained, and the edge coding information is constructed based on the edges to obtain edge coding information; The second depth of the target object is calculated based on the edge encoding information; The target depth of the target object is determined from the first depth and the second depth according to preset filtering conditions; The step of determining the target depth of the target object from the first depth and the second depth according to preset filtering conditions includes the following steps: Calculate the difference between the first depth and the second depth; Determine whether the absolute value of the difference is greater than a preset difference; wherein the preset difference is a positive number; When the absolute value of the difference is determined to be greater than a preset difference, the second depth is taken as the target depth of the target object; When it is determined that the absolute value of the difference is not greater than a preset difference, the first depth is taken as the target depth of the target object.
2. The method for measuring the depth of a target object according to claim 1, characterized in that, The step of determining the phase encoding information of the target object based on the image includes the following steps: Based on the image, the phase encoding information of the target object is obtained using a multi-frequency, multi-step phase-shifting structured light algorithm.
3. The method for measuring the depth of a target object according to claim 1, characterized in that, The step of obtaining the edge of the structured light in the image includes the following steps: When the structured light is a sinusoidal phase-shift structured light, the derivative of the sinusoidal phase-shift structured light at each position in the image is calculated to obtain the derivative at each position; The extreme values of the sinusoidal phase-shifting structured light in the image are determined based on the derivative at each position, and the positions corresponding to the extreme values are taken as the edges of the image.
4. The method for measuring the depth of a target object according to claim 1, characterized in that, The step of constructing edge-based encoded information to obtain edge encoded information includes the following steps: The image is binarized based on the edges to obtain a binary stripe pattern. Based on the binary stripe pattern, a codeword consisting of 0s and 1s is constructed to obtain the edge coding information.
5. The method for measuring the depth of a target object according to claim 1, characterized in that, The step of determining the target depth of the target object from the first depth and the second depth according to preset filtering conditions includes the following steps: Obtain the pixel grayscale values of the image; Determine whether the pixel grayscale value meets the requirements; When it is determined that the pixel grayscale value does not meet the requirements, the second depth is taken as the target depth of the target object; When the pixel grayscale value is determined to meet the requirements, the first depth is taken as the target depth of the target object.
6. The method for measuring the depth of a target object according to claim 1, characterized in that, The step of calculating the second depth of the target object based on the edge encoding information includes the following steps: The target depth of the target object is calculated using the principle of triangulation based on the edge encoding information.
7. A depth measuring device for a target object, comprising the depth measuring method for a target object as described in any one of claims 1-6, characterized in that, include: The receiving module is used to receive an image of the target object captured by the camera when it is detected that the projection device is projecting structured light onto the target object in a preset structured light mode. The first calculation module is used to determine the phase encoding information of the target object based on the image, and to calculate the first depth of the target object using the phase encoding information; A construction module is used to acquire the edges of the structured light in the image, construct encoding information based on the edges, and obtain edge encoding information; The second calculation module is used to calculate the second depth of the target object based on the edge encoding information; The determination module is used to determine the target depth of the target object from the first depth and the second depth according to preset filtering conditions.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the depth measurement method for the target object according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the depth measurement method for the target object according to any one of claims 1 to 6.