Point cloud data plane detection method and device, electronic equipment and readable storage medium
By judging the significant adjacency relationship and spacing threshold within a plane pair, and combining the condition of the number of interference points, a progressive judgment is made on whether to merge extremely narrow planes. This solves the problem of erroneous merging in traditional algorithms and improves the accuracy and efficiency of plane detection in point cloud data.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- FAIR INNOVATION (SUZHOU) ROBOTIC SYSTEM CO LTD
- Filing Date
- 2025-10-13
- Publication Date
- 2026-04-17
AI Technical Summary
When processing extremely narrow planar point cloud data, existing technologies often suffer from erroneous merging problems due to traditional algorithms, which leads to distorted planar detection results and low efficiency.
By judging the significant adjacency relationship within a plane pair, the separation of adjacent lines, the number of adjacent points and the spacing threshold, and combining the condition of the number of interference points, a progressive judgment is made on whether to merge planes to avoid erroneous merging.
It improves the accuracy and efficiency of planar detection for extremely narrow planar point cloud data, avoids erroneous merging, and ensures the quality of merging results.
Smart Images

Figure CN120931637B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of welding technology, and more specifically, to a method, apparatus, electronic device, and readable storage medium for plane detection of point cloud data. Background Technology
[0002] With the continuous advancement of 3D scanning and point cloud processing technologies, planar inspection plays an increasingly important role in the field of welding technology. For example, accurately detecting planar structures in point cloud data is a key step in identifying the location of weld seams on workpieces.
[0003] Although this plane detection algorithm achieves good detection results in most cases, it still faces challenges of high complexity and low efficiency when processing point cloud data containing planes with similar heights. Furthermore, when extremely narrow planes exist in the point cloud data, the very small spatial distance between these planes can lead to erroneous merging during the plane merging stage of traditional algorithms, resulting in distorted plane detection results.
[0004] Therefore, there is an urgent need to propose a detection method suitable for point clouds with extremely narrow planar surfaces, so as to improve the accuracy and efficiency of planar detection in point cloud data. Summary of the Invention
[0005] In view of this, the purpose of the present invention is to provide a method, apparatus, electronic device and readable storage medium for plane detection of point cloud data, which is applicable to point cloud data with extremely narrow planes and can improve the accuracy and efficiency of plane detection in point cloud data.
[0006] To achieve the above objectives, the technical solutions adopted in the embodiments of the present invention are as follows:
[0007] In a first aspect, the present invention provides a method for plane detection in point cloud data, the method comprising: obtaining a pair of planes to be merged in point cloud data; if it is determined that two planes in the pair have a significant adjacency relationship, then determining whether the two planes are effectively separated by adjacent straight lines between the two planes; otherwise, determining whether they can be merged based on the number of adjacent points of the two planes; if they are not effectively separated, then merging the two planes; otherwise, calculating the distance between the two planes; if the distance is less than a preset distance threshold, then merging the two planes; otherwise, identifying interference points located between the two planes and determining whether the number of interference points meets a preset condition; wherein the preset condition is: the ratio of the number of interference points to the length of adjacent straight lines is less than a preset ratio or the number of interference points is less than a preset point number threshold; if not met, then merging the two planes; otherwise, no processing is performed.
[0008] Secondly, the present invention provides a point cloud data plane detection device, further comprising: an acquisition module for acquiring a pair of planes to be merged in the point cloud data; a detection module for determining whether the two planes are effectively separated by adjacent lines if it is determined that the two planes in the plane pair have a significant adjacency relationship; the detection module for determining whether the two planes can be merged based on the number of adjacent points of the two planes; the detection module for merging the two planes if the result of the determination module is that they are not effectively separated, otherwise calculating the distance between the two planes; the detection module for merging the two planes if the distance is less than a preset distance threshold, otherwise identifying interference points located between the two planes; the determination module for determining whether the number of interference points meets a preset condition; wherein the preset condition is: the ratio of the number of interference points to the length of adjacent lines is less than a preset ratio or the number of interference points is less than a preset point number threshold; the detection module for merging the two planes if the result of the determination module is not met, otherwise not processing.
[0009] Thirdly, the present invention provides an electronic device including a processor and a memory, wherein the memory stores machine-executable instructions that can be executed by the processor, and the processor can execute the machine-executable instructions to implement the point cloud data plane detection method described in any of the foregoing embodiments.
[0010] Fourthly, the present invention provides a readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements any of the point cloud data plane detection methods described in the foregoing embodiments.
[0011] The point cloud data plane detection method, apparatus, electronic device, and readable storage medium provided in this invention first identify plane pairs to be merged from the point cloud data. Then, it assesses whether the two planes within the pair have a significant adjacency relationship. If they do not have a significant adjacency relationship, it quickly determines whether merging is possible based on the number of shared adjacent points. Otherwise, it further checks whether the two planes are effectively separated by adjacent straight lines. If the result is that they are not effectively separated, the two planes are directly merged. However, if the result is that merging is still not immediately possible, the actual distance between the two planes is calculated and compared with a set distance threshold. If the distance is less than this threshold, the two planes are still merged. Otherwise, it is necessary to further identify possible interference points between the two planes, count the number of these points, and check whether their number meets a preset condition. Only if the condition is met is the final merging operation performed; otherwise, the original state is maintained without any processing. The entire process can progressively determine whether planes can be merged layer by layer, which not only improves the merging speed but also ensures the quality of the merging results. It is particularly suitable for processing point cloud data with the risk of extremely narrow planes.
[0012] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0013] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0014] Figure 1 A schematic diagram of a point cloud containing an extremely narrow plane is given;
[0015] Figure 2 This is a schematic flowchart of a point cloud data plane detection method provided in an embodiment of the present invention;
[0016] Figure 3 This is a schematic diagram illustrating significantly adjacent and non-significantly adjacent surfaces provided in an embodiment of the present invention;
[0017] Figure 4 This is a schematic diagram illustrating the relationship between adjacent lines and two planes provided in an embodiment of the present invention;
[0018] Figure 5 This is a schematic diagram illustrating the effect of the point cloud data plane detection method provided in an embodiment of the present invention;
[0019] Figure 6 This is a functional block diagram of the point cloud data plane detection device provided in an embodiment of the present invention;
[0020] Figure 7 This is a structural block diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0021] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0022] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.
[0023] It should be noted that relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprising", "including" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements not only includes those elements, but also includes other elements not expressly listed, or also includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising a..." does not exclude the presence of additional identical elements in the process, method, article or device comprising the element.
[0024] The existing methods for detecting the plane of point cloud data mainly include the following steps:
[0025] Step 1: Perform an initial plane detection on the point cloud data to obtain an initial plane list;
[0026] Step 2: Traverse the initial plane list, group the planes according to the normal direction, and obtain multiple plane groups; among them, the planes within the same group have similar normal directions, and the normal directions of the planes in different groups are not similar.
[0027] Step 3: For the planes within the same group, select two planes each time and determine whether the two planes can be merged.
[0028] There are two ways to judge. One is to judge whether there are enough adjacent points between the two planes. If so, merge the two planes; if not, do not merge the two planes. Another judgment method is the clustering analysis method, that is, cluster the points on the two planes respectively to obtain the number of clusters of the two planes, denoted as num_1 and num_2; then cluster the union of the points on the two planes to obtain the number of clusters num. If num_1 + num_2 < num, it means that the two planes can be merged.
[0029] Step 4: If they can be merged, merge the two planes, return to Step 3; otherwise, do nothing and directly return to Step 3 until there are no planes that can be merged.
[0030] The above method obtains the final plane detection result by continuously merging planes.
[0031] The inventor found during the research process that: when there are extremely narrow planes in the point cloud, incorrect plane detection results are likely to occur. As Figure 1 shown Figure 1A point cloud diagram containing extremely narrow planes is provided. Extremely narrow planes typically refer to planes with a height of less than 4mm, and the close proximity of these planes makes traditional plane merging algorithms based on "neighbor point count" or "cluster analysis" prone to incorrectly merging extremely narrow planes that do not belong to the same result into a single plane, leading to inaccurate final detection results. Even with optimization by adjusting parameters such as the neighbor point count threshold or the neighborhood search radius, it is still difficult to effectively avoid such erroneous detections.
[0032] Therefore, this invention provides a point cloud data plane detection method that can quickly and correctly merge planes during the plane merging stage, avoiding the phenomenon of incorrectly merging extremely narrow planes, improving the accuracy and efficiency of plane detection results, and is applicable to point clouds containing extremely narrow planes.
[0033] Please see Figure 2 , Figure 2 This is a schematic flowchart of a point cloud data plane detection method provided in an embodiment of the present invention. The method includes steps S201 to S205, which are described below:
[0034] S201: Obtain the plane pairs to be merged in the point cloud data;
[0035] S202: If it is determined that two planes within a plane pair have a significant adjacency relationship, then determine whether the two planes are effectively separated by the adjacent lines between the two planes; otherwise, determine whether they can be merged based on the number of adjacent points of the two planes.
[0036] S203: If the two planes are not effectively separated, merge them; otherwise, calculate the distance between the two planes.
[0037] S204: If the spacing is less than the preset distance threshold, then merge the two planes; otherwise, identify the interference points located between the two planes and determine whether the number of interference points meets the preset conditions.
[0038] In this embodiment of the invention, the preset condition is: the ratio of the number of interference points to the length of adjacent straight lines is less than a preset ratio or the number of interference points is less than a preset threshold.
[0039] S205: If satisfied, merge the two planes; otherwise, do nothing.
[0040] It should be understood that "no processing" means not merging the two planes, returning to step S201 to obtain a new pair of planes to be merged, and repeating the above process.
[0041] The point cloud data plane detection method provided in this embodiment of the invention first identifies the plane pairs to be merged from the point cloud data. Then, it assesses whether the two planes within the pair have a significant adjacency relationship. If they do not have a significant adjacency relationship, it quickly determines whether merging is possible based on the number of shared adjacent points. Otherwise, it further checks whether the two planes are effectively separated by adjacent straight lines. If the result is that they are not effectively separated, the two planes are directly merged. However, if the result is that they are effectively separated but merging is still not immediately possible, the actual distance between the two planes is calculated and compared with a set distance threshold. If the distance is less than this threshold, the two planes are still merged. Otherwise, it is necessary to further identify possible interference points between the two planes, count the number of these points, and check whether their number meets a preset condition. Only if the condition is met is the final merging operation performed; otherwise, the original state is maintained without any processing. The entire process can progressively determine whether planes can be merged layer by layer, which not only improves the merging speed but also ensures the quality of the merging results. It is particularly suitable for processing point cloud data with the risk of extremely narrow planes.
[0042] Next, the embodiments of the present invention will provide a clear and detailed description of the above-described point cloud data detection process in conjunction with the accompanying drawings.
[0043] In step S201, this embodiment of the invention first obtains the plane pairs to be merged. Here, "plane pairs to be merged" refers to two planes that have the potential to be merged. These plane pairs can be obtained through steps a1 to a3, as explained below:
[0044] Step a1: Obtain the grouping results corresponding to all planes identified from the point cloud data;
[0045] In this embodiment of the invention, plane detection can be performed on the point cloud data in advance to obtain the plane detection results, i.e., all initial planes. Then, the initial planes with normal angles less than a preset angle threshold are grouped into the same group, thus obtaining multiple plane groups, denoted as plane_group. If the number of plane groups is N, where N is greater than or equal to 1, then the i-th plane group can be denoted as plane_group_i.
[0046] Optionally, the aforementioned preset included angle threshold can be flexibly set by relevant personnel according to actual needs, and is not limited here.
[0047] Step a2: Within each plane group, combine the planes pairwise to obtain candidate plane pairs and determine the number of adjacent points for each candidate plane pair;
[0048] In this embodiment of the invention, for each plane group, if there is only one plane in the group, that plane can be directly used as the plane detection result, and the subsequent plane merging process is not executed. If there are at least two planes in the group, the planes can be combined in pairs to obtain candidate plane pairs.
[0049] To facilitate rapid identification of potentially merging plane pairs, this embodiment of the invention can pre-obtain the plane numbers and the number of adjacent points corresponding to the two planes within each pair. Here, "plane number" refers to the plane's position within the plane group, and "number of adjacent points" refers to the number of points on the two planes that are spatially adjacent, reflecting the "adjacency" between the two planes. A higher value indicates that the two planes are spatially closer and more likely to belong to the same plane, serving as a crucial basis for determining whether to merge. This information is pre-stored in an array denoted as `neighbors`, where each element of `neighbors` contains the plane number and the number of adjacent points for a plane pair, facilitating direct retrieval and use later.
[0050] In one embodiment of the present invention, the number of adjacent points of two planes is obtained as follows: For ease of description, the two planes in the plane pair are respectively denoted as plane 1 and plane 2. Specifically:
[0051] First, calculate the centroid coordinates of plane 1. Then, construct a kd-tree for the point cloud on plane 2, denoted as kdtree_2, and find the n points in kdtree_2 that are closest to the centroid coordinates of plane 1, where n can be set as the product of the number of points on plane 2 and a preset scaling factor. Next, construct a kd-tree for the point cloud on plane 1 as well, denoted as kdtree_1. Then, traverse the n points obtained in the previous steps, using these points as centers and searching within kdtree_1 according to a preset search radius, and take each found point as an adjacent point of plane 1 and plane 2. Finally, count all found adjacent points to obtain the final number of adjacent points. By calculating the number of adjacent points, we can quantify whether there are enough points connecting the two planes, serving as a preliminary basis for whether they can be merged.
[0052] Optionally, after determining the number of adjacent points for each plane pair, the elements in `neighbors` can be sorted in descending order of the number of adjacent points. Then, plane pairs with potential for merging are determined sequentially according to this sorting order. This prioritizes plane pairs with high adjacency, avoids blindly trying all plane pairs, reduces invalid judgments, and improves algorithm efficiency and accuracy.
[0053] Step a3: For each plane group, if the number of adjacent points between two planes in the candidate plane pair is greater than or equal to a preset threshold, then the candidate plane pair is determined to be a plane pair to be merged.
[0054] In this embodiment of the invention, for each plane group, the potential for merging between two planes can be quickly determined based on the number of adjacent points in each plane pair within the group. Specifically, a threshold can be preset, and then it is determined whether the number of adjacent points is greater than or equal to the preset threshold. If it is greater, it indicates that the two planes in the plane pair have a potential for merging, i.e., the plane pair to be merged is obtained as described in this embodiment of the invention; otherwise, there is no potential for merging, and the plane pair is not the plane pair to be merged.
[0055] It should be noted that if there are no plane pairs to be merged in a plane group, each plane can be directly output as the final plane detection result, and the subsequent merging process will not be executed.
[0056] Through the above implementation methods, this invention can exclude plane pairs with low adjacency that do not meet the basic merging conditions, thereby reducing unnecessary merging attempts. The identified plane pairs to be merged will serve as input for subsequent plane merging processes. This approach not only ensures the accuracy of the results but also improves algorithm efficiency and avoids invalid judgments.
[0057] Based on the plane pairs to be merged obtained in step S201, this embodiment of the invention first preliminarily filters plane pairs that meet the merging conditions by determining whether the two planes have a significant adjacency relationship, thus improving the plane detection efficiency. Specifically, this embodiment of the invention provides the implementation methods as described in steps b1 to b2 to determine the significant adjacency relationship between planes, as explained below:
[0058] Step b1: Determine adjacent lines;
[0059] In this embodiment of the invention, "adjacent straight lines" refer to the boundary lines of two adjacent planes in space, providing spatial reference lines for subsequent determination of whether these two planes should be merged. To accurately locate the adjacent straight lines between two planes, one embodiment of the invention provides implementation methods for steps b1-1 to b1-4, as described below:
[0060] Step b1-1: Detect the edge lines of each plane;
[0061] In this embodiment of the invention, during the process of detecting edge lines, all corner points of the two planes can be found using the coordinate axis collision detection method, and the edge lines of the planes can be obtained by connecting all the corner points.
[0062] For ease of subsequent description, the edge lines of one plane will be denoted as lines_1, and the edge lines of the other plane will be denoted as lines_2. For quick and direct reading, lines_1 and lines_2 will be stored together in an array, denoted as lines.
[0063] Step b1-2: For each edge line, determine the adjacent points of the edge line in each plane;
[0064] In this embodiment of the invention, a threshold can be preset to obtain points adjacent to the edge line in two planes. Specifically, each point on each plane can be traversed, and then the distance from the point to the edge line can be calculated to see if it is less than the threshold. If it is, the point is considered an adjacent point; otherwise, it is not an adjacent point. In this way, all adjacent points on two planes can be obtained quickly.
[0065] Step b1-3: Based on all adjacent points of each edge line, obtain all intersection lines of the two planes; where intersection lines refer to the line segments of the edge lines of the two planes that have spatial overlap or adjacency.
[0066] Step b1-4: Determine the intersection lines with the maximum line length as adjacent lines.
[0067] For ease of understanding, in actual implementation, we can use `i` to traverse `lines`, determine the adjacent points on the two planes near `lines[i]`, and then determine the intersection line of the two planes based on the adjacent points, denoted as `inter_line_i`. Store `inter_line_i` in `inter_lines`, and store the length of the intersection line in `inter_lengths`. Continue traversing `i` until it is complete. Find the largest value `value` and its index in `inter_lengths`.
[0068] The above implementation method can quickly locate adjacent lines between two planes. It should be noted that during the above process, there may be instances where two planes do not intersect, i.e., the value in inter_lengths is 0. In this case, it can be directly determined that the two planes do not have a significant adjacency relationship.
[0069] Step b2: If the length of an adjacent line is greater than or equal to a preset length, then a significant adjacency relationship is determined.
[0070] In this embodiment of the invention, if the length of the adjacent straight lines is relatively long, that is, greater than or equal to the preset length, it indicates that there is a clear and stable boundary line between the two planes, and the two planes have a relatively stable connection in space and have a stable adjacency relationship; conversely, if the length of the adjacent straight lines is relatively short, less than the preset length, it indicates that the two planes may be locally close due to factors such as extremely narrow spatial distance or noise.
[0071] To better understand the difference between significantly adjacent and insignificant planes, please refer to [link to relevant documentation]. Figure 3 , Figure 3This diagram illustrates significantly adjacent and non-significantly adjacent surfaces according to embodiments of the present invention. For two planes that are significantly adjacent, embodiments of the present invention can adopt different processing methods depending on different situations:
[0072] Case 1: The two planes do not have a significant adjacent relationship.
[0073] In this embodiment of the invention, two planes do not have a significant adjacency relationship, indicating that the adjacency relationship between the two planes is local and unstable, but they may still be the same structure. Therefore, this embodiment of the invention uses the "number of adjacent points" as a criterion to quickly determine whether two planes can be merged. Specifically, the two planes are merged when the number of adjacent points between them is greater than a preset threshold; otherwise, they cannot be merged. In this way, even if two planes do not have a significant adjacency relationship, as long as there are enough adjacent points between them, they may still be two local segments of the same structure, thus allowing for accurate merging of such planes.
[0074] Case 2: The two planes are significantly adjacent.
[0075] In this embodiment of the invention, if two planes are significantly adjacent, this only indicates that there is a stable spatial adjacency between the two planes, but it does not mean that they necessarily belong to the same plane. For example, two independent, extremely narrow planes may be significantly adjacent due to their very small spatial distance, and their point cloud distribution may appear to be a whole, but they cannot be merged and further judgment is required.
[0076] Based on the above considerations, this embodiment of the invention further determines whether two planes are effectively separated by adjacent straight lines between them, in order to identify whether the two planes belong to a "continuous structure" or an "independent structure," thereby deciding whether they should be merged. As shown in steps d1 to d4, the determination method is as follows:
[0077] Step d1: Determine the first and second planes in the plane pair, as well as the centroid coordinates of the first plane;
[0078] In this embodiment of the invention, a planar coordinate system can be pre-established before executing step d1 to facilitate the analysis of the centroid coordinates and the positional relationship between points on the subsequent plane and adjacent lines. Here, "positional relationship" refers to which side of the line a point or centroid is located on and on that line. When establishing the coordinate system, it can be established on any plane, and the coordinate axes of the coordinate system should be perpendicular to the normal of the selected plane.
[0079] For ease of description, assume the planes in the plane pair are plane 1 and plane 2. Then, a coordinate system can be established on either plane 1 or plane 2, denoted as t1t2. The t1 axis and the t2 axis are perpendicular to each other, and both the t1 axis and the t2 axis are perpendicular to the normal to either plane 1 or plane 2.
[0080] Based on the above preparatory work, determine the centroid coordinates of the first plane for establishing the coordinate system. The average coordinates of all points on the first plane can be used as the centroid coordinates of that plane. Then execute step d2.
[0081] Step d2: Determine the positional relationship between the centroid coordinates and the coordinates of adjacent centroids.
[0082] In this embodiment of the invention, the equations of adjacent lines can be obtained first. Specifically, the normal vectors of adjacent lines can be determined first, denoted as n_line, where n_line(0) and n_line(1) represent the x and y components of n_line, respectively; the direction vectors of the adjacent lines can be obtained by projecting the two endpoints of the adjacent lines onto the t1t2 coordinate system. Let... Since the term is a constant, the equation of the adjacent line can be directly obtained by combining the vector and the normal of the line, denoted as . .
[0083] After obtaining the equations of adjacent lines using the above method, the centroid coordinates are substituted into the equations of the adjacent lines to determine which side the centroid lies on. For ease of description, if the equation value obtained by substituting the coordinates is less than 0, it is denoted as the centroid coordinates being on the negative side of the adjacent line; if the equation value is equal to 0, it is denoted as the centroid coordinates being on the adjacent line; and if the equation value is greater than 0, it is denoted as the centroid coordinates being on the positive side of the adjacent line. This process can be expressed using conditional expressions: Where mass_1_t is the coordinate vector (x_mass, y_mass) of the centroid in the t1t2 coordinate system; It is a vector dot product operation.
[0084] It should be understood that the terms "positive side" and "negative side" in the above description are merely used in this embodiment of the invention to distinguish the different positional relationships of the centroid relative to adjacent straight lines, i.e., located on different sides of adjacent straight lines. It is a relative concept and not an absolute one.
[0085] In order to distinguish different positional relationships through the above implementation methods, this embodiment of the invention can also set a positional relationship identifier, denoted as mass_sign. If it is on the positive side, mass_sign can be assigned a first value, for example, mass_sign=1; if it is on the negative side, mass_sign can be assigned a second value, for example, mass_sign=-1. The positional relationship identifier can be used to count the number of points located on different sides of the second plane in subsequent operations, thereby improving efficiency.
[0086] It should be understood that the above method of assigning values to positional relationship identifiers is merely an example, intended to distinguish positional relationships under different circumstances. Relevant personnel may flexibly adopt other values according to actual needs, and no restrictions are imposed here.
[0087] Step d3: Count the total number of points on the second plane and the number of points on the second plane whose positional relationship is opposite to that of the points on the second plane.
[0088] In this embodiment of the invention, similar to the centroid of the first plane, for each point on the second plane, the equations of the adjacent lines can be substituted sequentially, and the position of each point on the positive or negative side of the adjacent line can be determined based on the magnitude of the equation value and 0. If the centroid is on the positive side, the number of points on the second plane located on the negative side is counted; if the centroid is on the negative side, the number of points on the second plane located on the positive side is counted, thereby obtaining the number of points whose positional relationship with the centroid is opposite.
[0089] In practical implementation, to improve efficiency, the number of points with the opposite positional relationship to the centroid can be directly counted based on the following conditional relationship: Among them, p i This represents the i-th point on the second plane. p i In the coordinate system t1t2, set a counter, denoted as num_2_line, for the coordinates. If p i If the above conditions are met, then num_2_line is incremented by 1. This process is repeated until every point on the second plane is reached. The final num_2_line is the number of points whose positional relationship with the centroid is opposite.
[0090] Step d4: If the ratio of the number of points to the total number of points is greater than or equal to the ratio threshold, then the points are determined to be effectively separated; otherwise, they are not effectively separated.
[0091] In this embodiment of the invention, if the condition of step d4 is not met, it indicates that most points on the second plane are on the same side as the centroid of the first plane, and the adjacent lines fail to effectively separate the two planes. In this case, the two planes may have a "nested" adjacent relationship, and the two planes meet the merging condition. If the above condition is met, it indicates that the adjacent lines can effectively separate the two planes, and it can be further determined whether to merge them.
[0092] To better understand the concept of "effective separation," please refer to [link / reference]. Figure 4 , Figure 4This is a schematic diagram illustrating the relationship between adjacent lines and two planes provided in an embodiment of the present invention. (a) indicates that adjacent lines effectively separate planes 1 and 2, and (b) indicates that adjacent lines do not effectively separate planes 1 and 2. If adjacent lines fail to effectively separate the two planes, it means that the two planes are partially overlapping or nested in terms of geometric structure. They may be local regions of the same large plane, rather than two independent planes. In this case, they should be merged into a single plane. Otherwise, further judgment is required, i.e., step S203 should be executed.
[0093] In step S203, if it is determined that adjacent lines can effectively separate two planes, it indicates that the two planes are geometrically separated. However, this does not mean that they are two independent planes. For example, extremely narrow planes with independent structures may be very close together in space.
[0094] Based on the above considerations, the embodiments of the present invention further adopt a distance evaluation mechanism to identify whether two planes are extremely narrow planes. Specifically, the distance from the centroid of the second plane to the first plane can be calculated, and then in step S204, corresponding measures are taken according to the different judgment situations of the spacing and the preset spacing threshold.
[0095] Scenario 1: Spacing is less than the preset distance threshold
[0096] In this embodiment of the invention, based on the judgment results of the preceding steps S202 to S203, when two planes are "significantly adjacent", "can be separated by adjacent straight lines" and "the distance between them is less than a preset distance threshold", it indicates that they appear to be independent in terms of geometric structure, but their spatial distance is too close, indicating that they are likely to belong to two local segments of the same structure in terms of physical structure, and therefore can be reasonably merged.
[0097] Case 2: The spacing is greater than or equal to the preset distance threshold.
[0098] Based on the judgment results of steps S202 to S203 above, when two planes are "significantly adjacent", "can be separated by adjacent straight lines", and "the distance between them is greater than or equal to a preset distance threshold", it only indicates that they appear to be geometrically independent, but there is a certain gap in space. This gap may be caused by "interference points" or other structures. Therefore, further judgment is required.
[0099] Based on the above considerations, in step S204, once it is determined that the distance between the two planes is greater than or equal to the preset distance threshold, the interference point located between the two planes is determined and it is judged whether the number of interference points meets the preset condition.
[0100] In this embodiment of the invention, the interference point between two planes can be determined by the following steps:
[0101] Step e1: Obtain all candidate points that do not belong to either of the two planes;
[0102] In this embodiment of the invention, candidate points include points on other planes and points not assigned to any plane.
[0103] Step e2: Determine whether each candidate point meets the preset screening criteria;
[0104] In this embodiment of the invention, the filtering conditions include: located between two planes; the distance from the second plane is within a preset distance range; the projection lies within an adjacent straight line; and the distance from the adjacent straight line is less than or equal to a second distance threshold.
[0105] In other words, a candidate point is considered an interference point only if it satisfies each of the above sub-conditions.
[0106] Step e3: If yes, then the candidate point is determined to be an interference point; otherwise, it is not an interference point.
[0107] In practical implementation, a counter, denoted as Num between, can be set. Traverse all initial planes; for each initial plane, traverse all points p on the plane. j Determine p j If all the above conditions are met simultaneously, then `num_between` is incremented by 1, until every point on each initial plane has been traversed. Similarly, a similar traversal method can be used to traverse each unassigned point, using the same conditions for judgment; if the judgment conditions are met, `num_between` is incremented by 1. The final `num_between` then represents the number of interfering points.
[0108] Based on the statistically determined number of interference points, this embodiment of the invention designs a judgment condition to determine whether two planes can be merged. Specifically, the ratio of the number of interference points to the length of adjacent lines is less than a preset ratio, or the number of interference points is less than a preset threshold. This means there exists a conditional relationship: num_between / length of adjacent lines >= preset ratio and num_between >= preset number of points. Therefore, in step S205, if the number of interference points does not meet the above preset condition, it indicates that there are many interference points between the two planes, near the adjacent lines. The two planes do not belong to the same structure and are not the same plane; therefore, they cannot be merged. Otherwise, the two planes can be merged.
[0109] Through the above implementation methods, the embodiments of the present invention can quickly merge mergeable plane pairs in a plane group and avoid the problem of erroneous merging.
[0110] In one embodiment of the present invention, for each plane group, after merging the plane pairs to be merged, the following steps may also be performed:
[0111] Step f1: Add the new plane obtained by merging to the target plane group containing the two planes;
[0112] Step f2: Remove the two planes from the target plane group;
[0113] Step f3: After updating the candidate plane pairs and the number of adjacent points in the target plane group based on the new plane, return to execute S201 until there are no more plane pairs to be merged.
[0114] The above implementation method can quickly and accurately complete the merging task of all mergeable plane pairs in a plane group.
[0115] In one embodiment of the present invention, when there are no plane pairs to be merged in each plane group, the planes in each plane group can be combined into plane pairs again, and the above steps S201 to S205 can be repeated until the merging conditions are no longer met between all planes, thereby obtaining a complete plane detection result. The whole process avoids the problem of erroneous merging.
[0116] To facilitate a more intuitive understanding of the planar detection effect of this invention's embodiments, please refer to [link / reference]. Figure 5 , Figure 5 This is a schematic diagram illustrating the effect of the point cloud data plane detection method provided in an embodiment of the present invention. Combined with... Figure 1 The embodiments of the present invention can correctly detect all planes when there are extremely narrow planes in the point cloud.
[0117] In summary, the point cloud data plane detection method provided in this embodiment of the invention can correctly detect planes even when extremely narrow planes exist in the point cloud. In the initial plane detection stage, many small planes are detected. Some of these planes belong to the same plane and need to be merged, while others are very close to each other but cannot be merged. When merging two planes, this embodiment of the invention first finds the adjacent straight lines between the two planes and then determines the length of the adjacent straight lines. If the length is very short, the number of adjacent points between the two planes is used for judgment. If the length is long, it first determines whether the adjacent straight lines effectively separate the two planes. If they cannot effectively separate them, the planes are merged. If they can effectively separate them, the distance between the two planes and whether there are other interfering points between the two planes and near the adjacent straight lines are determined. When the adjacent straight lines can effectively separate the two planes, the distance between the two planes meets the requirements, and there are other interfering points near the adjacent straight lines and between the planes, plane merging is not performed. Therefore, planes that are very close to each other will not be incorrectly merged during the plane merging stage, while planes belonging to the same plane can be correctly merged.
[0118] To perform the corresponding steps in the above embodiments and various possible methods, an implementation of a point cloud data plane detection device 60 is given below. Please refer to [link to relevant documentation]. Figure 6 , Figure 6 This is a functional block diagram of a point cloud data plane detection device provided in an embodiment of the present invention. The point cloud data plane detection device 60 includes:
[0119] The acquisition module 601 is used to obtain the plane pairs to be merged in the point cloud data;
[0120] The detection module 602 is used to determine whether the two planes are effectively separated by the adjacent straight lines between them if the two planes are determined to have a significant adjacent relationship. Otherwise, the detection module 602 is used to determine whether the two planes can be merged based on the number of adjacent points of the two planes.
[0121] The detection module 602 is used to merge the two planes if the result of the judgment module is that they are not effectively separated; otherwise, it calculates the distance between the two planes.
[0122] The detection module 602 is used to merge two planes if the distance is less than a preset distance threshold, otherwise determine the interference point located between the two planes. The judgment module 603 is used to determine whether the number of interference points meets the preset conditions. The preset conditions are: the ratio of the number of interference points to the length of the adjacent straight line is less than a preset ratio or the number of interference points is less than a preset number threshold.
[0123] The detection module 602 is used to merge the two planes if the result of the judgment module is not satisfied; otherwise, no processing is performed.
[0124] It is understandable that the acquisition module 601, the detection module 602, and the judgment module 603 can be executed collaboratively. Figure 2 Each step in the process is used to achieve the corresponding technical effect.
[0125] It should be noted that the point cloud data plane detection device 60 provided in this embodiment of the invention has the same basic principle and technical effect as the above embodiments. For the sake of brevity, any parts not mentioned in this embodiment can be referred to the corresponding content in the above embodiments.
[0126] Optionally, the above modules can be stored in the form of software or firmware. Figure 7 The memory shown is either stored in or embedded in the operating system (OS) of the electronic device 70, and can be used by... Figure 7 The processor executes the commands. Meanwhile, the data and program code required to execute these modules can be stored in memory.
[0127] Please see Figure 7 , Figure 7 The structural block diagram of the electronic device provided in the embodiment of the present invention includes a memory 701, a processor 702, and a communication interface 703. The memory 701, processor 702, and communication interface 703 are electrically connected to each other directly or indirectly to realize data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines.
[0128] Optionally, the bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized into address buses, data buses, control buses, etc. For ease of representation, Figure 7 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0129] In this embodiment of the invention, the processor 702 may be a general-purpose processor, a digital signal processor, an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components, and may implement or execute the methods, steps, and logic block diagrams disclosed in this embodiment of the invention. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in this embodiment of the invention may be directly implemented by the hardware processor, or implemented by a combination of hardware and software modules within the processor. The software modules may be located in the memory 701, and the processor 702 reads the program instructions from the memory 701 and, in conjunction with its hardware, completes the steps of the above methods.
[0130] In this embodiment of the invention, the memory 701 can be a non-volatile memory, such as a hard disk drive (HDD) or a solid-state drive (SSD), or it can be volatile memory, such as RAM. The memory can also be any other medium capable of carrying or storing desired executable program code having an instruction or data structure form and accessible by a computer, but is not limited thereto. The memory in this embodiment of the invention can also be a circuit or any other device capable of implementing a storage function for storing instructions and / or data.
[0131] The memory 701 can be used to store software programs and modules, such as the instructions / modules of the point cloud data plane detection device 60 provided in this embodiment of the invention. These can be stored in the memory 701 in the form of software or firmware, or embedded in the operating system (OS) of the electronic device 70. The processor 702 executes various functional applications and data processing by executing the software programs and modules stored in the memory 701. The communication interface 703 can be used to communicate with other node devices for signaling or data.
[0132] Understandable. Figure 7 The structure shown is for illustrative purposes only; the electronic device 70 may also include components that are more advanced than those shown. Figure 7 The more or fewer components shown, or having the same Figure 7 The different configurations shown. Figure 7 The components shown can be implemented using hardware, software, or a combination thereof.
[0133] Based on the above embodiments, the present invention also provides a readable storage medium storing a computer program. When the computer program is executed by a computer, it causes the computer to perform the point cloud data plane detection method provided in the above embodiments. For specific implementation, please refer to the method embodiments, which will not be repeated here.
[0134] The present invention can also provide a computer program product for performing a point cloud data plane detection method, including a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods in the preceding method embodiments. For specific implementation, please refer to the method embodiments, which will not be repeated here.
[0135] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and there may be other division methods in actual implementation. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the coupling or direct coupling or communication connection shown or discussed may be through some communication interface; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0136] Furthermore, the units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the objectives of the embodiments of the present invention, depending on actual needs.
[0137] Furthermore, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0138] It should be noted that if the function is implemented as a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, electronic device, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0139] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A point cloud data plane detection method, characterized in that, The method includes: Obtain the plane pairs to be merged in the point cloud data; If it is determined that two planes within the plane pair have a significant adjacency relationship, then it is determined whether the two planes are effectively separated by the adjacent straight lines between the two planes. Otherwise, it is determined whether the two planes can be merged based on the number of adjacent points of the two planes. That is, the two planes are merged when the number of adjacent points of the two planes is greater than a preset threshold for the number of adjacent points; otherwise, they cannot be merged. If they are not effectively separated, then the two planes are merged; otherwise, the distance between the two planes is calculated. If the distance is less than a preset distance threshold, the two planes are merged; otherwise, interference points located between the two planes are identified and it is determined whether the number of interference points meets a preset condition. The preset condition is that the ratio of the number of interference points to the length of adjacent straight lines is less than a preset ratio or the number of interference points is less than a preset number threshold. If the conditions are not met, the two planes are merged; otherwise, no action is taken. Determining whether the two planes are effectively separated by adjacent straight lines between them includes: determining the first plane and the second plane in the plane pair, and the centroid coordinates of the first plane; wherein the first plane is a plane on which a coordinate system is established, and the second plane is not on which the coordinate system is established; determining the positional relationship between the centroid coordinates and the adjacent straight lines; counting the total number of points on the second plane and the number of points on the second plane with the opposite positional relationship; if the ratio of the number of points to the total number of points is greater than or equal to a ratio threshold, then it is determined that they are effectively separated; otherwise, they are not effectively separated.
2. The point cloud data plane detection method of claim 1, wherein, If it is determined that two planes within the plane pair have a significant adjacency relationship, including: Determine the adjacent straight lines; If the length of the adjacent lines is greater than or equal to the preset length, then the significant adjacency relationship is determined.
3. The point cloud data plane detection method according to claim 2, characterized in that, Determining the adjacent straight lines includes: Detect the edge lines of each of the planes; For each of the edge lines, determine the adjacent points of the edge lines in each plane; Based on all the adjacent points of each edge line, the complete intersection lines of the two planes are obtained; The intersection lines with the maximum line length are identified as the adjacent lines.
4. The point cloud data plane detection method according to claim 1, characterized in that, Determining the interference point located between the two planes includes: Obtain all candidate points that do not belong to the two planes; wherein, the candidate points include points on other planes and points not assigned to any plane; Determine whether each candidate point meets the preset screening conditions; The filtering conditions include: located between the two planes; the distance from the second plane is within a preset distance range; projected into the adjacent straight line; and the distance from the adjacent straight line is less than or equal to a second distance threshold. If so, then the candidate point is determined to be the interference point; otherwise, it is not the interference point.
5. The point cloud data plane detection method according to any one of claims 1 to 4, characterized in that, Obtain the plane pairs to be merged in the point cloud data, including: Obtain the grouping results corresponding to all planes identified from the point cloud data; wherein, the normal angle between planes within the same plane group is less than a preset angle threshold; Within each plane group, the planes are paired to obtain candidate plane pairs and the number of adjacent points for each candidate plane pair is determined; For each plane group, if the number of adjacent points between two planes in the candidate plane pair is greater than or equal to a preset threshold, then the candidate plane pair is determined to be a plane pair to be merged.
6. The point cloud data plane detection method according to claim 5, characterized in that, The method further includes: The new plane obtained by merging is added to the target plane group containing the two planes; Remove the two planes from the target plane group; After updating the candidate plane pairs and adjacent point counts in the target plane group based on the new plane, the process returns to the step of obtaining the plane pairs to be merged in the point cloud data until there are no more plane pairs to be merged in the target plane group.
7. A point cloud data plane detection device, characterized in that, Also includes: The acquisition module is used to obtain the plane pairs to be merged in the point cloud data; The detection module is used to determine whether the two planes are effectively separated by the adjacent straight lines between them if it is determined that the two planes have a significant adjacent relationship. Otherwise, the detection module is used to determine whether the two planes can be merged based on the number of adjacent points of the two planes. That is, the two planes are merged when the number of adjacent points of the two planes is greater than a preset threshold for the number of adjacent points; otherwise, they cannot be merged. The detection module is used to merge the two planes if the result of the judgment module is that they are not effectively separated; otherwise, it calculates the distance between the two planes. The detection module is used to merge the two planes if the spacing is less than a preset distance threshold, otherwise determine the interference point located between the two planes. The judgment module is used to judge whether the number of interference points meets a preset condition. The preset condition is: the ratio of the number of interference points to the length of the adjacent straight line is less than a preset ratio or the number of interference points is less than a preset number threshold. The detection module is used to merge the two planes if the result of the judgment module is not satisfied; otherwise, no processing is performed. The detection module is specifically used to: determine the first plane and the second plane in the plane pair, as well as the centroid coordinates of the first plane; wherein the first plane is a plane on which a coordinate system is established, and the second plane does not have the coordinate system established; determine the positional relationship between the centroid coordinates and the adjacent straight lines; count the total number of points on the second plane and the number of points on the second plane with the opposite positional relationship; if the ratio of the number of points to the total number of points is greater than or equal to a ratio threshold, then it is determined that they are effectively separated; otherwise, they are not effectively separated.
8. An electronic device, characterized in that, It includes a processor and a memory, the memory storing a computer program that can be executed by the processor, the processor being able to execute the computer program to implement the point cloud data plane detection method according to any one of claims 1-6.
9. A readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the point cloud data plane detection method as described in any one of claims 1-6.
Citation Information
Patent Citations
Target object detection method and device and computer equipment
CN110992356A
Volume measurement device based on depth camera
CN113532267A