CN117745728B - Point cloud plane detection method and device, electronic equipment and readable storage medium - Google Patents

Point cloud plane detection method and device, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN117745728B
CN117745728B CN202410190279.8A CN202410190279A CN117745728B CN 117745728 B CN117745728 B CN 117745728B CN 202410190279 A CN202410190279 A CN 202410190279A CN 117745728 B CN117745728 B CN 117745728B
Authority
CN
China
Prior art keywords
point cloud
plane
points
detection
preset
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202410190279.8A
Other languages
Chinese (zh)
Other versions
CN117745728A (en
Inventor
宋昱
束健
杜冬晖
郭胜男
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Faoyiwei Suzhou Robot System Co ltd
Original Assignee
Faoyiwei Suzhou Robot System Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Faoyiwei Suzhou Robot System Co ltd filed Critical Faoyiwei Suzhou Robot System Co ltd
Priority to CN202410190279.8A priority Critical patent/CN117745728B/en
Publication of CN117745728A publication Critical patent/CN117745728A/en
Application granted granted Critical
Publication of CN117745728B publication Critical patent/CN117745728B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Length Measuring Devices With Unspecified Measuring Means (AREA)

Abstract

The application provides a point cloud plane detection method, a point cloud plane detection device, electronic equipment and a readable storage medium. After the detection of the current round is completed, reducing the resolution of the current round to obtain updated resolution, building octree according to the updated resolution to obtain a plurality of voxel units, and carrying out the plane detection of the next round based on the points in each voxel unit until the preset condition is met, and stopping the plane detection. According to the scheme, the resolution is gradually reduced to establish the octree, so that the effect of rapidly and accurately detecting all planes existing in the point cloud can be achieved on the basis of gradually reduced voxel units and then rapidly detecting planes with smaller areas in the point cloud under the condition that planes with larger areas in the point cloud are detected.

Description

Point cloud plane detection method and device, electronic equipment and readable storage medium
Technical Field
The invention relates to the technical field of three-dimensional point cloud processing, in particular to a point cloud plane detection method, a device, electronic equipment and a readable storage medium.
Background
In the existing plane detection method, planes in the cloud are detected generally by voting, taking the existing RHT (random Hough transform ) algorithm as an example, 3 points are randomly selected from the point cloud, then plane parameters theta, phi and rho of planes passing through the 3 points are calculated, voting positions are calculated by a certain quantization step length, and voting is carried out at corresponding positions in a voting accumulator. Wherein θ represents the angle between the projection of the plane normal on the xy plane and the x axis, φ represents the angle between the plane normal and the z axis, ρ represents the distance from the origin of coordinates to the plane. If the number of votes exceeds a preset value, a plane is considered to be detected, points near the plane are deleted, then the same voting operation is performed on the rest points until the number of points remained in the point cloud is smaller than a preset value, and the algorithm stops.
As can be seen from the process of detecting planes by the RHT algorithm, when points are randomly selected from the point cloud, the points are selected from the whole point cloud, and a problem is caused by selecting points in such a way that when points are selected from the point cloud, the probability that 3 points fall on the same plane with a small area is greatly reduced when the points are selected from the point cloud, for example, a cylindrical surface, and a long voting process is required to accumulate a sufficient number of votes. Sometimes even a situation arises where the proportion of points on a plane to the remaining points is already very low, because the area of this plane is too small, in which case the program may in fact have to wait a very long time, although it can theoretically detect this plane with a sufficient number of votes, resulting in that the detection of this plane may become infeasible. For example, fig. 1 shows a schematic view of a point cloud of a workpiece, which is a very flat workpiece with a height of 30mm, a length of 1150mm, and a width of 925mm, having 2 flat surfaces on top of each other and a number of cylindrical surfaces. When the plane is detected by the existing RHT algorithm, 2 planes with large areas can be detected quickly, and corresponding points on the planes can be deleted. The remaining point cloud at this time mainly includes some long and narrow planes of the side surfaces, some planes with small areas and cylindrical surfaces. In this case, the plane detection process is continued, so that long and narrow planes are detected, but the voting times are obviously increased, and when the planes are deleted, only planes and cylindrical surfaces with small areas remain, and the plane with small areas still cannot be detected after the voting process is carried out for a long time. The main reason for this is that, as stated above, the proportion of points on the plane to the remaining points is too small, resulting in a low probability that all 3 points fall on the plane, and thus cannot be detected effectively.
Disclosure of Invention
The invention aims at providing a point cloud plane detection method, a point cloud plane detection device, an electronic device and a readable storage medium, which can rapidly and accurately detect all planes existing in a point cloud.
Embodiments of the invention may be implemented as follows:
In a first aspect, the present invention provides a method for detecting a point cloud plane, the method comprising:
In the plane detection of each round, establishing an octree for a point cloud according to the resolution of the current round to obtain a plurality of voxel units, wherein each point in the point cloud belongs to one voxel unit in the plurality of voxel units;
For each voxel unit, performing plane detection based on points in the voxel unit, and marking the detected points on the plane as invalid points, wherein the detection is performed based on non-invalid points during plane detection;
After the detection of the current round is completed, reducing the resolution of the current round to obtain updated resolution, building an octree to a point cloud according to the updated resolution to obtain a plurality of voxel units, and carrying out the plane detection of the next round based on the points in each voxel unit until the preset condition is met, and stopping the plane detection.
In an alternative embodiment, the step of performing plane detection based on points in the voxel unit includes:
Randomly selecting a group of point cloud groups from the points in the voxel units each time, and judging whether the selected point cloud groups meet preset requirements or not;
under the condition that the preset requirements are met, detecting whether the same plane is determined by the point cloud groups which exceed the preset number and meet the preset requirements, and if so, judging that the plane is detected;
and when the set condition is met, finishing plane detection based on the points in the voxel unit.
In an alternative embodiment, the step of ending the plane detection based on the points in the voxel unit when the set condition is met comprises:
adding 1 to the accumulated voting count when the point cloud group is randomly selected each time, and adding 1 to the accumulated invalid voting count when the selected point cloud group does not meet the preset requirement;
and when the accumulated voting count exceeds a first preset count or the accumulated invalid voting count exceeds a second preset count, judging that a set condition is met and finishing plane detection based on points in the voxel units.
In an optional embodiment, each point cloud group includes three points, and the step of determining whether the selected point cloud group meets a preset requirement includes:
calculating vectors between every two points in the three points in the selected point cloud group, and calculating according to the vectors to obtain plane normal vectors;
Judging whether the selected point cloud group meets the preset requirement or not according to the vector, the plane normal vector and the normal vector of each point.
In an optional embodiment, the step of determining whether the selected point cloud group meets a preset requirement according to the vector, the plane normal vector and the normal vector of each point includes:
Judging whether the obtained module length of each vector is larger than a preset module length, if so, judging whether the included angles between the plane normal vector and the normal vector of each point are smaller than a first preset included angle;
if the angles are smaller than the first preset included angle, judging whether the included angle between every two normal vectors in the normal vectors of each point is smaller than the second preset included angle or not;
if the point cloud groups are smaller than the second preset included angles, judging that the selected point cloud groups meet preset requirements.
In an alternative embodiment, the step of detecting whether the same plane is determined by the cloud group with more than a preset number of points meeting the preset requirement, and if so, determining that the plane is detected includes:
calculating to obtain plane parameters of a corresponding plane based on points in the point cloud group meeting preset requirements, and counting the planes;
And adding 1 to the count of the planes when the plane parameters calculated by the point cloud group are detected to be consistent with the plane parameters of the planes each time, and judging that the planes are detected when the count of the planes exceeds the preset number.
In an alternative embodiment, the predetermined condition is determined to be satisfied when the updated resolution is less than the predetermined resolution.
In a second aspect, the present invention provides a point cloud plane detection apparatus, the apparatus comprising:
The establishing module is used for establishing an octree for a point cloud according to the resolution of the current round in the plane detection of each round to obtain a plurality of voxel units, wherein each point in the point cloud belongs to one of the voxel units;
The detection module is used for carrying out plane detection on each voxel unit based on points in the voxel units and marking the detected points on the plane as invalid points, wherein the detection is carried out based on the invalid points during the plane detection;
And the updating module is used for reducing the resolution of the current round to obtain updated resolution after the detection of the current round is completed, establishing an octree to obtain a plurality of voxel units according to the updated resolution and carrying out the plane detection of the next round based on the points in each voxel unit until the preset condition is met, and stopping the plane detection.
In a third aspect, the invention provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing a method according to any of the preceding embodiments when executing the program.
In a fourth aspect, the present invention provides a computer readable storage medium having stored thereon a computer program which when executed by a processor implements a method according to any of the preceding embodiments.
The beneficial effects of the embodiment of the invention include, for example:
The application provides a point cloud plane detection method, a device, electronic equipment and a readable storage medium. After the detection of the current round is completed, reducing the resolution of the current round to obtain updated resolution, building octree according to the updated resolution to obtain a plurality of voxel units, and carrying out the plane detection of the next round based on the points in each voxel unit until the preset condition is met, and stopping the plane detection. According to the scheme, the resolution is gradually reduced to establish the octree, so that the effect of rapidly and accurately detecting all planes existing in the point cloud can be achieved on the basis of gradually reduced voxel units and then rapidly detecting planes with smaller areas in the point cloud under the condition that planes with larger areas in the point cloud are detected.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the embodiments will be briefly described below, it being understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a point cloud schematic of a workpiece model;
FIG. 2 is a flow chart of point cloud plane detection provided by an embodiment of the present application;
FIG. 3 is a flow chart of sub-steps included in step S12 of FIG. 2;
FIG. 4 is a flowchart of sub-steps included in step S121 of FIG. 3;
FIG. 5 is a flowchart of sub-steps included in step S1212 of FIG. 4;
FIG. 6 is a flowchart of sub-steps included in step S122 of FIG. 3;
FIG. 7 is a flowchart of sub-steps included in step S123 of FIG. 3;
FIG. 8 is a functional block diagram of a point cloud plane detection device according to an embodiment of the present application;
Fig. 9 is a block diagram of an electronic device according to an embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. The components of the embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the invention, as presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures.
In the description of the present invention, it should be noted that, if the terms "first," "second," and the like are used merely to distinguish the descriptions, they are not to be construed as indicating or implying relative importance.
It should be noted that the features of the embodiments of the present invention may be combined with each other without conflict.
Referring to fig. 2, a flowchart of a point cloud plane detection method according to an embodiment of the present application may be implemented by a point cloud plane detection apparatus, where the point cloud plane detection apparatus may be implemented by software and/or hardware, and may be configured in an electronic device, and the electronic device may be a computer device. The detailed steps of the point cloud plane detection method are described below.
S11, in the plane detection of each round, establishing an octree for a point cloud according to the resolution of the current round to obtain a plurality of voxel units, wherein each point in the point cloud belongs to one of the voxel units.
And S12, carrying out plane detection on each voxel unit based on points in the voxel units, and marking the detected points on the plane as invalid points, wherein the detection is carried out based on the non-invalid points during the plane detection.
And S13, after the detection of the current round is completed, reducing the resolution of the current round to obtain updated resolution, building octree to point cloud according to the updated resolution to obtain a plurality of voxel units, and carrying out the plane detection of the next round based on the points in each voxel unit until the preset condition is met, and stopping the plane detection.
In this embodiment, the point cloud to be detected may be obtained by capturing a target object with a depth camera, extracting the point cloud based on a captured image, or performing model construction on the target object on a computer device, and extracting based on the constructed model. The target object may be a workpiece model, such as the workpiece model shown in FIG. 1.
One or more planes exist in the point cloud to be detected, and the embodiment aims to detect the planes existing in the point cloud so as to facilitate subsequent application processing.
In this embodiment, when performing plane detection on the point cloud, the plane detection may include multiple rounds of plane detection, and when performing plane detection on each round of plane detection, the processing procedure is similar, where the difference is that performing octree construction on the point cloud based on different resolutions to obtain multiple voxel units.
The octree construction of the point cloud can be understood as surrounding the points in the point cloud by a large bounding box, and the bounding box can be divided into a plurality of voxel units, each voxel unit can be understood as a cube, and the points in the point cloud belong to one voxel unit in the plurality of voxel units.
The resolution employed in building an octree for a point cloud will affect the size (e.g., volume) of each voxel unit, e.g., where the resolution is greater, each voxel unit in the built octree is larger, and where the resolution is smaller, each voxel unit is smaller. With the same density, the larger the voxel unit, the larger the number of points contained therein, and the smaller the voxel unit, the smaller the number of points contained therein. In this embodiment, when performing plane detection, plane detection is performed for points in a single voxel unit, respectively.
For a plane with a larger area in the point cloud, when the plane with the larger area is determined by selecting the points in the point cloud, even when the number of the points in the point cloud is larger, the probability that the selected points fall on the plane with the larger area is larger, that is, the plane with the larger area can be detected more quickly and accurately. Therefore, in this embodiment, the resolution set at the initial stage may be large, and thus the voxel unit obtained is large.
In this embodiment, when constructing the octree based on the initial resolution, the initial resolution may be set to be twice the maximum range of the point cloud, and all points in the point cloud may be concentrated in the same voxel unit, that is, the points in the point cloud are not segmented into different voxel units. Voxel elements are understood to be leaf nodes, in which case the entire point cloud is detected as one leaf node.
In this way, in the initial round, plane detection can be performed based on the global range of the point cloud, thereby detecting the point in which the area is large.
In this embodiment, in implementation, for an initial round, a set of voxel neighbor_index [0] may be set, and each point in the point cloud has a point label corresponding to it, and the point labels of all points in the point cloud may be stored in the set voxel neighbor_index [0], so that the plane detection is performed based on all points in the point cloud stored in the set voxel neighbor_index [0] in the initial round.
In this embodiment, after each detection of a plane, the detected point on the plane is marked as an invalid point, that is, the invalid point will not participate in subsequent plane detection. As such, as plane detection progresses, the number of points remaining in the point cloud is getting smaller.
On the one hand, the number of remaining points in the point cloud is smaller and smaller, and on the other hand, a plane with a larger area in the point cloud is detected at a larger resolution, and some points with a smaller area may remain in the point cloud. When points in the point cloud are selected to detect planes of smaller area, the probability that the selected points fall on the planes of smaller area will be small, and it is difficult to quickly and accurately detect these planes of smaller area.
Therefore, in the present embodiment, the plane detection of the next round will be entered, and at the time of the plane detection of the next round, the updated resolution will be obtained by decreasing the current resolution, and the plane detection of the next round will be performed based on the updated resolution. The updated resolution is lower, meaning that the size of each voxel unit in the constructed octree will decrease, and correspondingly the number of points in the voxel unit will decrease.
In this way, when plane detection is performed based on points in voxel units with a relatively smaller number of points, the probability that the selected points fall on the same plane will increase, so that a plane, for example, a plane with a smaller area, can be detected quickly and successfully.
When the finally updated resolution is smaller than the preset resolution, the preset condition is judged to be met, and then the plane detection flow is stopped, and at the moment, all planes in the point cloud, including the plane with larger area and the plane with smaller area, can be considered to be detected.
In this embodiment, by dividing the plane detection of multiple rounds, after each round of plane detection is completed, the resolution of the current round is reduced to obtain updated resolution, an octree is built according to the updated resolution to obtain multiple voxel units, and then the next round of plane detection is performed for each voxel unit. Thus, with the gradual change of the resolution from large to small, the plane with a large area in the point cloud can be detected rapidly under the condition of large resolution, and with the gradual decrease of the resolution, the plane with a small area in the point cloud can be detected successfully under the condition of small resolution.
The method for detecting the plane of the point cloud provided by the embodiment can rapidly and accurately detect all planes existing in the point cloud, including a significant plane and a plane with a small area.
In this embodiment, plane detection is performed based on points in a single voxel unit in each round, and after detection of one voxel unit is completed, detection of the next voxel unit is performed. Referring to fig. 3, in performing plane detection based on points in voxel units, the following may be implemented:
s121, randomly selecting a group of point cloud groups from the points in the voxel units each time, and judging whether the selected point cloud groups meet preset requirements or not.
S122, detecting whether the same plane is determined by the point cloud groups which meet the preset requirements and exceed the preset number if the same plane meets the preset requirements, and if so, judging that the same plane is detected.
And S123, finishing plane detection based on the points in the voxel units when the set condition is met.
In the present embodiment, in the plane detection of each round, the plane detection is performed for each voxel unit. A group of point cloud groups is randomly selected from the voxel units at a time, and the number of points in the point cloud groups can be three. Because the plane needs to be determined based on the points in the selected point cloud group, three points in the point cloud group need to be located on the same plane, so in this embodiment, the judgment criterion for judging whether the selected point cloud group meets the preset requirement is whether the three points in the point cloud group are located on the same plane.
If the point cloud groups are located on the same plane, the point cloud groups can be judged to meet the preset requirements. And if the same plane is determined by the point cloud groups which exceed the preset number and meet the preset requirement, the plane can be judged to be detected. The preset number may be 50, 60, etc. without limitation.
When the plane detection is performed based on the point in a certain voxel unit and the set condition is satisfied, it is considered that all planes in the voxel unit have been detected, and the plane detection of the voxel unit may be ended.
In this embodiment, each point cloud group includes three points, referring to fig. 4, when determining whether the selected point cloud group meets the preset requirement, the following manner may be implemented:
s1211, calculating vectors between every two points in the three points in the selected point cloud group, and calculating a plane normal vector according to the vectors.
S1212, judging whether the selected point cloud group meets the preset requirement according to the vector, the plane normal vector and the normal vector of each point.
In this embodiment, assuming that three points in the selected point cloud group are p 1、p2、p3, position information of each point is obtained, and a vector between every two points is calculated, where two obtained vectors may be represented as p 12=p2-p1、p13=p3-p1.
And performing cross multiplication based on the calculated vector to obtain a cross multiplication vector, wherein the cross multiplication vector is expressed as n=p 12×p13, and in the embodiment, normalization processing is performed on the obtained cross multiplication vector to normalize the cross multiplication vector to a certain range. The calculated cross vector is the normal vector representing the detected plane. Since the normal vector is inverted to the same plane as it is represented, in this embodiment, the component n y in the y-axis direction of the normal vector can be defined as greater than 0. If the calculated n y is less than 0, then the normal vector can be processed in reverse.
Since the plane needs to be determined based on the selected point cloud group, the selected points should be located on the same plane, if the three points are located on the same plane, the cross vector of two vectors formed by the three points represents the normal vector of the plane, the normal vector at the three points also represents the normal vector of the plane, and the several normal vectors represent the same orientation between the signs, so as to ensure that the three selected points are located on the same plane as far as possible. Based on this, referring to fig. 5, in this embodiment, the above step S1212 may be implemented as follows:
S12121, judging whether the module length of each obtained vector is larger than a preset module length, if so, executing the following step S12122, otherwise, executing the following step S12125.
S12122, judging whether the included angles between the plane normal vector and the normal vector of each point are smaller than the first preset included angle, if so, executing the following step S12123, otherwise, executing the following step S12125.
S12123, judging whether the included angle between every two normal vectors of the point is smaller than a second preset included angle, if so, executing the following step S12124, otherwise, executing the following step S12125.
S12124, judging that the selected point cloud group meets the preset requirement.
S12125, determining that the selected point cloud group does not meet the preset requirement.
In this embodiment, when the point cloud group is judged whether to meet the preset requirement, the judging conditions are three, and when the point cloud group meets the three types of conditions, the point cloud group can be judged to meet the preset requirement. The first type of condition is that the calculated modular length of each of the three vectors is greater than a predetermined modular length, e.g., 25. The second condition is that the included angle between the normal vector of the plane and the normal vector of each point is smaller than the first preset included angle, for example, 5 degrees, so that the normal vector of each point and the normal vector of the plane are guaranteed to be approximately the same in orientation. The third type of condition is that the included angle between every two normal vectors in the normal vectors of each of the three points is smaller than a second preset included angle, for example, 5 degrees, so that the normal vectors of each of the three points are guaranteed to have approximately the same orientation.
When the three conditions are met by the point cloud group, three points in the selected point cloud group are more likely to be located on the same plane, so that the plane detection efficiency is improved.
From the above, some invalid points exist in the point cloud, and the points are marked as invalid points and do not participate in subsequent detection. Thus, each time a point cloud group is selected, after one point p 1 is randomly selected from the current leaf nodes, it is determined whether p 1 is an invalid point, and if p 1 is an invalid point, the selection is returned to be performed again. If p 1 is not an invalid point, a point p 2 is randomly selected, whether p 2 is an invalid point is judged, and if p 2 is an invalid point, the point selection is returned to be performed again. If p 2 is not an invalid point, randomly selecting a point p 3, judging whether p 3 is an invalid point, if p 3 is an invalid point, returning to select the point again, and if not, determining that the three selected points form a point cloud group.
In practice, variable num_select_point=0 may be initialized, num_select_point representing the number of times a dot is selected before a valid dot is selected. And adding 1 to num_select_point when the invalid point is selected, and if num_select_point is greater than or equal to a certain value, for example, 100, indicating that the valid point is not selected in the current leaf node, stopping selecting the point. When the point cloud group is selected, whether the point cloud group meets the preset requirement is judged through the above, and when the same plane is determined by the point cloud groups which exceed the preset number and meet the preset requirement, the detected plane can be judged.
Referring to fig. 6, in the present embodiment, it can be determined whether a plane is detected by:
s1221, calculating plane parameters of corresponding planes based on points in the point cloud group meeting preset requirements, and counting the planes.
S1222, when the plane parameter calculated by each detected point cloud group is consistent with the plane parameter of the plane, adding 1 to the count of the plane until the count of the plane exceeds the preset number, and judging that the plane is detected.
From the above, the plane normal vector can be calculated based on the points in the point cloud group, and the plane parameters θ and Φ can be calculated based on the plane normal vector. Wherein θ represents an included angle between the projection of the plane normal vector on the xy plane and the x axis, and φ represents an included angle between the plane normal vector and the z axis.
Specifically, three components n x、ny、nz of the planar normal n can be obtained. The plane parameters are calculated as follows:
φ= arccos(nz)
In practice, voting positions with respect to θ and Φ are set respectively, the initial value of the voting position is 0, and when the same θ and Φ are calculated, the voting value of the corresponding voting position is added with 1. When the voting value of a certain voting position is greater than or equal to a certain value, for example, 50, it can be determined that the point cloud group exceeding the preset number determines that the same plane is determined, and at this time, it can be determined that the plane is detected.
In this embodiment, it is considered that θ and Φ actually calculated may not be integers, and granularity of voting positions may be too small, resulting in excessive statistics. Therefore, the voting process is performed after the actual calculated θ and Φ are valued upward or downward.
For example, θ and Φ at each voting position may be set to integers, and in the case where θ and Φ actually calculated are non-integers, they are rounded up or rounded down so as to correspond to a certain voting position. Thereby avoiding the defect of too large statistics caused by too small granularity.
In this embodiment, since the plane detection process is divided into a plurality of rounds of detection, and each round may need to detect a plurality of voxel units in turn, when the detection of each voxel unit reaches a certain stage, it may be considered that the current voxel unit can no longer detect the plane well, and the detection of the voxel unit may be ended. Similarly, when a plane is not detected well in the detection of one round, which indicates that some planes with smaller areas may not be detected well at the current resolution, the detection of the current round may be ended, and after the resolution is reduced, the detection of the next round is performed.
Referring to fig. 7, in this embodiment, when determining whether to end the plane detection of a voxel unit, the following manner may be implemented:
s1231, adding 1 to the accumulated voting count when the point cloud group is randomly selected each time, and adding 1 to the accumulated invalid voting count when the selected point cloud group does not meet the preset requirement.
S1232, when the accumulated vote count exceeds the first preset count or the accumulated invalid vote count exceeds the second preset count, it is determined that a set condition is satisfied and plane detection based on the point in the voxel unit is ended.
In this embodiment, when performing plane detection on the voxel unit, a variable num_volt=0 and num_invalid_volt=0 may be initialized, where num_volt represents the accumulated voting count, which may be understood as the number of times of selecting the point cloud group, and num_invalid_volt represents the accumulated invalid voting count, which may be understood as the number of times of selecting the point cloud group that does not meet the preset requirement.
Therefore, after each random selection of the point cloud group, the cumulative voting count is incremented by 1, and if a point cloud group that does not satisfy the preset requirement is selected, the cumulative invalid voting count is incremented by 1. If the selected point cloud group does not meet the preset requirement, the return value is 0, and if the selected point cloud group meets the preset requirement, the return value is 1.
If the accumulated vote count exceeds a first preset count, e.g. 200, or the accumulated invalid vote count exceeds a second preset count, e.g. 20, this indicates that the current voxel unit has failed a valid plane detection, at which point the plane detection for that voxel unit may be stopped and the plane detection for the next voxel unit may be performed.
Until the plane detection of all voxel units in the current round is completed. If the plane detection of the next round is needed, the resolution of the current round is reduced, and the subsequent detection is continued.
The point cloud plane detection method provided by the embodiment not only can be used for rapidly detecting the plane with a large area in the point cloud, but also can be used for rapidly detecting the plane with a small area in the point cloud, so that when some planes with small areas and difficult detection exist in the point cloud, the scheme can be used for rapidly detecting the plane. Because the scheme adopts the gradual reduction of resolution, the octree is built according to the point cloud of the resolution, and then planes are detected in each leaf node (voxel unit) respectively. When there is a plane with a small area in the point cloud, in the octree corresponding to the small resolution, since the leaf node itself is small, only one part of the point cloud is corresponding, at this time, the plane will become a significant plane in the leaf node, from which the probability of three points falling on the plane will be greatly increased, so that the plane can be detected in the current leaf node. By adopting the scheme to detect the planes, all planes existing in the point cloud can be detected rapidly and accurately, including a significant plane and a plane with a small area.
Based on the same inventive concept, please refer to fig. 8, which is a schematic diagram illustrating functional modules of a point cloud plane detection device according to an embodiment of the present application, the embodiment may divide functional modules of the point cloud plane detection device according to the above method embodiment. For example, each functional module may be divided corresponding to each function, or two or more functions may be integrated in one processing module. The integrated modules may be implemented in hardware or in software functional modules. It should be noted that, in the embodiment of the present application, the division of the modules is schematic, which is merely a logic function division, and other division manners may be implemented in actual implementation.
For example, in the case of dividing each functional module by corresponding each function, the point cloud plane detection apparatus shown in fig. 8 is only one apparatus schematic diagram. The point cloud plane detection device may include an establishing module, a detection module and an updating module, and the functions of each functional module of the point cloud plane detection device are respectively described in detail below.
The establishing module is used for establishing an octree for a point cloud according to the resolution of the current round in the plane detection of each round to obtain a plurality of voxel units, wherein each point in the point cloud belongs to one of the voxel units;
The detection module is used for carrying out plane detection on each voxel unit based on points in the voxel units and marking the detected points on the plane as invalid points, wherein the detection is carried out based on the invalid points during the plane detection;
And the updating module is used for reducing the resolution of the current round to obtain updated resolution after the detection of the current round is completed, establishing an octree to obtain a plurality of voxel units according to the updated resolution and carrying out the plane detection of the next round based on the points in each voxel unit until the preset condition is met, and stopping the plane detection.
It will be appreciated that the setup module, the detection module and the update module may be used to perform steps S11 to S13 described above, and reference may be made to the details of steps S11 to S13 described above for detailed implementation of the respective modules.
In one possible implementation manner, the detection module may be used for:
Randomly selecting a group of point cloud groups from the points in the voxel units each time, and judging whether the selected point cloud groups meet preset requirements or not;
under the condition that the preset requirements are met, detecting whether the same plane is determined by the point cloud groups which exceed the preset number and meet the preset requirements, and if so, judging that the plane is detected;
and when the set condition is met, finishing plane detection based on the points in the voxel unit.
In one possible implementation manner, the detection module may be used for:
adding 1 to the accumulated voting count when the point cloud group is randomly selected each time, and adding 1 to the accumulated invalid voting count when the selected point cloud group does not meet the preset requirement;
and when the accumulated voting count exceeds a first preset count or the accumulated invalid voting count exceeds a second preset count, judging that a set condition is met and finishing plane detection based on points in the voxel units.
In one possible implementation manner, each point cloud group includes three points, and the detection module may be used to:
calculating vectors between every two points in the three points in the selected point cloud group, and calculating according to the vectors to obtain plane normal vectors;
Judging whether the selected point cloud group meets the preset requirement or not according to the vector, the plane normal vector and the normal vector of each point.
In one possible implementation manner, the detection module may be used for:
Judging whether the obtained module length of each vector is larger than a preset module length, if so, judging whether the included angles between the plane normal vector and the normal vector of each point are smaller than a first preset included angle;
if the angles are smaller than the first preset included angle, judging whether the included angle between every two normal vectors in the normal vectors of each point is smaller than the second preset included angle or not;
if the point cloud groups are smaller than the second preset included angles, judging that the selected point cloud groups meet preset requirements.
In one possible implementation manner, the detection module may be used for:
calculating to obtain plane parameters of a corresponding plane based on points in the point cloud group meeting preset requirements, and counting the planes;
And adding 1 to the count of the planes when the plane parameters calculated by the point cloud group are detected to be consistent with the plane parameters of the planes each time, and judging that the planes are detected when the count of the planes exceeds the preset number.
In one possible implementation, the predetermined condition is determined to be satisfied when the updated resolution is less than the predetermined resolution.
Referring to fig. 9, a block diagram of an electronic device according to an embodiment of the present application may be a computer device, and the electronic device includes a memory, a processor, and a communication module. The memory, the processor and the communication module are electrically connected with each other directly or indirectly to realize data transmission or interaction. For example, the components may be electrically connected to each other via one or more communication buses or signal lines.
Wherein the memory is used for storing programs or data. The Memory may be, but is not limited to, random access Memory (Random Access Memory, RAM), read Only Memory (ROM), programmable Read Only Memory (Programmable Read-Only Memory, PROM), erasable Read Only Memory (Erasable Programmable Read-Only Memory, EPROM), electrically erasable Read Only Memory (Electric Erasable Programmable Read-Only Memory, EEPROM), etc.
The processor is used for reading/writing data or programs stored in the memory and executing the point cloud plane detection method provided by any embodiment of the application.
The communication module is used for establishing communication connection between the electronic equipment and other communication terminals through a network and is used for receiving and transmitting data through the network.
It should be understood that the configuration shown in fig. 9 is merely a schematic diagram of the configuration of the electronic device, and the electronic device may further include more or fewer components than those shown in fig. 9, or have a different configuration than that shown in fig. 9.
Further, the embodiment of the application also provides a computer readable storage medium, and the computer readable storage medium stores machine executable instructions, which when executed, implement the point cloud plane detection method provided by the embodiment.
Specifically, the computer readable storage medium can be a general-purpose storage medium, such as a mobile disk, a hard disk, or the like, and when the computer program on the computer readable storage medium is executed, the above-described point cloud plane detection method can be executed. With respect to the processes in the computer readable storage medium and the executable instructions thereof involved when executed, reference is made to the relevant descriptions of the above method embodiments, which are not described in detail herein.
In summary, in the method, the device, the electronic device and the readable storage medium for detecting the point cloud plane provided by the embodiment of the application, in the plane detection of each round, an octree is built for the point cloud according to the resolution of the current round to obtain a plurality of voxel units, the plane detection is performed for each voxel unit based on the points in the voxel units, and the detected points on the plane are marked as invalid points. After the detection of the current round is completed, reducing the resolution of the current round to obtain updated resolution, building octree according to the updated resolution to obtain a plurality of voxel units, and carrying out the plane detection of the next round based on the points in each voxel unit until the preset condition is met, and stopping the plane detection. According to the scheme, the resolution is gradually reduced to establish the octree, so that the effect of rapidly and accurately detecting all planes existing in the point cloud can be achieved on the basis of gradually reduced voxel units and then rapidly detecting planes with smaller areas in the point cloud under the condition that planes with larger areas in the point cloud are detected.
The foregoing is merely illustrative of the present invention, and the present invention is not limited thereto, and any changes or substitutions easily contemplated by those skilled in the art within the scope of the present invention should be included in the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (9)

1. A point cloud plane detection method, the method comprising:
in the plane detection of each round, establishing an octree for a point cloud according to the resolution of the current round to obtain a plurality of voxel units, wherein each point in the point cloud belongs to one voxel unit in the plurality of voxel units;
For each voxel unit, performing plane detection based on points in the voxel unit, and marking the detected points on the plane as invalid points, wherein the detection is performed based on non-invalid points during plane detection;
after the detection of the current round is completed, reducing the resolution of the current round to obtain updated resolution, building an octree to a point cloud according to the updated resolution to obtain a plurality of voxel units, and carrying out the plane detection of the next round based on the points in each voxel unit until the preset condition is met, and stopping the plane detection;
the step of performing plane detection based on the points in the voxel unit comprises the following steps:
Randomly selecting a group of point cloud groups from the points in the voxel units each time, and judging whether the selected point cloud groups meet preset requirements or not; under the condition that the preset requirements are met, detecting whether the same plane is determined by the point cloud groups which exceed the preset number and meet the preset requirements, and if so, judging that the plane is detected; and when the set condition is met, finishing plane detection based on the points in the voxel unit.
2. The point cloud plane detection method according to claim 1, wherein the step of ending the plane detection based on the points in the voxel unit when a set condition is satisfied, comprises:
adding 1 to the accumulated voting count when the point cloud group is randomly selected each time, and adding 1 to the accumulated invalid voting count when the selected point cloud group does not meet the preset requirement;
and when the accumulated voting count exceeds a first preset count or the accumulated invalid voting count exceeds a second preset count, judging that a set condition is met and finishing plane detection based on points in the voxel units.
3. The method for detecting a point cloud plane according to claim 1, wherein each of the point cloud groups includes three points, and the step of determining whether the selected point cloud group satisfies a preset requirement includes:
calculating vectors between every two points in the three points in the selected point cloud group, and calculating according to the vectors to obtain plane normal vectors;
Judging whether the selected point cloud group meets the preset requirement or not according to the vector, the plane normal vector and the normal vector of each point.
4. The method for detecting a point cloud plane according to claim 3, wherein the step of determining whether the selected point cloud group meets a preset requirement according to the vector, the plane normal vector and the normal vector of each point comprises:
Judging whether the obtained module length of each vector is larger than a preset module length, if so, judging whether the included angles between the plane normal vector and the normal vector of each point are smaller than a first preset included angle;
if the angles are smaller than the first preset included angle, judging whether the included angle between every two normal vectors in the normal vectors of each point is smaller than the second preset included angle or not;
if the point cloud groups are smaller than the second preset included angles, judging that the selected point cloud groups meet preset requirements.
5. The method for detecting a point cloud plane according to claim 1, wherein the step of determining whether the same plane is determined by the detection of more than a preset number of point cloud groups satisfying a preset requirement, and if so, determining that the plane is detected comprises:
calculating to obtain plane parameters of a corresponding plane based on points in the point cloud group meeting preset requirements, and counting the planes;
And adding 1 to the count of the planes when the plane parameters calculated by the point cloud group are detected to be consistent with the plane parameters of the planes each time, and judging that the planes are detected when the count of the planes exceeds the preset number.
6. The method according to any one of claims 1 to 5, wherein the predetermined condition is determined to be satisfied when the updated resolution is smaller than the predetermined resolution.
7. A point cloud plane detection apparatus for implementing the point cloud plane detection method according to any one of claims 1 to 6, the apparatus comprising:
The establishing module is used for establishing an octree to a point cloud according to the current round resolution ratio to obtain a plurality of voxel units in the plane detection of each round, wherein each point in the point cloud belongs to one of the voxel units;
The detection module is used for carrying out plane detection on each voxel unit based on points in the voxel units and marking the detected points on the plane as invalid points, wherein the detection is carried out based on the invalid points during the plane detection;
And the updating module is used for reducing the resolution of the current round to obtain updated resolution after the detection of the current round is completed, establishing an octree to obtain a plurality of voxel units according to the updated resolution and carrying out the plane detection of the next round based on the points in each voxel unit until the preset condition is met, and stopping the plane detection.
8. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of any of claims 1-6 when the program is executed by the processor.
9. A computer readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any of claims 1-6.
CN202410190279.8A 2024-02-21 2024-02-21 Point cloud plane detection method and device, electronic equipment and readable storage medium Active CN117745728B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410190279.8A CN117745728B (en) 2024-02-21 2024-02-21 Point cloud plane detection method and device, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410190279.8A CN117745728B (en) 2024-02-21 2024-02-21 Point cloud plane detection method and device, electronic equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN117745728A CN117745728A (en) 2024-03-22
CN117745728B true CN117745728B (en) 2024-05-24

Family

ID=90261348

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410190279.8A Active CN117745728B (en) 2024-02-21 2024-02-21 Point cloud plane detection method and device, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN117745728B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118196110A (en) * 2024-05-20 2024-06-14 法奥意威(苏州)机器人***有限公司 Point cloud data plane detection method and device, storage medium and electronic equipment

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109658431A (en) * 2018-12-26 2019-04-19 中国科学院大学 Rock mass point cloud plane extracting method based on region growing
CN109685821A (en) * 2018-12-26 2019-04-26 中国科学院大学 Region growing 3D rock mass point cloud plane extracting method based on high quality voxel
WO2020004740A1 (en) * 2018-06-25 2020-01-02 재단법인실감교류인체감응솔루션연구단 Three-dimensional plane extraction method and device therefor
CN112099046A (en) * 2020-09-16 2020-12-18 辽宁工程技术大学 Airborne LIDAR three-dimensional plane detection method based on multi-valued voxel model
CN113342999A (en) * 2021-05-07 2021-09-03 上海大学 Variable-resolution-ratio point cloud simplification method based on multi-layer skip sequence tree structure
CN113536417A (en) * 2021-06-21 2021-10-22 杭州电子科技大学 Indoor scene model completion method based on plane constraint
CN114450717A (en) * 2019-10-07 2022-05-06 Oppo广东移动通信有限公司 Occlusion and collision detection for augmented reality applications
CN114742957A (en) * 2022-06-13 2022-07-12 西南石油大学 Building facade extraction method based on point cloud data
WO2023051671A1 (en) * 2021-09-30 2023-04-06 上海莉莉丝互娱网络科技有限公司 Data processing method based on voxel data, and server, medium and computer program product
CN116433889A (en) * 2021-12-31 2023-07-14 陕西重型汽车有限公司 Laser radar target recognition algorithm based on convex plane detection
CN116452735A (en) * 2023-03-31 2023-07-18 中山大学 Octree-based data processing method, octree-based data processing device and computer-readable storage medium
CN117115009A (en) * 2023-07-18 2023-11-24 南方电网科学研究院有限责任公司 Three-dimensional point cloud data denoising and smoothing method and device based on unit voxels

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112805751A (en) * 2018-10-12 2021-05-14 松下电器(美国)知识产权公司 Three-dimensional data encoding method, three-dimensional data decoding method, three-dimensional data encoding device, and three-dimensional data decoding device
US20230080678A1 (en) * 2021-08-26 2023-03-16 The Hong Kong University Of Science And Technology Method and electronic device for performing 3d point cloud object detection using neural network

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020004740A1 (en) * 2018-06-25 2020-01-02 재단법인실감교류인체감응솔루션연구단 Three-dimensional plane extraction method and device therefor
CN109658431A (en) * 2018-12-26 2019-04-19 中国科学院大学 Rock mass point cloud plane extracting method based on region growing
CN109685821A (en) * 2018-12-26 2019-04-26 中国科学院大学 Region growing 3D rock mass point cloud plane extracting method based on high quality voxel
CN114450717A (en) * 2019-10-07 2022-05-06 Oppo广东移动通信有限公司 Occlusion and collision detection for augmented reality applications
CN112099046A (en) * 2020-09-16 2020-12-18 辽宁工程技术大学 Airborne LIDAR three-dimensional plane detection method based on multi-valued voxel model
CN113342999A (en) * 2021-05-07 2021-09-03 上海大学 Variable-resolution-ratio point cloud simplification method based on multi-layer skip sequence tree structure
CN113536417A (en) * 2021-06-21 2021-10-22 杭州电子科技大学 Indoor scene model completion method based on plane constraint
WO2023051671A1 (en) * 2021-09-30 2023-04-06 上海莉莉丝互娱网络科技有限公司 Data processing method based on voxel data, and server, medium and computer program product
CN116433889A (en) * 2021-12-31 2023-07-14 陕西重型汽车有限公司 Laser radar target recognition algorithm based on convex plane detection
CN114742957A (en) * 2022-06-13 2022-07-12 西南石油大学 Building facade extraction method based on point cloud data
CN116452735A (en) * 2023-03-31 2023-07-18 中山大学 Octree-based data processing method, octree-based data processing device and computer-readable storage medium
CN117115009A (en) * 2023-07-18 2023-11-24 南方电网科学研究院有限责任公司 Three-dimensional point cloud data denoising and smoothing method and device based on unit voxels

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
"Fast Planar Surface Detection in Point Clouds Using Voxel-grid-center-constrained Iterative Adaptive Plane Extraction";Liyong Liu 等;《2021 40th Chinese Control Conference (CCC)》;20211006;第7343-7348页 *
"基于八叉树体素的细粒度点云分割";王宏远;《中国优秀硕士学位论文全文库 信息科技辑》;20240115;全文 *
"采用八叉树体素生长的点云平面提取";李明磊 等;《光学精密工程》;20180115;第172-183页 *

Also Published As

Publication number Publication date
CN117745728A (en) 2024-03-22

Similar Documents

Publication Publication Date Title
CN117745728B (en) Point cloud plane detection method and device, electronic equipment and readable storage medium
CN110008809B (en) Method and device for acquiring form data and server
CN111210429B (en) Point cloud data partitioning method and device and obstacle detection method and device
US5202928A (en) Surface generation method from boundaries of stereo images
CN111582054B (en) Point cloud data processing method and device and obstacle detection method and device
CN103581620A (en) Image processing apparatus, image processing method and program
CN114612665B (en) Pose estimation and dynamic vehicle detection method based on normal vector histogram features
CN111612043A (en) Road scene matching method, device and storage medium
CN111553946A (en) Method and device for removing ground point cloud and obstacle detection method and device
CN117726668B (en) Point cloud cylinder detection method and device
CN113903188B (en) Parking space detection method, electronic device and computer readable storage medium
CN116266365A (en) Point cloud data extraction method and device, electronic equipment and storage medium
WO2021190331A1 (en) Camera layout position determining method and apparatus, terminal device, and storage medium
CN114764885A (en) Obstacle detection method and device, computer-readable storage medium and processor
CN113378837A (en) License plate shielding identification method and device, electronic equipment and storage medium
CN113536901A (en) Target capturing method and related device
CN113379826A (en) Method and device for measuring volume of logistics piece
CN116542926A (en) Method, device, equipment and storage medium for identifying defects of two-dimension codes of battery
WO2022033145A1 (en) Corner coding method, calibration method, device, electronic device, and storage medium
CN111275693B (en) Counting method and counting device for objects in image and readable storage medium
CN116681857A (en) Space collision detection method and device and electronic equipment
CN112816959A (en) Clustering method, device, equipment and storage medium for vehicles
CN111652143A (en) Vehicle detection method and device and computer storage medium
CN116091365B (en) Triangular surface-based three-dimensional model notch repairing method, triangular surface-based three-dimensional model notch repairing device, triangular surface-based three-dimensional model notch repairing equipment and medium
CN109993143B (en) Installation method and device of image acquisition equipment, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant