Depth image edge detection method, device and electronic device

By using the space vector angle method in the depth image to detect the edge of the depth image, the problem in the existing technology that it is difficult to intuitively determine the sharpness of the edge is solved, improving the user experience and reducing misjudgment of false edges.

CN113870292BActive Publication Date: 2024-10-01BEIHANG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111063122.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-10
Publication Date
2024-10-01
Estimated Expiration
2041-09-10

AI Technical Summary

Technical Problem

In existing technology, it is difficult to intuitively determine the sharpness of edges in depth image edge detection, resulting in poor user experience.

Method used

The method based on the space vector angle is used to determine the edge point or non-edge point through the vector angle of the three-dimensional space coordinates between the target pixel point and its adjacent pixel points, thereby achieving edge detection of the depth image.

Benefits of technology

This method enables users to intuitively determine the sharpness of edges, improves user experience, and reduces false edge problems due to occlusion through analysis of vector angles.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113870292B_ABST
    Figure CN113870292B_ABST
Patent Text Reader

Abstract

The embodiments of the present application provide a method, device and electronic device for edge detection of a depth image. When performing edge detection on a depth image, for each target pixel in the depth image that belongs to a non-background area, the detection result of the target pixel can be determined based on the vector angle between the three-dimensional spatial coordinates corresponding to the target pixel and the three-dimensional spatial coordinates corresponding to the adjacent pixel of the target pixel. The detection result includes an edge point or a non-edge point, so as to perform edge detection on the depth image. In this way, edge detection of the depth image is performed by using the vector angle between the three-dimensional spatial coordinates corresponding to the target pixel in the depth image and the three-dimensional spatial coordinates corresponding to the adjacent pixel of the target pixel, so that the user can intuitively determine the sharpness of the edge, thereby improving the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a method, device and electronic device for edge detection of a depth image. Background Art

[0002] In the fields of image recognition, target tracking, scene understanding, etc., edge features, as an important natural feature of images, play an important role. Therefore, how to accurately perform edge detection is crucial.

[0003] In the related art, when performing edge detection on a depth image, the edge detection is usually achieved by detecting the depth change on both sides of the edge. In order to detect the depth change on both sides of the edge, the Laplace operator is usually used to perform pixel-by-pixel calculations to obtain the amplitude, and based on the relationship between the amplitude and the preset threshold, it is determined whether the pixel is an edge pixel, thereby achieving edge detection.

[0004] However, when the edge detection of the depth image is performed using the preset threshold method, the sharpness of the edge cannot be determined intuitively, resulting in a poor user experience. Summary of the invention

[0005] The embodiments of the present application provide a method, device and electronic device for edge detection of a depth image based on a spatial vector angle, which can intuitively determine the sharpness of an edge and improve the user experience.

[0006] In a first aspect, an embodiment of the present application provides an edge detection method for a depth image, and the edge detection method for a depth image may include:

[0007] Get the depth image to be detected.

[0008] For each target pixel point belonging to the non-background area in the depth image, the detection result of the target pixel point is determined according to the three-dimensional spatial coordinates corresponding to the target pixel point and the vector angle between the three-dimensional spatial coordinates corresponding to the adjacent pixel points of the target pixel point; wherein the detection result includes edge points or non-edge points to perform edge detection on the depth image.

[0009] In a possible implementation, the number of the adjacent pixel points is multiple, and the detection result of the target pixel point is determined according to the vector angle between the three-dimensional space coordinates corresponding to the target pixel point and the three-dimensional space coordinates corresponding to the adjacent pixel points of the target pixel point, including:

[0010] According to the position of each adjacent pixel point in the plurality of adjacent pixel points, the plurality of adjacent pixel points are divided into a plurality of adjacent pixel point pairs corresponding to the target pixel point; wherein each adjacent pixel point pair includes two adjacent pixel points, and each adjacent pixel point pair includes different adjacent pixel points.

[0011] The vector angles between the three-dimensional space coordinates corresponding to the target pixel point and the three-dimensional space coordinates corresponding to each pair of adjacent pixel points are determined respectively to obtain a plurality of vector angles; wherein the vertices of the vector angles are the three-dimensional space coordinate points corresponding to the target pixel point.

[0012] The detection result of the target pixel point is determined according to the multiple vector angles.

[0013] In a possible implementation manner, determining the detection result of the target pixel point according to the multiple vector angles includes:

[0014] The size of the minimum vector angle among the multiple vector angles is determined as the gradient value corresponding to the target pixel point, and the direction of the minimum vector angle is determined as the gradient direction corresponding to the target pixel point.

[0015] The detection result of the target pixel point is determined according to the gradient value and gradient direction corresponding to the target pixel point.

[0016] In a possible implementation manner, determining the detection result of the target pixel point according to the gradient value and the gradient direction corresponding to the target pixel point includes:

[0017] If the gradient value and the gradient direction corresponding to the target pixel point meet a first preset condition, the target pixel point is determined to be an edge point; if the first preset condition is not met, the target pixel point is determined to be a non-edge point.

[0018] The first preset condition includes: the gradient value corresponding to the target pixel is less than a preset gradient threshold, and the gradient value of the target pixel is less than or equal to the gradient values ​​of two adjacent pixels in the gradient direction.

[0019] In a possible implementation, respectively determining the vector angles between the three-dimensional space coordinates corresponding to the target pixel point and the three-dimensional space coordinates corresponding to each pair of adjacent pixel points to obtain a plurality of vector angles includes:

[0020] Determine an initial vector angle between the three-dimensional space coordinate corresponding to the target pixel point and the three-dimensional space coordinates corresponding to each pair of adjacent pixel points; wherein the vertex of the initial vector angle is the three-dimensional space coordinate point corresponding to the target pixel point.

[0021] For each adjacent pixel pair, if two adjacent pixel points in the adjacent pixel pair meet the second preset condition, the initial vector angle between the three-dimensional space coordinates corresponding to the target pixel point and the three-dimensional space coordinates corresponding to the adjacent pixel pair is increased, and the angle after the increase is determined as the vector angle between the three-dimensional space coordinates corresponding to the target pixel point and the three-dimensional space coordinates corresponding to the adjacent pixel pair.

[0022] If two adjacent pixel points in the adjacent pixel point pair do not meet the second preset condition, and the initial vector angle between the three-dimensional space coordinates corresponding to the target pixel point and the three-dimensional space coordinates corresponding to the adjacent pixel point pair is taken, the vector angle between the three-dimensional space coordinates corresponding to the target pixel point and the three-dimensional space coordinates corresponding to the adjacent pixel point pair is determined.

[0023] Among them, the second preset condition includes: there is a pixel point among two adjacent pixel points whose gradient value is smaller than the gradient value of the target pixel point, and the Euclidean distance between the three-dimensional space coordinates corresponding to the pixel point and the three-dimensional space coordinates corresponding to the target pixel point, and the difference between the Euclidean distance between the three-dimensional space coordinates corresponding to the other pixel point among the two adjacent pixel points and the three-dimensional space coordinates corresponding to the target pixel point is greater than a preset distance threshold.

[0024] In a possible implementation, determining an initial vector angle between the three-dimensional space coordinate corresponding to the target pixel point and the three-dimensional space coordinates corresponding to each pair of adjacent pixel points includes:

[0025] The three-dimensional coordinates corresponding to the target pixel point and each pair of adjacent pixel points are determined respectively.

[0026] An initial vector angle between the target pixel point and each of the adjacent pixel point pairs is determined according to the three-dimensional coordinates corresponding to each of the target pixel point and each of the adjacent pixel point pairs.

[0027] In a second aspect, an embodiment of the present application further provides an edge detection device for a depth image, which may include:

[0028] The acquisition unit is used to acquire the depth image to be detected.

[0029] A processing unit is used to determine, for each target pixel point belonging to the non-background area in the depth image, a detection result of the target pixel point according to a vector angle between the target pixel point and the adjacent pixel points of the target pixel point; wherein the detection result includes an edge point or a non-edge point to perform edge detection on the depth image.

[0030] In a possible implementation, the processing unit is specifically used to divide the multiple adjacent pixel points into multiple adjacent pixel pairs corresponding to the target pixel point according to the positions of each adjacent pixel point in the multiple adjacent pixel points; wherein each adjacent pixel pair includes two adjacent pixel points, and each adjacent pixel pair includes different adjacent pixel points; respectively determine the vector angles between the three-dimensional space coordinates corresponding to the target pixel point and the three-dimensional space coordinates corresponding to each adjacent pixel pair to obtain multiple vector angles; wherein the vertex of the vector angle is the three-dimensional space coordinate point corresponding to the target pixel point; and determine the detection result of the target pixel point based on the multiple vector angles.

[0031] In a possible implementation, the processing unit is specifically used to determine the size of the minimum vector angle among the multiple vector angles as the gradient value corresponding to the target pixel point, and determine the direction of the minimum vector angle as the gradient direction corresponding to the target pixel point; and determine the detection result of the target pixel point according to the gradient value and gradient direction corresponding to the target pixel point. In a possible implementation, the processing unit is specifically used to determine that the target pixel point is an edge point if the gradient value and gradient direction corresponding to the target pixel point meet a first preset condition; and determine that the target pixel point is a non-edge point if the first preset condition is not met; wherein the first preset condition includes: the gradient value corresponding to the target pixel point is less than a preset gradient threshold, and the gradient value of the target pixel point is less than or equal to the gradient values ​​of two adjacent pixels in the gradient direction.

[0032] In a possible implementation, the processing unit is specifically used to determine the initial vector angle between the three-dimensional space coordinates corresponding to the target pixel point and the three-dimensional space coordinates corresponding to each adjacent pixel pair; wherein the vertex of the initial vector angle is the three-dimensional space coordinate point corresponding to the target pixel point; for each adjacent pixel pair, if two adjacent pixel points in the adjacent pixel pair meet the second preset condition, the initial vector angle between the three-dimensional space coordinate corresponding to the target pixel point and the three-dimensional space coordinate corresponding to the adjacent pixel pair is increased, and the angle after the increase is determined as the vector angle between the three-dimensional space coordinate corresponding to the target pixel point and the three-dimensional space coordinate corresponding to the adjacent pixel pair; if two adjacent pixel points in the adjacent pixel pair do not meet the second preset condition, the initial vector angle between the three-dimensional space coordinate corresponding to the target pixel point and the three-dimensional space coordinate corresponding to the adjacent pixel pair is determined as the vector angle between the three-dimensional space coordinate corresponding to the target pixel point and the three-dimensional space coordinate corresponding to the adjacent pixel pair.

[0033] Among them, the second preset condition includes: there is a pixel point among two adjacent pixel points whose gradient value is smaller than the gradient value of the target pixel point, and the Euclidean distance between the three-dimensional space coordinates corresponding to the pixel point and the three-dimensional space coordinates corresponding to the target pixel point, and the difference between the Euclidean distance between the three-dimensional space coordinates corresponding to the other pixel point among the two adjacent pixel points and the three-dimensional space coordinates corresponding to the target pixel point is greater than a preset distance threshold.

[0034] In a possible implementation, the processing unit is specifically used to respectively determine the three-dimensional spatial coordinates corresponding to the target pixel point and each of the adjacent pixel pairs; based on the three-dimensional spatial coordinates corresponding to the target pixel point and each of the adjacent pixel pairs, determine the initial vector angle between the three-dimensional spatial coordinates corresponding to the target pixel point and the three-dimensional spatial coordinates corresponding to each of the adjacent pixel pairs.

[0035] In a third aspect, an embodiment of the present application further provides an electronic device, comprising: a memory, a processor, and a text matching program stored on the memory and executable on the processor, wherein when the text matching program is executed by the processor, the steps of the depth image edge detection method as described in any possible implementation method of the first aspect above are implemented.

[0036] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a text matching program is stored. When the text matching program is executed by a processor, the steps of the edge detection method of the depth image as described in any possible implementation method of the first aspect above are implemented.

[0037] In a fifth aspect, an embodiment of the present application further provides a computer program product, including a computer program, which, when executed by a processor, implements the edge detection method of a depth image described in any possible implementation manner of the first aspect above.

[0038] The edge detection method, device and electronic device of the depth image provided by the embodiments of the present application can determine the detection result of the target pixel point according to the vector angle between the three-dimensional spatial coordinates corresponding to the target pixel point and the three-dimensional spatial coordinates corresponding to the adjacent pixel points of the target pixel point when performing edge detection on the depth image. The detection result includes edge points or non-edge points to perform edge detection on the depth image. In this way, the edge detection of the depth image is performed by using the vector angle between the three-dimensional spatial coordinates corresponding to the target pixel point in the depth image and the three-dimensional spatial coordinates corresponding to the adjacent pixel points of the target pixel point, so that the user can intuitively determine the sharpness of the edge, thereby improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present application.

[0040] Figure 1 It is a flowchart of an edge detection method for a depth image provided by an embodiment of the present application;

[0041] Figure 2 is a schematic diagram of the positional relationship between a target pixel and its multiple adjacent pixels provided in an embodiment of the present application;

[0042] Figure 3 It is a schematic diagram of edge detection using the technical solution provided by the present application, provided in an embodiment of the present application;

[0043] Figure 4 is a schematic diagram of depth edge detection provided by an embodiment of the present application;

[0044] Figure 5 is a structural schematic diagram of an edge detection device for a depth image provided in an embodiment of the present application;

[0045] Figure 6 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application.

[0046] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0047] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0048] In the embodiments of the present application, "at least one" means one or more, and "more" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. In the text description of the present application, the character " / " generally indicates that the associated objects before and after are in an "or" relationship.

[0049] The technical solution provided by the embodiment of the present application can be applied to the scene of image edge detection. At present, image edge detection is involved in many fields. For example, image recognition, target tracking, scene understanding and other fields. In the related art, when performing image edge detection, the Laplace operator is usually used to perform pixel-by-pixel calculations to obtain the amplitude, and based on the size relationship between the amplitude and the preset threshold, it is determined whether the pixel is an edge pixel, thereby realizing edge detection.

[0050] However, using this method, the depth difference on both sides of the edge is not convenient for users to intuitively judge the sharpness of the edge. In particular, when the same edge is at different distances from the camera, the depth difference calculation results on both sides may change accordingly, resulting in a poor user experience.

[0051] In order to intuitively determine the sharpness of the edge, thereby improving the user experience, considering that the sharpness of the edge can be intuitively determined by the spatial vector angle, therefore, an embodiment of the present application provides an edge detection method for a depth image. When performing edge detection on a depth image, for each target pixel point belonging to a non-background area in the depth image, the detection result of the target pixel point can be determined according to the vector angle between the three-dimensional spatial coordinates corresponding to the target pixel point and the three-dimensional spatial coordinates corresponding to the adjacent pixel points of the target pixel point. The detection result includes an edge point or a non-edge point, so as to perform edge detection on the depth image. In this way, by performing edge detection on the depth image through the vector angle between the three-dimensional spatial coordinates corresponding to the target pixel point in the depth image and the three-dimensional spatial coordinates corresponding to the adjacent pixels, the user can intuitively determine the sharpness of the edge, thereby improving the user experience.

[0052] Below, the implementation process of the edge detection method of the depth image provided by the present application will be described in detail in combination with specific application scenarios. It is understandable that the following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments.

[0053] Figure 1 is a flow chart of a depth image edge detection method provided by an embodiment of the present application. The depth image edge detection method can be executed by software and / or hardware devices. The hardware device can be a depth image edge detection device. For example, see Figure 1 As shown, the edge detection method of the depth image may include:

[0054] S101: Acquire a depth image to be detected.

[0055] The depth image refers to the image in which each pixel stores the depth value in the camera coordinate system, which can be recorded as Z C .

[0056] For example, when acquiring the depth image to be detected, the depth image can be directly captured by a hardware device and used as the depth image to be detected; of course, the depth image to be detected can also be acquired by other methods, for example, first acquiring a Z-Buffer buffer map in a graphics rendering (Open Graphics Library, OpenGL) environment, and then converting the Z value into a depth value to obtain the depth image to be detected; the specific settings can be made according to actual needs. Here, the embodiment of the present application does not make any specific restrictions on the method of acquiring the depth image to be detected.

[0057] S102. For each target pixel point belonging to the non-background area in the depth image, determine the detection result of the target pixel point according to the vector angle between the three-dimensional spatial coordinates corresponding to the target pixel point and the three-dimensional spatial coordinates corresponding to the adjacent pixel points of the target pixel point; wherein the detection result includes edge points or non-edge points to perform edge detection on the depth image.

[0058] It should be noted that, in the depth image, points on the far plane or points not measured by the camera can be recorded as meaningless background points in the embodiment of the present application, and the area to which the background points belong is the background area, and in order to avoid subsequently determining the meaningless background points as target pixels, the gradient values ​​of the meaningless background points can be set to large numbers, such as the depth of the far plane. The non-background area refers to the area other than the background area to which the background points belong in the depth image, that is, the area to which the pixels with actual gradient values ​​belong, and the pixels in the non-background area can be recorded as target pixels.

[0059] For example, when determining the target pixel points in the non-background area, the depth image can be traversed to determine whether the pixel points in the depth image are pixels in the non-background area. If the pixel points are pixels in the non-background area, they are the target pixel points; if the pixel points are pixels in the background area, no processing is performed.

[0060] Taking any target pixel as an example, when determining its adjacent pixels, refer to Figure 2 As shown, Figure 2 This is a schematic diagram of the positional relationship between a target pixel point and its multiple adjacent pixel points provided in an embodiment of the present application, wherein the target pixel point is pixel point 0, and the multiple adjacent pixel points of the target pixel point include pixel point 1, pixel point 2, pixel point 3, pixel point 4, pixel point 5, pixel point 6, pixel point 7, and pixel point 8.

[0061] When determining the detection result of the target pixel point based on the vector angle between the three-dimensional space coordinates corresponding to the target pixel point and the three-dimensional space coordinates corresponding to the adjacent pixel points of the target pixel point, given that the method for determining the detection result of each target pixel point is similar, in order to avoid redundancy, the following will take the detection result of any target pixel point in the non-background area as an example to describe how to determine the detection results of each target pixel point in the non-background area.

[0062] For example, when determining the detection result of a target pixel point based on the vector angle between the three-dimensional spatial coordinates corresponding to the target pixel point and the three-dimensional spatial coordinates corresponding to the adjacent pixel points of the target pixel point, the multiple adjacent pixel points can be divided into multiple adjacent pixel pairs corresponding to the target pixel point according to the positions of each adjacent pixel point in the multiple adjacent pixel points; wherein each adjacent pixel pair includes two adjacent pixel points, and each adjacent pixel pair includes different adjacent pixel points; and the vector angle between the three-dimensional spatial coordinate corresponding to the target pixel point and the three-dimensional spatial coordinate corresponding to each adjacent pixel pair is determined respectively to obtain multiple vector angles; wherein the vertex of the vector angle is the three-dimensional spatial coordinate point corresponding to the target pixel; and the detection result of the target pixel point is determined based on the multiple vector angles.

[0063] For example, when dividing multiple adjacent pixels into multiple adjacent pixel pairs corresponding to the target pixel, usually, one target pixel will correspond to eight adjacent pixel pairs, and the pixel at the upper left corner and the pixel at the lower right corner of the target pixel can be determined as an adjacent pixel pair of the target pixel, the pixel at the lower left corner and the pixel at the upper right corner of the target pixel can be determined as an adjacent pixel pair of the target pixel, the pixel to the left and the pixel to the right of the target pixel can be determined as an adjacent pixel pair of the target pixel, and the pixel above and the pixel below the target pixel can be determined as an adjacent pixel pair of the target pixel, corresponding to the directions of 0°, 45°, 90°, and 135°, respectively, thereby obtaining 4 adjacent pixel pairs corresponding to the target pixel. It can be combined with Figure 2 As shown, the four adjacent pixel pairs corresponding to the target pixel 0 include the adjacent pixel pair formed by pixel 1 and pixel 5, the adjacent pixel pair formed by pixel 7 and pixel 3, the adjacent pixel pair formed by pixel 8 and pixel 4, and the adjacent pixel pair formed by pixel 2 and pixel 6.

[0064] After determining the multiple adjacent pixel pairs corresponding to the target pixel point, the vector angles between the three-dimensional space coordinates corresponding to the target pixel point and the three-dimensional space coordinates corresponding to each adjacent pixel pair can be determined. It can be understood that when determining the vector angles between the three-dimensional space coordinates corresponding to the target pixel point and the three-dimensional space coordinates corresponding to each adjacent pixel pair, in view of the similarity in the method of determining the vector angle between the three-dimensional space coordinates corresponding to the target pixel point and the three-dimensional space coordinates corresponding to each adjacent pixel pair, the following will take the determination of the vector angle between the three-dimensional space coordinates corresponding to the target pixel point and the three-dimensional space coordinates corresponding to any adjacent pixel point as an example to describe how to determine the vector angle between the target pixel point and each adjacent pixel pair.

[0065] For example, when determining the vector angle between the three-dimensional space coordinates corresponding to the target pixel point and the three-dimensional space coordinates corresponding to the adjacent pixel point pair, the depth values ​​of the target pixel point and the adjacent pixel points in the adjacent pixel point pair can be first converted into three-dimensional space coordinate values. For details, see the following formula 1:

[0066]

[0067] In the above formula 1, (u, v) is the two-dimensional coordinate in the pixel coordinate system, dx and dy represent the physical size of the pixel in the x-axis and y-axis directions in the two-dimensional coordinate system, (u0, v0) is the coordinate of the camera principal point in the pixel coordinate system, f is the focal length, and Z is the pixel coordinate system. C is the known depth value, and finally the three-dimensional space coordinate value corresponding to the pixel point is obtained, which can be recorded as (X C ,Y C ,Z C ).

[0068] After determining that the depth values ​​of the target pixel and the adjacent pixels in the adjacent pixel pair are converted into three-dimensional spatial coordinate values, the vector angle between the three-dimensional spatial coordinate corresponding to the target pixel and the three-dimensional spatial coordinate corresponding to the adjacent pixel pair can be determined based on the three-dimensional spatial coordinate values ​​of the target pixel and the adjacent pixels in the adjacent pixel pair. For example, taking the target pixel b as an example, its adjacent pixel pair is a and c, the three-dimensional spatial coordinate point corresponding to pixel a is A, the three-dimensional spatial coordinate point corresponding to pixel b is B, and the three-dimensional spatial coordinate point corresponding to pixel c is C. The three-dimensional spatial coordinate point B corresponding to the target pixel b is taken as the starting point, and the vector formed by the other two three-dimensional points A and C in the pixel pair is and The angle between the two vectors and the vector with the three-dimensional space point B corresponding to the target pixel point b as the vertex is ∠ABC.

[0069] After obtaining multiple vector angles based on the above-mentioned determination of the vector angles between the three-dimensional spatial coordinates corresponding to the target pixel point and the three-dimensional spatial coordinates corresponding to each adjacent pixel point pair, the detection result of the target pixel point can be further determined based on the multiple vector angles.

[0070] For example, when determining the detection result of a target pixel point based on multiple vector angles, the size of the minimum vector angle among the multiple vector angles can be determined as the gradient value corresponding to the target pixel point, and the direction of the minimum vector angle can be determined as the gradient direction corresponding to the target pixel point; the detection result of the target pixel point is determined according to the gradient value and gradient direction corresponding to the target pixel point. In this way, when determining the detection result of a target pixel point based on multiple vector angles, the minimum vector angle is determined as the gradient value corresponding to the target pixel point. The minimum vector angle can better reflect the sharpness of the edge, and the user can intuitively determine the detection result of the target pixel point based on the sharpness of the edge.

[0071] For example, when determining the detection result of the target pixel point based on the gradient value and gradient direction corresponding to the target pixel point, the depth image can be traversed again. If the gradient value and gradient direction corresponding to the target pixel point meet the first preset condition, the target pixel point is determined to be an edge point; if the first preset condition is not met, the target pixel point is determined to be a non-edge point. In this way, the detection result of the target pixel point can be determined based on the gradient value and gradient direction corresponding to the target pixel point.

[0072] Among them, the first preset condition includes: the gradient value corresponding to the target pixel is less than the preset gradient threshold, and the gradient value of the target pixel is less than or equal to the gradient values ​​of the two adjacent pixels in the gradient direction. It should be noted that the gradient value of the target pixel is less than or equal to the gradient value of the two adjacent pixels in the gradient direction, which means that the gradient value of the target pixel is not only less than or equal to the gradient value of one of the two adjacent pixels in the gradient direction, but also less than or equal to the gradient value of the other of the two adjacent pixels in the gradient direction.

[0073] Example, combined Figure 2 As shown, assuming that the minimum vector angle is the angle between the target pixel 0 and the adjacent pixel pair formed by pixel 1 and pixel 5, the gradient value of the target pixel is less than or equal to the gradient values ​​of the two adjacent pixel points in the gradient direction, which can be understood as the gradient value of the target pixel 0 is less than or equal to the gradient value of pixel 1 and pixel 5. The value of the preset gradient threshold can be set according to actual needs. Here, the embodiment of the present application does not impose specific restrictions on the value of the preset gradient threshold. For example, Figure 3 is a schematic diagram of edge detection using the technical solution provided by the present application, combined with Figure 3 As shown, Figure 3The grey lines in the figure are the final results of edge extraction using the technical solution provided in this application.

[0074] It can be seen that in the embodiment of the present application, when edge detection is performed on a depth image, for each target pixel in the depth image that belongs to the non-background area, the detection result of the target pixel can be determined based on the vector angle between the three-dimensional spatial coordinates corresponding to the target pixel and the three-dimensional spatial coordinates corresponding to the adjacent pixel of the target pixel, and the detection result includes edge points or non-edge points to perform edge detection on the depth image. In this way, edge detection is performed on the depth image through the three-dimensional spatial coordinates corresponding to the target pixel in the depth image and the vector angle between the three-dimensional spatial coordinates corresponding to the adjacent pixel of the target pixel, so that the user can intuitively determine the sharpness of the edge, thereby improving the user experience.

[0075] In addition, given that the existing technology has the problem of false edges due to occlusion in edge detection, see Figure 4 As shown, Figure 4 is a schematic diagram of the depth edge detection provided by the embodiment of the present application, wherein the coordinate system is the camera coordinate system and is a top view, such as Figure 4 As shown, Figure 4 For pixel b, the depth difference between points A and C can be calculated by the Laplace operator, and then based on the relationship between the amplitude and the preset threshold, if the amplitude is higher than the preset threshold, point B is determined to be an edge point. The same method can be used to calculate the depth difference between B and D, and point C is determined to be an edge point, but from Figure 4 It can be seen from the figure that point C is located to the right of the center of the "depression" and is not a true edge point. Instead, it is a non-edge point that is misjudged as an edge point due to the occlusion of point B. In addition, when judging the false edge caused by occlusion by the positive and negative value of the depth difference, as shown in Figure 4 As shown, the depth difference between point D located at the edge of the "depression" and point C located to the right of the center of the "depression" is the same in positive and negative, and it is impossible to distinguish whether point C and point D correspond to the real edge points.

[0076] Therefore, in the above Figure 1On the basis of the illustrated embodiment, further, in order to solve the problem of false edges caused by occlusion, in the above S102, based on the vector angle between the three-dimensional space coordinates corresponding to the target pixel point and the three-dimensional space coordinates corresponding to the adjacent pixel points of the target pixel point, the initial vector angle between the three-dimensional space coordinates corresponding to the target pixel point and the three-dimensional space coordinates corresponding to each adjacent pixel point pair can be first determined; wherein the vertex of the initial vector angle is the three-dimensional space coordinate point corresponding to the target pixel point; for each adjacent pixel point pair, if two adjacent pixel points in the adjacent pixel point pair meet the second preset condition, the initial vector angle between the three-dimensional space coordinates corresponding to the target pixel point and the three-dimensional space coordinates corresponding to the adjacent pixel point pair is increased, and the angle after the increase is determined as the vector angle between the three-dimensional space coordinates corresponding to the target pixel point and the three-dimensional space coordinates corresponding to the adjacent pixel point pair; if two adjacent pixel points in the adjacent pixel point pair do not meet the second preset condition, the initial vector angle between the three-dimensional space coordinates corresponding to the target pixel point and the three-dimensional space coordinates corresponding to the adjacent pixel point pair is determined to determine the vector angle between the three-dimensional space coordinates corresponding to the target pixel point and the three-dimensional space coordinates corresponding to the adjacent pixel point pair.

[0077] The second preset condition includes: the gradient value of one pixel point among two adjacent pixels is less than the gradient value of the target pixel point, and the difference between the Euclidean distance between the three-dimensional space coordinates corresponding to the pixel point and the three-dimensional space coordinates corresponding to the target pixel point and the Euclidean distance between the three-dimensional space coordinates corresponding to the other pixel point among the two adjacent pixels and the three-dimensional space coordinates corresponding to the target pixel point is greater than a preset distance threshold. The value of the preset distance threshold can be set according to actual needs. Here, the embodiment of the present application does not make specific restrictions on the value of the preset distance threshold.

[0078] For example, when determining the initial vector angle between the three-dimensional space coordinates corresponding to the target pixel point and the three-dimensional space coordinates corresponding to each adjacent pixel pair, the three-dimensional space coordinates corresponding to the target pixel point and each adjacent pixel pair can be determined respectively, and then the initial vector angle between the three-dimensional space coordinates corresponding to the target pixel point and the three-dimensional space coordinates corresponding to each adjacent pixel pair can be determined based on the three-dimensional space coordinates corresponding to the target pixel point and each adjacent pixel pair.

[0079] By setting the second preset condition, the initial vector angle corresponding to the pixel points located on the false edge can be increased, and then by setting the first preset condition, the pixel points located on the false edge can be eliminated.

[0080] In this way, after determining the initial vector angle of the vector angle between the three-dimensional space coordinates corresponding to the target pixel point and the three-dimensional space coordinates corresponding to the adjacent pixel points of the target pixel point, it is possible to further determine whether the target pixel point meets the second preset condition. If the target pixel point meets the second preset condition, it is determined that the target pixel point is located on a false edge, and the initial angle is increased. The increased angle is the gradient value of the target pixel point, and the corresponding direction is the gradient direction of the target pixel point. By setting the first preset condition, the pixels located on the false edge can be eliminated, thereby solving the problem of false edges caused by occlusion in edge detection.

[0081] Figure 5 is a schematic diagram of the structure of a depth image edge detection device 50 provided in an embodiment of the present application. For example, see Figure 5 As shown, the edge detection device 50 of the depth image may include:

[0082] The acquisition unit 501 is used to acquire a depth image to be detected.

[0083] The processing unit 502 is used to determine the detection result of the target pixel point for each target pixel point belonging to the non-background area in the depth image according to the vector angle between the target pixel point and the adjacent pixel points of the target pixel point; wherein the detection result includes edge points or non-edge points to perform edge detection on the depth image.

[0084] Optionally, there are multiple adjacent pixel points; the processing unit 502 is specifically used to divide the multiple adjacent pixel points into multiple adjacent pixel pairs corresponding to the target pixel point according to the positions of each adjacent pixel point in the multiple adjacent pixel points; wherein each adjacent pixel pair includes two adjacent pixel points, and each adjacent pixel pair includes different adjacent pixel points; respectively determine the vector angle between the target pixel point and each adjacent pixel pair to obtain multiple vector angles; wherein the vertex of the vector angle is the target pixel point; and determine the detection result of the target pixel point based on the multiple vector angles.

[0085] Optionally, the processing unit 502 is specifically used to determine the size of the minimum vector angle among multiple vector angles as the gradient value corresponding to the target pixel point, and determine the direction of the minimum vector angle as the gradient direction corresponding to the target pixel point; determine the detection result of the target pixel point according to the gradient value and gradient direction corresponding to the target pixel point.

[0086] Optionally, the processing unit 502 is specifically used to determine that the target pixel point is an edge point if the gradient value and gradient direction corresponding to the target pixel point meet a first preset condition; if the first preset condition is not met, determine that the target pixel point is a non-edge point; wherein the first preset condition includes: the gradient value corresponding to the target pixel point is less than a preset gradient threshold, and the gradient value of the target pixel point is less than or equal to the gradient value of two adjacent pixel points in the gradient direction.

[0087] Optionally, the processing unit 502 is specifically used to determine the initial vector angle between the three-dimensional space coordinates corresponding to the target pixel point and the three-dimensional space coordinates corresponding to each adjacent pixel pair; wherein the vertex of the initial vector angle is the three-dimensional space coordinate point corresponding to the target pixel point; for each adjacent pixel pair, if two adjacent pixel points in the adjacent pixel pair meet the second preset condition, the initial vector angle between the three-dimensional space coordinate corresponding to the target pixel point and the three-dimensional space coordinate corresponding to the adjacent pixel pair is increased, and the angle after the increase is determined as the vector angle between the three-dimensional space coordinate corresponding to the target pixel point and the three-dimensional space coordinate corresponding to the adjacent pixel pair; if two adjacent pixel points in the adjacent pixel pair do not meet the second preset condition, the initial vector angle between the three-dimensional space coordinate corresponding to the target pixel point and the three-dimensional space coordinate corresponding to the adjacent pixel pair is used to determine the vector angle between the three-dimensional space coordinate corresponding to the target pixel point and the three-dimensional space coordinate corresponding to the adjacent pixel pair.

[0088] Among them, the second preset condition includes: there is a pixel point among two adjacent pixel points whose gradient value is smaller than the gradient value of the target pixel point, and the Euclidean distance between the three-dimensional space coordinates corresponding to the pixel point and the three-dimensional space coordinates corresponding to the target pixel point, and the difference between the Euclidean distance between the three-dimensional space coordinates corresponding to the other pixel point among the two adjacent pixel points and the three-dimensional space coordinates corresponding to the target pixel point is greater than the preset distance threshold.

[0089] Optionally, the processing unit 502 is specifically used to respectively determine the three-dimensional spatial coordinates corresponding to the target pixel point and each adjacent pixel pair; based on the three-dimensional coordinates corresponding to the target pixel point and each adjacent pixel pair, determine the initial vector angle between the three-dimensional spatial coordinates corresponding to the target pixel point and the three-dimensional spatial coordinates corresponding to each adjacent pixel pair.

[0090] The edge detection device 50 of the depth image provided in the embodiment of the present application can execute the technical solution of the edge detection method of the depth image in any of the above-mentioned embodiments. Its implementation principle and beneficial effects are similar to the implementation principle and beneficial effects of the edge detection method of the depth image. Please refer to the implementation principle and beneficial effects of the edge detection method of the depth image, and no further details will be given here.

[0091] Figure 6is a schematic diagram of the structure of an electronic device 60 provided in an embodiment of the present application, for example, see Figure 6 As shown, the electronic device 60 may include a processor 601 and a memory 602; wherein,

[0092] The memory 602 is used to store computer programs.

[0093] The processor 601 is used to read the computer program stored in the memory 602 and execute the technical solution of the edge detection method of the depth image in any of the above embodiments according to the computer program in the memory 602.

[0094] Optionally, the memory 602 may be independent or integrated with the processor 601. When the memory 602 is a device independent of the processor 601, the electronic device 60 may further include: a bus for connecting the memory 602 and the processor 601.

[0095] Optionally, this embodiment further includes: a communication interface, which can be connected to the processor 601 through a bus. The processor 601 can control the communication interface to implement the acquisition and transmission functions of the electronic device 60.

[0096] The electronic device 60 shown in the embodiment of the present application can execute the technical solution of the edge detection method of the depth image in any of the above-mentioned embodiments. Its implementation principle and beneficial effects are similar to the implementation principle and beneficial effects of the edge detection method of the depth image. Please refer to the implementation principle and beneficial effects of the edge detection method of the depth image, and no further details will be given here.

[0097] An embodiment of the present application also provides a computer-readable storage medium, which stores computer executable instructions. When a processor executes the computer executable instructions, the technical solution of the edge detection method of the depth image in any of the above embodiments is implemented. The implementation principle and beneficial effects are similar to the implementation principle and beneficial effects of the edge detection method of the depth image. Please refer to the implementation principle and beneficial effects of the edge detection method of the depth image, which will not be repeated here.

[0098] An embodiment of the present application also provides a computer program product, including a computer program. When the computer program is executed by a processor, it implements the technical solution of the edge detection method of the depth image in any of the above embodiments. The implementation principle and beneficial effects are similar to the implementation principle and beneficial effects of the edge detection method of the depth image. Please refer to the implementation principle and beneficial effects of the edge detection method of the depth image, which will not be repeated here.

[0099] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0100] The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, each functional unit in each embodiment of the present application may be integrated into a processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0101] The above-mentioned integrated module implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (English: processor) to perform some steps of the methods of various embodiments of the present application.

[0102] It should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the invention may be directly implemented as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.

[0103] The memory may include a high-speed RAM memory, and may also include a non-volatile storage NVM, such as at least one disk memory, and may also be a USB flash drive, a mobile hard disk, a read-only memory, a magnetic disk or an optical disk, etc.

[0104] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present application is not limited to only one bus or one type of bus.

[0105] The computer-readable storage medium may be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The storage medium may be any available medium that can be accessed by a general or special purpose computer.

[0106] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for edge detection of a depth image, characterized in that: include: Acquire a depth image to be detected; For each target pixel point belonging to the non-background area in the depth image, determine the detection result of the target pixel point according to the three-dimensional space coordinates corresponding to the target pixel point and the vector angle between the three-dimensional space coordinates corresponding to the adjacent pixel points of the target pixel point; wherein the detection result includes edge points or non-edge points, so as to perform edge detection on the depth image; The number of the adjacent pixel points is multiple, and the detection result of the target pixel point is determined according to the vector angle between the three-dimensional space coordinates corresponding to the target pixel point and the three-dimensional space coordinates corresponding to the adjacent pixel points of the target pixel point, including: according to the position of each adjacent pixel point in the multiple adjacent pixel points, the multiple adjacent pixel points are divided into multiple adjacent pixel point pairs corresponding to the target pixel point; wherein each adjacent pixel point pair includes two adjacent pixel points, and the adjacent pixel points included in each adjacent pixel point pair are different; Determine respectively the vector angles between the three-dimensional space coordinates corresponding to the target pixel point and the three-dimensional space coordinates corresponding to each pair of adjacent pixel points, and obtain a plurality of vector angles; wherein the vertex of the vector angle is the three-dimensional space coordinate corresponding to the target pixel point; Determine the size of the minimum vector angle among the multiple vector angles as the gradient value corresponding to the target pixel point, and determine the direction of the minimum vector angle as the gradient direction corresponding to the target pixel point; If the gradient value and the gradient direction corresponding to the target pixel point meet a first preset condition, the target pixel point is determined to be an edge point; if the first preset condition is not met, the target pixel point is determined to be a non-edge point; The first preset condition includes: the gradient value corresponding to the target pixel is less than a preset gradient threshold, and the gradient value of the target pixel is less than or equal to the gradient values ​​of two adjacent pixels in the gradient direction.

2. The method according to claim 1, characterized in that The step of respectively determining the vector angles between the three-dimensional space coordinates corresponding to the target pixel point and the three-dimensional space coordinates corresponding to each pair of adjacent pixel points to obtain a plurality of vector angles includes: Determine an initial vector angle between the three-dimensional space coordinate corresponding to the target pixel point and the three-dimensional space coordinate corresponding to each pair of adjacent pixel points; wherein the vertex of the initial vector angle is the three-dimensional space coordinate point corresponding to the target pixel point; For each pair of adjacent pixel points, if two adjacent pixel points in the pair of adjacent pixel points meet the second preset condition, an initial vector angle between the three-dimensional space coordinates corresponding to the target pixel point and the three-dimensional space coordinates corresponding to the pair of adjacent pixel points is increased, and the angle after the increase is determined as the vector angle between the three-dimensional space coordinates corresponding to the target pixel point and the three-dimensional space coordinates corresponding to the pair of adjacent pixel points; If two adjacent pixel points in the adjacent pixel point pair do not satisfy the second preset condition, the initial vector angle between the three-dimensional space coordinate corresponding to the target pixel point and the three-dimensional space coordinate corresponding to the adjacent pixel point pair is determined as the vector angle between the three-dimensional space coordinate corresponding to the target pixel point and the three-dimensional space coordinate corresponding to the adjacent pixel point pair; Among them, the second preset condition includes: there is a pixel point among two adjacent pixel points whose gradient value is smaller than the gradient value of the target pixel point, and the Euclidean distance between the three-dimensional space coordinates corresponding to the pixel point and the three-dimensional space coordinates corresponding to the target pixel point, and the difference between the Euclidean distance between the three-dimensional space coordinates corresponding to the other pixel point among the two adjacent pixel points and the three-dimensional space coordinates corresponding to the target pixel point is greater than a preset distance threshold.

3. A depth image edge detection device, characterized in that: include: An acquisition unit, used for acquiring a depth image to be detected; A processing unit, for determining, for each target pixel belonging to a non-background area in the depth image, a detection result of the target pixel according to a vector angle between a three-dimensional spatial coordinate corresponding to the target pixel and a three-dimensional spatial coordinate corresponding to an adjacent pixel of the target pixel; wherein the detection result includes an edge point or a non-edge point, so as to perform edge detection on the depth image; The number of the adjacent pixel points is multiple, and the processing unit is specifically used to divide the multiple adjacent pixel points into multiple adjacent pixel pairs corresponding to the target pixel point according to the positions of each adjacent pixel point in the multiple adjacent pixel points; wherein each adjacent pixel pair includes two adjacent pixel points, and each adjacent pixel pair includes different adjacent pixel points; respectively determine the vector angles between the three-dimensional space coordinates corresponding to the target pixel point and the three-dimensional space coordinates corresponding to each adjacent pixel pair to obtain multiple vector angles; wherein the vertex of the vector angle is the three-dimensional space coordinate corresponding to the target pixel point; determine the size of the minimum vector angle among the multiple vector angles as the gradient value corresponding to the target pixel point, and determine the direction of the minimum vector angle as the gradient direction corresponding to the target pixel point; if the gradient value and gradient direction corresponding to the target pixel point meet a first preset condition, determine the target pixel point as an edge point; if the first preset condition is not met, determine the target pixel point as a non-edge point; wherein the first preset condition includes: the gradient value corresponding to the target pixel point is less than a preset gradient threshold, and the gradient value of the target pixel point is less than or equal to the gradient values ​​of two adjacent pixels in the gradient direction.

4. An electronic device, characterized in that: The electronic device comprises: a memory, a processor, and a text matching program stored in the memory and executable on the processor, wherein the text matching program implements the steps of the edge detection method of the depth image as claimed in claim 1 or 2 when executed by the processor.

5. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a text matching program, and when the text matching program is executed by the processor, the steps of the edge detection method of the depth image as claimed in claim 1 or 2 are implemented.

6. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the edge detection method of the depth image described in claim 1 or 2 is implemented.