Cylindrical surface detection method and apparatus
By dividing the 3D point cloud into planar groups and performing point cloud segmentation, the target point cloud set and projection plane are selected, solving the problem of unstable detection of small-height cylinders and achieving higher-precision cylinder surface detection.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- FAIR INNOVATION (SUZHOU) ROBOTIC SYSTEM CO LTD
- Filing Date
- 2025-11-07
- Publication Date
- 2026-05-15
AI Technical Summary
Existing technologies suffer from instability and low accuracy when detecting cylindrical surfaces in 3D point clouds, especially for cylinders with small heights. In particular, the sparse point cloud data and noise points lead to inaccurate identification of the cylinder's axis.
By dividing the planes in the point cloud to be detected into plane groups and performing point cloud segmentation for each plane group, a point cloud set and a projection plane are obtained. The target point cloud set and projection plane are selected based on the distribution of the projection points, thereby detecting the target cylindrical surface.
It improves the accuracy and stability of cylindrical surface detection, especially in the case of small-height cylinders, and can more accurately identify cylindrical surfaces.
Smart Images

Figure CN2025133565_15052026_PF_FP_ABST
Abstract
Description
Cylindrical Surface Inspection Method and Apparatus
[0001] Cross-reference to related applications
[0002] This disclosure claims priority to Chinese Patent Application No. 2024115864575, filed on November 8, 2024, entitled "Method and Apparatus for Detecting Cylindrical Surfaces", the entire contents of which are incorporated herein by reference. Technical Field
[0003] This disclosure relates to the field of computer technology, and more specifically, to a method and apparatus for detecting cylindrical surfaces. Background Technology
[0004] Detecting cylindrical surfaces from point clouds is a task in computer vision and 3D point cloud processing, aiming to detect and identify cylindrical objects or surfaces from 3D point cloud data. Currently, in 3D point cloud processing, it is sometimes necessary to detect cylindrical surfaces based on the 3D point cloud, for example, when identifying weld seams on a workpiece, it is necessary to identify cylindrical surfaces and then determine the weld seam within the workpiece based on the identified cylindrical surfaces. Therefore, how to detect cylindrical surfaces from 3D point clouds has become a technical problem that urgently needs to be solved by those skilled in the art.
[0005] Application content
[0006] This disclosure provides a method, apparatus, electronic device, and readable storage medium for detecting cylindrical surfaces, which can detect cylindrical surfaces from point clouds and has high detection accuracy.
[0007] The embodiments of this disclosure can be implemented as follows:
[0008] This disclosure provides a method for detecting a cylindrical surface, the method comprising:
[0009] Obtain the planar detection results corresponding to the point cloud to be detected;
[0010] The planes in the plane detection results are divided into plane groups. When a plane group includes multiple planes, the angle between the normals of one plane in the plane group and the normals of the other planes is less than a preset angle.
[0011] For each plane group, the point cloud set corresponding to the plane group and the projection plane corresponding to the point cloud set are determined from the point cloud to be detected. The point cloud points in a point cloud set and the acquisition device configured to obtain the point cloud to be detected are located on the same side of the projection plane corresponding to the point cloud set. The projection plane is the plane in the corresponding plane group.
[0012] Based on the distribution of projection points of the point cloud set on the corresponding projection plane, the target point cloud set and the target projection plane are determined from the obtained point cloud set and the corresponding projection plane.
[0013] The target cylindrical surface is detected based on the target point cloud set and the target projection plane.
[0014] This disclosure also provides a cylindrical surface detection device, the device comprising:
[0015] The module is configured to obtain the planar detection results corresponding to the point cloud to be detected.
[0016] The grouping module is configured to divide the planes in the plane detection results into plane groups. When a plane group includes multiple planes, the angle between the normals of one plane in the plane group and the normals of the other planes is less than a preset angle.
[0017] The point cloud segmentation module is configured to determine, for each plane group, the point cloud set corresponding to the plane group and the projection plane corresponding to the point cloud set from the point cloud to be detected. The point cloud points in a point cloud set and the acquisition device configured to obtain the point cloud to be detected are located on the same side of the projection plane corresponding to the point cloud set. The projection plane is the plane in the corresponding plane group.
[0018] The filtering module is configured to determine the target point cloud set and the target projection plane from the obtained point cloud set and the corresponding projection plane based on the distribution of the projection points of the point cloud set on the corresponding projection plane.
[0019] The detection module is configured to detect the target cylindrical surface based on the target point cloud set and the target projection plane.
[0020] This disclosure also 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 cylindrical surface detection method described in the foregoing embodiments.
[0021] This disclosure also provides a readable storage medium storing a computer program thereon, which, when executed by a processor, implements the cylindrical surface detection method as described in the foregoing embodiments.
[0022] The cylindrical surface detection method, apparatus, electronic device, and readable storage medium provided in this disclosure first obtain the planar detection results of the point cloud to be detected, then divide the planes in the planar detection results into plane groups. When a plane group includes multiple planes, the angle between the normals of one plane in the plane group and the normals of the other planes is less than a preset angle. Next, for each plane group, a point cloud set corresponding to the plane group and a projection plane corresponding to the point cloud set are determined from the point cloud to be detected. The point cloud points in a point cloud set and the acquisition device configured to obtain the point cloud to be detected are located on the same side of the projection plane corresponding to the point cloud set, and the projection plane is a plane in the corresponding plane group. Then, based on the distribution of the projection points of the point cloud set on the corresponding projection plane, a target point cloud set and a target projection plane are determined from the obtained point cloud set and the corresponding projection plane. Finally, the target cylindrical surface is detected based on the target point cloud set and the target projection plane. Thus, a cylindrical surface can be detected from a point cloud with high detection accuracy. Attached Figure Description
[0023] To more clearly illustrate the technical solutions of the embodiments of this disclosure, the accompanying drawings used in the embodiments will be briefly described below. It should be understood that the following drawings only show some embodiments of this disclosure and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0024] Figure 1 is a block diagram of an electronic device provided in an embodiment of this disclosure;
[0025] Figure 2 is a schematic flowchart of the cylindrical surface detection method provided in the embodiments of this disclosure;
[0026] Figure 3 is a flowchart illustrating the sub-steps included in step S120 of Figure 2;
[0027] Figure 4 is a flowchart illustrating the sub-steps included in step S130 of Figure 2.
[0028] Figure 5 is a schematic diagram showing the relationship between the j-th partial point cloud and the upper and lower planes provided in the embodiments of this disclosure;
[0029] Figure 6 is a flowchart illustrating the sub-steps included in sub-step S132 in Figure 4.
[0030] Figure 7 is a flowchart illustrating the sub-steps included in step S140 of Figure 2.
[0031] Figure 8 is a flowchart illustrating the sub-steps included in sub-step S142 in Figure 7.
[0032] Figure 9 is a flowchart illustrating the sub-steps included in sub-step S1422 in Figure 8;
[0033] Figure 10 is a schematic diagram of the straight line corresponding to a projection point;
[0034] Figure 11 is a block diagram of the cylindrical surface detection device provided in the embodiments of this disclosure.
[0035] Icons: 100 - Electronic device; 110 - Memory; 120 - Processor; 130 - Communication unit; 200 - Cylindrical surface detection device; 210 - Acquisition module; 220 - Grouping module; 230 - Point cloud segmentation module; 240 - Filtering module; 250 - Detection module. Detailed Implementation
[0036] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. The components of the embodiments of this disclosure described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0037] Therefore, the following detailed description of the embodiments of this disclosure provided in the accompanying drawings is not intended to limit the scope of the claimed disclosure, but merely to illustrate selected embodiments of the disclosure. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without inventive effort are within the scope of this disclosure.
[0038] It should be noted that relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0039] The current method for detecting cylindrical surfaces in point clouds is as follows: First, a voting algorithm is used to detect planes in the point cloud. After detecting the planes, the points on the planes are removed from the point cloud. Next, a voting algorithm is used to detect the cylinder axis based on the remaining points. The points that voted for the cylinder axis are projected onto a plane perpendicular to the cylinder axis. A voting algorithm is then used to detect circles on this plane. Combining the cylinder axis detection results and the circle detection results, the cylinder surface detection result is obtained. However, this method of detecting cylindrical surfaces in point clouds can lead to instability in cylinder axis detection when the cylinder height is very small.
[0040] For example, consider a workpiece with a very small cylinder, 70mm in radius and 5mm in height. Because of the small height, there are few points on the cylinder surface. Using these points to vote on the cylinder's axis can easily lead to incorrect axis voting. For instance, the obtained point cloud might contain very few points on the cylinder surface and include some noise points. In this case, when determining the final identified cylinder axis through voting, an inaccurate axis determined by incorporating noise points might be used as the final identified axis. This would result in inaccuracies in the identification of the cylinder axis and the cylinder surface identified based on the plane perpendicular to the cylinder axis.
[0041] To address the above issues, this disclosure provides a method, apparatus, electronic device, and readable storage medium for detecting cylindrical surfaces. The method involves dividing a plane detected based on a point cloud into at least one group of planes, and then segmenting the point cloud based on each of these at least one group of planes to obtain a point cloud set corresponding to each group of planes and a projection plane corresponding to that point cloud set. The point cloud set is then projected onto the corresponding projection plane to assess the likelihood that the projected points contain circular curves. Finally, the point cloud set most likely to contain circular curves is selected to detect the cylindrical surface, thereby accurately detecting the cylindrical surface.
[0042] The following detailed description of some embodiments of this disclosure is provided in conjunction with the accompanying drawings. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0043] Please refer to Figure 1, which is a block diagram of an electronic device 100 provided in an embodiment of this disclosure. The electronic device 100 may be, but is not limited to, a computer, a server, a welding robot, etc. The electronic device 100 may include a memory 110, a processor 120, and a communication unit 130. The memory 110, processor 120, and communication unit 130 are electrically connected directly or indirectly to each other to achieve data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines.
[0044] The memory 110 is configured to store programs or data. The memory 110 may be, but is not limited to, random access memory (RAM), read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), etc.
[0045] The processor 120 is configured to read / write data or programs stored in the memory 110 and execute corresponding functions. For example, the memory 110 stores a cylindrical surface detection device 200, which includes at least one software functional module that can be stored in the memory 110 in the form of software or firmware. The processor 120 executes various functional applications and data processing by running the software programs and modules stored in the memory 110, such as the cylindrical surface detection device 200 in this embodiment of the present disclosure, thereby implementing the cylindrical surface detection method in this embodiment of the present disclosure.
[0046] The communication unit 130 is configured to establish a communication connection between the electronic device 100 and other communication terminals via a network, and is configured to send and receive data via the network.
[0047] It should be understood that the structure shown in Figure 1 is only a schematic diagram of the electronic device 100. The electronic device 100 may also include more or fewer components than shown in Figure 1, or have a different configuration than shown in Figure 1. The components shown in Figure 1 may be implemented using hardware, software, or a combination thereof.
[0048] Please refer to Figure 2, which is a schematic flowchart of the cylindrical surface detection method provided in this embodiment. The method can be applied to the aforementioned electronic device 100. The specific flow of the cylindrical surface detection method will be described in detail below. In this embodiment, the method may include steps S110 to S150.
[0049] Step S110: Obtain the planar detection result corresponding to the point cloud to be detected.
[0050] In this embodiment, the point cloud to be detected is a 3D point cloud requiring cylindrical surface detection, which can be specifically determined based on actual conditions. Any planar detection algorithm can be used to perform planar detection on the point cloud to be detected, and the parameters of the detected planes are saved in the planar detection results. The plane parameters are configured to indicate the plane. Alternatively, planar detection results obtained from other devices performing planar detection on the point cloud to be detected can also be received. It is understood that the above method of obtaining planar detection results is only illustrative and can be determined based on actual needs.
[0051] Step S120: Divide the planes in the plane detection results into plane groups.
[0052] In this embodiment, the planes included in the initial plane detection can be grouped according to the parameters of each plane in the plane detection results to obtain at least one plane group. A plane group may include one plane or multiple planes, depending on the actual situation. When a plane group includes multiple plane groups, the angle between the normals of one plane in that plane group and the normals of the other planes is less than a preset angle; that is, one plane in that plane group is parallel or approximately parallel to the other planes. The specific method of plane grouping can be determined based on actual needs and is not specifically limited here.
[0053] Step S130: For each plane group, determine the point cloud set corresponding to the plane group and the projection plane corresponding to the point cloud set from the point cloud to be detected.
[0054] In this embodiment, for a set of planes, a point cloud set corresponding to the set of planes and a projection plane corresponding to the point cloud set can be determined from the point cloud to be detected. Specifically, the point cloud points in a point cloud set are the point cloud points in the point cloud to be detected, and the point cloud points in a point cloud set and the acquisition device configured to acquire the point cloud to be detected are located on the same side of the projection plane corresponding to the point cloud set. The projection plane is a plane in the corresponding set of planes; that is, the point cloud set and the acquisition device are located above the projection plane corresponding to the point cloud set. The acquisition device can be a 3D point cloud camera.
[0055] Repeat the above process for the remaining plane groups to obtain the point cloud set and projection plane corresponding to each of the remaining plane groups.
[0056] One approach is to determine the point cloud set and the projection plane corresponding to each point cloud set after obtaining all the plane groups; another approach is to obtain the point cloud set and the projection plane corresponding to each point cloud set through analysis and processing after obtaining each plane group; yet another approach is also possible, depending on the specific requirements.
[0057] Step S140: Based on the distribution of projection points of the point cloud set on the corresponding projection plane, determine the target point cloud set and the target projection plane from the obtained point cloud set and the corresponding projection plane.
[0058] In this embodiment, for each point cloud set, all points in the point cloud set are projected onto the corresponding projection plane. Then, based on the distribution of projected points for each point cloud set, a target point cloud set is determined from the obtained point cloud sets, and the projection plane corresponding to the target point cloud set is used as the target projection plane. The target point cloud set is the selected set most likely to contain circular curves. The specific method for determining the target point cloud set can be determined based on actual needs.
[0059] Step S150: Detect the target cylindrical surface based on the target point cloud set and the target projection plane.
[0060] Once the target point cloud set and the target projection plane are determined, the target point cloud set can be projected onto the target projection plane. Then, based on the obtained projection points, the equation of a circle can be determined. Finally, based on the equation of the circle and the target projection plane, the equation of the cylinder axis can be determined, thereby identifying the target cylindrical surface. The target cylindrical surface is indicated by the equation of the circle and the equation of the cylinder axis. In this way, a cylindrical surface can be detected from the point cloud with high detection accuracy.
[0061] In this embodiment, to facilitate the determination of the projection plane, the planes can be grouped as shown in Figure 3. Please refer to Figure 3, which is a flowchart illustrating the sub-steps included in step S120 of Figure 2. In this embodiment, step S120 may include sub-steps S121 to S123.
[0062] Sub-step S121: For each plane in the plane detection result, the normal and distance parameters of the plane are obtained according to the initial normal and initial distance parameters of the plane and the position of the acquisition device.
[0063] In this embodiment, the plane detection result includes the initial normal n and initial distance parameter ρ of each detected plane. The initial normal n and initial distance parameter ρ are obtained by performing plane detection on the point cloud to be detected. That is, the initial normal and initial distance parameter of a plane are configured to indicate the plane. Among them, the initial distance parameter ρ represents the distance from the origin of the coordinate system to the plane, and may be a positive value or a negative value.
[0064] For each plane in the planar detection results, considering the position of the acquisition device when the point cloud to be detected is acquired, it can be determined whether the initial normal of the plane is oriented towards the acquisition device. If the initial normal of the plane is oriented towards the acquisition device, then the initial normal of the plane is used as the normal of the plane, and the initial distance parameter of the plane is used as the distance parameter of the plane. If the initial normal of the plane is not oriented towards the acquisition device, then both the initial normal and the initial distance parameter of the plane are reversed, and the processed initial normal and the processed initial distance parameter are used as the distance parameter of the plane. Thus, the normal and distance parameters of each plane can be obtained. When the normal of a plane is oriented towards the acquisition device, and the initial normal of a plane is reversed, the initial distance parameter and the distance parameter of that plane are opposite numbers.
[0065] Alternatively, as a possible implementation, the initial normal orientation of a plane i can be determined as follows: Assuming an "eye-on-hand" mode, where the acquisition device is located at the robot's end effector, the robot's TCP (Tool Center Position) can be used as the acquisition device's position. The centroid position m of the point cloud to be detected can be calculated, and the TCP position is set to p. tcp The following vector is obtained by calculation: p re f = p tcp -m, this vector points from the centroid of the point cloud to the TCP location. The initial normal to plane i is n. i The initial distance parameter is ρ i n was calculated i With p ref The inner product of and , if the inner product is less than 0, indicates that the initial normal of plane i is oriented towards p. ref Conversely, at this time, for the initial normal n i Reverse the initial normal vector and use the reversed initial normal vector as the normal vector of plane i. Also, reverse the initial distance parameter and use the reversed initial distance parameter as the distance parameter of plane i. If the inner product is not less than 0, it indicates that the initial normal vector of plane i is oriented relative to p. ref If they are the same, then the initial normal is directly used as the normal of plane i, and the initial distance parameter is used as the distance parameter of plane i.
[0066] Optionally, to avoid missing planes, the variable `i` can be used to traverse the plane detection results, obtaining the normal and distance parameters of each plane through this traversal process. Initially, `i` = 0; it is then checked whether `i` is less than the number of planes included in the plane detection results; if less, the normal and distance parameters of the plane are obtained based on its initial normal and distance parameters, and then `i` is incremented by 1 to update it; after the update, the process is repeated: checking whether `i` is less than the number of planes included in the plane detection results, until `i` is not less than the number of planes included in the plane detection results.
[0067] Sub-step S122: Based on the distance parameters of each plane, sort the planes in the plane detection results in ascending order of distance parameters to obtain a plane list.
[0068] In this embodiment, the distance parameter ρ of each plane can be obtained through sub-step S121. The planes indicated by the plane detection results can be sorted according to the distance parameter ρ from smallest to largest to obtain a plane list. Thus, planes farther from the acquisition device are placed at the beginning of the list, and planes closer to the acquisition device are placed at the end of the list.
[0069] Sub-step S123: Traverse the planes in the plane list according to the plane sorting in the plane list, take the first plane that is not assigned to a plane group as the base plane of the plane group, and traverse the plane list based on the base plane and the plane sorting, and add the planes that are not assigned to a plane group and whose normals are less than the preset angles determined during the traversal to the plane group where the base plane is located.
[0070] In this embodiment, given the plane list, the planes in the plane list can be traversed sequentially according to their order. For each traversed plane, it is determined whether it has been assigned to a plane group. If the plane is not assigned to a plane group, it is used as the base plane (plane_0) of a plane group. After determining the base plane (plane_0) of a plane group, the planes in the plane list are traversed according to the plane order. For each traversed plane, it is determined whether it has been assigned to a plane group and whether it is approximately parallel to the base plane (plane_0). If the traversed plane is not assigned to a plane group and is approximately parallel to the base plane (plane_0), it is saved to the plane group containing the base plane (plane_0), and the traversal continues until all planes in the plane list have been traversed. In this way, planes approximately parallel to the base plane (plane_0) and the base plane (plane_0) are found to be in the same plane group. In this case, the planes within a plane group are sorted according to their distance parameters, with planes having smaller distance parameters being sorted earlier and planes having larger distance parameters being sorted later. The planes in the plane group are configured in such an order that the spatially adjacent planes in the plane group are determined in the subsequent determination of the point cloud set and the projection plane, and the projection plane is determined.
[0071] Whether a plane is approximately parallel to its base plane plane_0 can be determined by whether the angle between the normals of the two planes is less than a preset angle. For example, the dot product of the normals of the two planes can be calculated. If the result is greater than or equal to a preset value, it can be determined that the two planes have very close normals, that is, the two planes are approximately parallel; if the result is less than the preset value, it can be determined that the two planes are not approximately parallel.
[0072] Then, continue traversing the plane list to determine the base plane plane_0 of the new plane group, and then determine the new plane group, until the grouping of the planes in the plane list is completed.
[0073] The above method of grouping by traversal can be represented by the following process. Initialize a processed array, which is an array of all zeros. Its size is equal to the size of the plane list (i.e., equal to the number of planes in the plane list). 0 indicates that the plane has not been visited, and if it has been visited, it indicates that it has been grouped; 1 indicates that the plane has been visited.
[0074] The variable `i` is used to traverse the planes in the plane list. First, it checks if `processed[i]` is equal to 1. If it is, it skips directly to the step of incrementing `i`. If `processed[i]` is not equal to 1, it sets `processed[i]` to 1, retrieves plane `i`, and uses this plane as plane 0 (i.e., the base plane of a plane group). It obtains the normal vector `n0` of plane 0 and then stores plane 0 in `planes_seg`. `planes_seg` represents a group of planes configured to segment the point cloud, i.e., a plane group. Plane 0 is the 0th plane in this group, and it has the smallest distance parameter `ρ` in this plane group, meaning it is farthest from the location of the acquisition device.
[0075] After determining plane 0 of a plane group, the planes are traversed using variable j, initially j = i + 1. First, it checks if processed[j] equals 1. If it does, it jumps directly to the step of increasing j. If not, it obtains the normal vector nj of plane j and checks if the following condition is true: n0 · n j >= Preset value. If the above condition is met, then processed[j] = 1, and plane j is stored in planes_seg. After traversing j, all planes in the plane list that are approximately parallel to plane 0 are found. This group of planes constitutes a plane group, corresponding to a segmentation scheme, and is configured to segment the point cloud.
[0076] In this embodiment, for a plane group, the point cloud to be detected can be segmented in the following manner to obtain the point cloud set corresponding to the plane group and the projection plane corresponding to the point cloud set. Repeating the point cloud segmentation process yields the point cloud set corresponding to each plane group and the projection plane corresponding to the point cloud set. Here, one plane group corresponds to one or more point cloud sets, and one point cloud set corresponds to one projection plane, which is the plane immediately below the point cloud set.
[0077] Given a set of planes, determine whether the number of planes in the set is equal to 1.
[0078] If the number of plane groups in the plane group is equal to 1, it means that there is only one plane in the plane group, namely the base plane (i.e., plane 0, plane_0). The point cloud to be detected is segmented using the base plane to obtain a segmented part as a point cloud set corresponding to the plane group, and the base plane is used as the projection plane corresponding to the point cloud set. The point cloud points in the point cloud set are the point cloud points in the point cloud to be detected that are located above the base plane 0. Point cloud points located above a plane indicate that the point cloud point and the acquisition device are located on the same side of the plane.
[0079] A plane divides space into two parts. In this embodiment, only the part of points closest to the acquisition device is taken, i.e., the point cloud located above the plane. When determining the point cloud set, the normal n0 and ρ parameter (i.e., distance parameter) ρ0 of the base plane are obtained. The points in the point cloud to be detected are traversed using the variable k, and the following condition is checked: whether p is true or false. k • Check if n0 - ρ0 > 0 holds true. If so, store point pk in the cluster. Combine the cluster and plane 0 to form a plane_cluster, and store it in plane_clusters. plane_clusters includes the point cloud set obtained based on the point cloud to be detected and the corresponding projection plane of the point cloud set.
[0080] If the number of plane groups in the plane group is greater than 1, the point cloud set corresponding to a plane group and the projection plane corresponding to the point cloud set can be determined in the manner shown in Figure 4. Please refer to Figure 4, which is a flowchart illustrating the sub-steps included in step S130 in Figure 2. In this embodiment, step S130 may include sub-steps S131 to S132.
[0081] In sub-step S131, when the number of planes in the plane group is greater than 1, for each plane pair in the plane group, the point cloud points located in the plane pair are obtained from the point cloud to be detected to obtain the initial point cloud set corresponding to the plane pair, and the lower plane in the plane pair is used as the initial projection plane corresponding to the initial point cloud set.
[0082] Sub-step S132: Based on the initial point cloud set and initial projection plane corresponding to each plane pair, obtain the point cloud set and projection plane corresponding to the plane group.
[0083] In this embodiment, at least one pair of planes can be determined from the plane group by dividing two spatially adjacent planes into a pair, based on the spatial position of each plane in the plane group. In the pair of planes, the upper plane is closer to the acquisition device, and the lower plane is farther away from the acquisition device.
[0084] For a pair of planes, point cloud points located between the two planes of the point cloud to be detected can be selected from the point cloud to be detected, and used as point cloud points in the initial point cloud set corresponding to the pair of planes. The lower plane of the pair of planes can be used as the initial projection plane corresponding to the initial point cloud set.
[0085] As shown in Figure 5, a plane pair includes an upper plane and a lower plane, with the upper plane and the acquisition device located on the same side of the lower plane. The portion of the point cloud to be detected located between the upper and lower planes shown in Figure 5 is taken as the initial point cloud set corresponding to this plane pair.
[0086] Optionally, when an initial point cloud set and initial projection plane corresponding to a plane pair are obtained, the initial point cloud set and initial projection plane corresponding to the plane pair can be directly used as a point cloud set and projection plane corresponding to the plane group; or further analysis can be performed to determine whether the initial point cloud set and initial projection plane corresponding to the plane pair are point cloud sets and projection planes.
[0087] As one possible implementation, whether an initial point cloud set is a point cloud set can be determined as shown in Figure 6. Optionally, the processing shown in Figure 6 can be performed immediately after obtaining an initial point cloud set; alternatively, the processing shown in Figure 6 can be performed sequentially or in parallel on each initial point cloud set after obtaining all initial point cloud sets; other execution orders can also be used, depending on actual needs. Please refer to Figure 6, which is a flowchart illustrating the sub-steps included in sub-step S132 of Figure 4. In this embodiment, sub-step S132 may include sub-steps S1321 to S1323.
[0088] Sub-step S1321: For each initial point cloud set, calculate the centroid of the initial point cloud set and obtain the number of point cloud points in the initial point cloud set.
[0089] Sub-step S1322: Calculate the first distance between the centroid and the upper plane of the corresponding plane pair, and the second distance between the centroid and the lower plane of the corresponding plane pair.
[0090] Sub-step S1323: Based on the number of point cloud points in the initial point cloud set, the corresponding first distance and second distance, determine whether to use the initial point cloud set and the initial projection plane as a point cloud set and projection plane corresponding to the plane group.
[0091] In this embodiment, for an initial point cloud set of a plane pair, the centroid position of the initial point cloud set is calculated. Then, the distances between each of the two planes in the plane pair and the centroid position are calculated, i.e., a first distance and a second distance are obtained. The first distance is the distance between the centroid position and the lower plane in the plane pair, and the second distance is the distance between the centroid position and the upper plane in the plane pair. Next, it can be determined whether to classify the initial point cloud set as a point cloud set based on the specific magnitudes of the two distances; alternatively, it can be determined whether to classify the initial point cloud set as a point cloud set based on the specific magnitudes of the two distances and the number of points in the initial point cloud set.
[0092] As one possible implementation, the first distance is subtracted from the second distance to obtain a distance difference, and it is determined whether this preset difference is greater than a preset distance difference. The preset distance difference can be specifically determined based on actual needs, and is configured to determine whether the initial point cloud set obtained from the segmentation is farther from the lower plane. It is also determined whether the number of points in the initial point cloud set is greater than a first preset number, which can be specifically determined based on actual needs, for example, set to 0. If the number of points in the initial point cloud set is greater than the first preset number and the distance difference is less than the preset distance difference, then the initial point cloud set and the initial projection plane are considered as a point cloud set and projection plane corresponding to the plane group. If the number of points in the initial point cloud set is less than or equal to the first preset number, or the distance difference is greater than or equal to the preset distance difference, then the initial point cloud set is not considered as a point cloud set corresponding to the plane group.
[0093] To avoid omissions, the point cloud set and projection plane can be determined by traversing a group of planes that includes multiple planes. The specific process is as follows.
[0094] Suppose a plane group `planes_seg` contains `n` planes. Then, `n-1` partial point clouds are obtained from the point cloud to be detected as an initial point cloud set. These `n-1` parts are stored using `seg`, a vector whose each element is a point cloud pointer. During the point cloud segmentation process, the centroid of each partial point cloud also needs to be calculated.
[0095] Using variable j, iterate through the planes in the planes_seg group to obtain the normal nj and ρ parameter ρj of the j-th plane, and the normal nj+1 and ρ parameter ρj+1 of the (j+1)-th plane. Then, using variable k, iterate through the point cloud points in the point cloud to be detected. First, determine whether the x component of the point cloud point is NOT a number. If it is, skip directly to the step of increasing k; if not, determine whether the following condition is true: p k ·n j -ρ j >0 and p k ·n j+1 -ρ j+1 <0, if true, then store point pk in the j-th part of seg, and set the x-component of point k to be NOT.
[0096] After traversing k, the centroid coordinates mj of the j-th part of the point cloud are calculated. Then, the distances dis_1 from mj to plane j and dis_2 from mj to plane j+1 are calculated, and {dis_1, dis_2} are stored in dis_2s. dis_2s is a vector containing n-1 elements; each element is a 2-tuple representing the distances from the centroid of the j-th part of the point cloud to the two dividing planes. When dividing the j-th part, plane j is used as the initial projection plane for that part.
[0097] Optionally, when determining to store a pk point in the j-th part of seg, the following calculation can be performed: m_total = m_total + pk, where m_total is initially 0. If the j-th part of the point cloud has been obtained, the following calculation can be performed: m_j = m_total / number of points in the j-th part, thus obtaining the centroid coordinates of the j-th part of the point cloud.
[0098] The above processing yields the distances from n-1 partial point clouds (i.e., the initial point cloud set) to the two dividing planes. These distance values can be iterated using the variable j. dis_2s[j][0] represents the distance from the centroid of the j-th partial point cloud to the lower plane, and dis_2s[j][1] represents the distance from the centroid of the j-th partial point cloud to the upper plane.
[0099] If dis_2s[j][0] - dis_2s[j][1] >= 10 or the value of seg[j] is 0, then skip this part. dis_2s[j][0] - dis_2s[j][1] >= 10 indicates that the segmented point cloud is farther from the lower plane and closer to the upper plane; in this case, it can be determined that this part of the point cloud is not the required point cloud set. It should be understood that the 10 mentioned above is only an example of a preset distance difference, and the 0 mentioned above is only an example of the first preset quantity. seg[j] represents the j-th initial point cloud set corresponding to a plane group.
[0100] The significance of segmenting the point cloud lies in segmenting cylindrical surfaces. Regardless of how the acquisition device captures the image, the cylindrical surface always forms an arc with the lower plane, as shown in Figure 5. The distance between the centroid of the j-th segment of the point cloud and the lower plane should be less than its distance to the upper plane. If the distance between the centroid of the j-th segment of the point cloud and the lower plane is significantly greater than or equal to its distance to the upper plane, then this segment cannot be a cylindrical surface. Taking a welding scenario as an example, the principle behind this requirement can be explained: the arc to be welded is concave. If the plane and the cylinder form a concave weld, the cylinder must be above the plane, not below it. Therefore, the distance between the centroid of the j-th segment of the point cloud and the lower plane should be less than its distance to the upper plane.
[0101] At the same time, if the number of point points in this part of the point cloud is 0, it cannot be the required point cloud set.
[0102] If the above conditions are not met, i.e., if dis_2s[j][0]-dis_2s[j][1]>=10 or the size of seg[j] is 0, then the j-th part of the point cloud seg[j] is stored in the cloud_clusters of the plane_cluster, and the plane_down[j] is stored in the plane_downs of the plane_cluster.
[0103] As one possible implementation, when the number of planes in the plane group is greater than 1, point cloud points located above the plane closest to the acquisition device in the plane group can be obtained from the point cloud to be detected. These point cloud points are then used as point cloud points in a point cloud set corresponding to the plane group, and the plane closest to the acquisition device in the plane group is used as the projection plane corresponding to the point cloud set. The plane closest to the acquisition device in the plane group is the plane with the largest distance parameter obtained through sub-steps S121 to S123. The method for obtaining the point cloud set corresponding to the plane closest to the acquisition device is the same as the method described above for obtaining the point cloud set when the plane group includes only one plane, and will not be repeated here. Thus, when the number of planes in a plane group is multiple (i.e., greater than 1), the point cloud set corresponding to the plane group includes the point cloud set determined based on the plane pair and the point cloud set determined based on the plane closest to the acquisition device in the plane group. The point cloud set determined based on the plane group and the corresponding projection plane can be added to `plane_clusters`.
[0104] In the above processing, multiple plane combinations were used to segment the point cloud to be detected. Each time a plane 0 was determined, a point cloud segmentation scheme was identified. However, only one segmentation scheme is correct; that is, the plane that intersects the cylindrical surface is either plane 0 or a plane parallel to plane 0. To find the correct segmentation scheme and the segment corresponding to the cylindrical surface (i.e., the point cloud set corresponding to the cylindrical surface), each segment can be analyzed to determine the target point cloud set and target projection plane configured for cylindrical surface detection. Specifically, the segmentation scheme corresponding to a plane group includes the point cloud set corresponding to that plane group and the projection plane corresponding to that point cloud set.
[0105] Please refer to Figure 7, which is a flowchart illustrating the sub-steps included in step S140 of Figure 2. In this embodiment, step S140 may include sub-steps S141 to S143.
[0106] Sub-step S141: For each point cloud set, project the point cloud points in the point cloud set onto the corresponding projection plane to obtain the projection points.
[0107] Sub-step S142: For each point cloud set, calculate the average width of the point cloud set based on the projection points corresponding to that point cloud set.
[0108] Sub-step S143 involves taking the point cloud set corresponding to the maximum average width among the obtained average widths as the target point cloud set, and determining the target projection plane.
[0109] In this embodiment, for a point cloud set, all points in the point cloud set are projected onto the corresponding projection plane to obtain projected points. Then, based on the positional distribution of the obtained projected points, the average width corresponding to the point cloud set is analyzed. The average width corresponding to the point cloud set is calculated based on the width of the minimum bounding box of the projection point set that conforms to the arc feature. Repeating the above process, the average width corresponding to each point cloud set can be obtained. Finally, the average widths corresponding to each point cloud set are compared to determine the maximum average width. The point cloud set with the maximum average width is then used as the target projection set, and the projection plane corresponding to the point cloud set with the maximum average width is used as the target projection plane.
[0110] Optionally, as a possible implementation, the average width of a point cloud set can be obtained in the manner shown in Figure 8. Please refer to Figure 8, which is a flowchart illustrating the sub-steps included in sub-step S142 of Figure 7. In this embodiment, sub-step S142 may include sub-steps S1421 to S1424.
[0111] Sub-step S1421: Based on the projection points corresponding to the point cloud set, obtain at least one first cluster corresponding to the point cloud set through clustering.
[0112] In this embodiment, the Euclidean clustering algorithm can be used to cluster the projection points of a point cloud set on the corresponding projection plane, and at least one clustered part obtained can be used as at least one first cluster corresponding to the point cloud set.
[0113] Sub-step S1422: For each second cluster, calculate the width of the minimum bounding box and the corresponding average line width of the second cluster.
[0114] Optionally, all obtained first clusters can be used as second clusters, or the second clusters can be determined from the obtained first clusters based on preset rules. For example, for each first cluster, the number of projected points of that first cluster is obtained. If the number of projected points of the first cluster is less than a second preset number, then that first cluster is not used as a second cluster; if the number of projected points of the first cluster is greater than or equal to the second preset number, then that first cluster is used as a second cluster. In this way, the first clusters with a larger number of projected points can be selected as second clusters and configured for subsequent calculations. The second preset number can be specifically determined according to actual needs, for example, set to 10.
[0115] For each second cluster, the minimum bounding box of each cluster can be determined through analysis. The minimum bounding box is a 2D rectangle with length and width, and its width can be obtained. The width of the minimum bounding box of a second cluster can represent the overall characteristics of the second cluster. It is also necessary to analyze and obtain the average line width corresponding to each second cluster. The average line width represents the local average characteristics of the second cluster; curved lines have a smaller average line width.
[0116] Optionally, the variable i can be used to traverse the second cluster corresponding to a point cloud set to obtain the width of the minimum bounding box and the average line width of each second cluster, thereby avoiding omissions.
[0117] Optionally, the average line width corresponding to a second cluster can be obtained in the manner shown in Figure 9. Please refer to Figure 9, which is a flowchart illustrating the sub-steps included in sub-step S1422 in Figure 8. In this embodiment, sub-step S1422 may include sub-steps S14221 to S14223.
[0118] Sub-step S14221: For each projection point in the second cluster, determine the straight line corresponding to that projection point.
[0119] Sub-step S14222: For each projection point, determine the projection value of the projection point in the second cluster that is near the line on the line, and take the difference between the maximum and minimum projection values obtained based on the line as the projection width corresponding to the projection point.
[0120] Sub-step S14223: The average value of the projection widths corresponding to each projection point in the second cluster is used as the average line width corresponding to the second cluster.
[0121] In this embodiment, for a projection point in the second cluster, the projection point is taken as the point to be traversed, and the normal of the projection point is taken as the direction vector to determine the straight line corresponding to the projection point. As shown in Figure 10, the projection point is pj, and the normal of the projection point pj is nj. A straight line can be determined that passes through the projection point pj and takes the normal of the projection point pj nj as its direction.
[0122] For the line corresponding to the projection point, the distance between each projection point in the second cluster and the line is calculated. Projection points with distances less than a preset distance are designated as projection points near the line in the second cluster. The preset distance can be determined based on actual needs. For each projection point near the line in the second cluster, the projection value of each point on the line is calculated. The maximum and minimum projection values are then determined by comparison, and the difference between the maximum and minimum projection values is taken as the projection width corresponding to that projection point. The projection value corresponding to a projection point is: d pro =(p k -p j )·n j dpro represents the projection value, pk represents the projection point for which the projection value needs to be calculated, pj is the projection point through which the line passes, and nj is the normal vector corresponding to the line.
[0123] For the remaining projection points in the second cluster, the above process is repeated to obtain the projection width corresponding to each projection point in the second cluster. Then, the average value of the projection widths corresponding to each projection point in the second cluster is calculated as the average line width corresponding to the second cluster.
[0124] Sub-step S1423: Based on the width of the minimum bounding box of each second cluster and the corresponding average line width, determine the width of the minimum bounding box of the target cluster and the corresponding average line width.
[0125] In this embodiment, after obtaining the minimum bounding box width and average line width of a second cluster in a point cloud set, it can be analyzed and determined whether the second cluster conforms to the arc feature. If so, the second cluster is regarded as a target cluster corresponding to the point cloud set; if not, the second cluster is not regarded as a target cluster corresponding to the point cloud set.
[0126] The inventors of this disclosure have discovered that when a cluster is a straight line or an arc, its average line width has a small value; when cluster i is a point cloud, its average line width has a large value. Based on the above findings, it is possible to determine whether a second cluster is the target cluster in the following manner.
[0127] For a second cluster corresponding to a point cloud set, it is determined whether the width of the minimum bounding box of the second cluster is not less than a first preset width, and whether the average line width of the second cluster is not greater than a second preset width. The first and second preset widths can be determined based on actual needs. If the width of the minimum bounding box of the second cluster is not less than the first preset width, and the average line width of the second cluster is not greater than the second preset width, then the second cluster can be determined to conform to the arc feature and can be considered as a target cluster. Conversely, if the width of the minimum bounding box of the second cluster is less than the first preset width, or the average line width of the second cluster is greater than the second preset width, then the second cluster can be determined to not conform to the arc feature and should not be considered as a target cluster.
[0128] Repeat the above steps for other second clusters corresponding to a point cloud set to obtain each target cluster corresponding to a point cloud set.
[0129] Sub-step S1424: The average width of the minimum bounding box of the target cluster is used as the average width of the point cloud set.
[0130] Given a set of target clusters for a point cloud, the average width of the minimum bounding box of each target cluster can be calculated, and this average width can be used as the average width of the point cloud set.
[0131] If a point cloud set does not include the target cluster, a small preset value can be set as the average width of the point cloud set. For example, -1 can be used as the average width of a point cloud set that includes the target cluster.
[0132] The following example illustrates how to obtain the average width of a point cloud set by iterating through it.
[0133] Use variable i to iterate through the second cluster corresponding to a point cloud set.
[0134] For the second cluster i that has been traversed, the width of the minimum bounding box of the second cluster i is calculated. The width of the minimum bounding box of the second cluster i can represent the overall characteristics of the cluster.
[0135] Additionally, the average line width of the second cluster i needs to be calculated, as shown below. Using variable j, iterate through each point in the second cluster i to obtain the point's position pj, calculate the normal vector nj of that point, and use nj as the direction vector of the line to obtain a straight line passing through pj. Using variable k, iterate through each point in the second cluster i and calculate the perpendicular distance from that point to the line, using the following formula: d ver =|p k-p j -((p k -p j )·n j )n j | where pk is the k-th point in the second cluster i, nj is the direction vector of the line, and pj is the point through which the line passes. If dver is less than a preset distance dth, it indicates that the point is near the line. Then, the projection value of the point on the line is calculated. The formula for calculating the projection value is as follows: d pro =(p k -p j )·n j After traversing k, the projection values of all points near the line in the second cluster i are obtained. By comparison, the maximum projection value dpro,max and the minimum projection value dpro,min can be determined. Then, the projection width dwidth = dpro,max - dpro,min of point j can be calculated. After traversing j, the average of all obtained projection widths is taken to obtain the average line width of the second cluster i. The average line width represents the local average characteristic of the second cluster i.
[0136] Given the width of the minimum bounding box and the corresponding average line width of a second cluster i, we can determine if the following conditions are met: the width of the minimum bounding box >= the first preset width, and the average line width <= the second preset width. If these conditions are met, it indicates that the second cluster conforms to the arc feature, and we can increment num_circle by 1 and add the minimum bounding box width to the total width. The initial value of num_circle is 0. After traversing the second cluster for a point cloud set, the resulting num_circle represents the number of cylinders contained in that point cloud set.
[0137] After traversing the second cluster for a point cloud set, the final total width can be divided by num_circle, and the result can be used as the average width of that point cloud set. If num_circle is 0 in a point cloud set, then -1 can be used as the average width of that point cloud set.
[0138] Given the average width of all point cloud sets, the point cloud set with the maximum average width can be used as the optimal segmentation part, and this part of the point cloud can be projected onto the corresponding projection plane to detect the cylinder.
[0139] In this embodiment, firstly, for the planes in the planar detection results of the point cloud to be detected, the initial normal orientation and initial distance parameters of the planes are adjusted according to the position of the acquisition device, so that the plane normal orientation of the planes all points to the TCP direction. Then, based on the normal and distance parameters of the planes obtained after the above processing, the planes indicated by the planar detection results are divided into plane groups. Each group of planes corresponds to a segmentation scheme. Multiple segmentation schemes are used to segment the point cloud to be detected, resulting in multiple point cloud sets and corresponding projection planes. Next, the point cloud points in the point cloud sets are projected onto the corresponding projection planes, and the probability that the projected points contain circular curves is evaluated. Finally, the point cloud set most likely to contain circular curves is selected to detect cylindrical surfaces. This allows for more stable cylindrical surface detection with higher accuracy.
[0140] To perform the corresponding steps in the above embodiments and various possible methods, an implementation of a cylindrical surface detection device 200 is given below. Optionally, the cylindrical surface detection device 200 can adopt the device structure of the electronic device 100 shown in FIG1. Optionally, please refer to FIG11, which is a block diagram of the cylindrical surface detection device 200 provided in the embodiment of this disclosure. It should be noted that the basic principle and technical effects of the cylindrical surface detection device 200 provided in this embodiment are the same as those in the above embodiments. For the sake of brevity, parts not mentioned in this embodiment can be referred to the corresponding contents in the above embodiments. In this embodiment, the cylindrical surface detection device 200 may include: an acquisition module 210, a grouping module 220, a point cloud segmentation module 230, a filtering module 240, and a detection module 250.
[0141] The obtaining module 210 is configured to obtain the planar detection result corresponding to the point cloud to be detected.
[0142] The grouping module 220 is configured to divide the planes in the plane detection results into plane groups. When a plane group includes multiple planes, the angle between the normals of one plane in the group and the normals of the other planes is less than a preset angle.
[0143] The point cloud segmentation module 230 is configured to determine, for each plane group, the point cloud set corresponding to that plane group and the projection plane corresponding to that point cloud set from the point cloud to be detected. Specifically, the point cloud points in a point cloud set and the acquisition device configured to obtain the point cloud to be detected are located on the same side of the projection plane corresponding to that point cloud set, and the projection plane is a plane in the corresponding plane group.
[0144] The filtering module 240 is configured to determine the target point cloud set and the target projection plane from the obtained point cloud set and the corresponding projection plane based on the distribution of projection points of the point cloud set on the corresponding projection plane.
[0145] The detection module 250 is configured to detect the target cylindrical surface based on the target point cloud set and the target projection plane.
[0146] Optionally, the above-mentioned modules can be stored in the memory 110 shown in FIG1 in the form of software or firmware, or embedded in the operating system (OS) of the electronic device 100, and can be executed by the processor 120 in FIG1. At the same time, the data, program code, etc. required to execute the above-mentioned modules can be stored in the memory 110.
[0147] This disclosure also provides a readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the cylindrical surface detection method described above.
[0148] In summary, this disclosure provides a method, apparatus, electronic device, and readable storage medium for detecting cylindrical surfaces. First, a planar detection result of a point cloud to be detected is obtained. Then, the planes in the planar detection result are divided into plane groups. When a plane group includes multiple planes, the angle between the normals of one plane in the group and the normals of the other planes is less than a preset angle. Next, for each plane group, a point cloud set corresponding to that plane group and a projection plane corresponding to that point cloud set are determined from the point cloud to be detected. The point cloud points in a point cloud set and the acquisition device configured to obtain the point cloud to be detected are located on the same side of the projection plane corresponding to that point cloud set. The projection plane is a plane in the corresponding plane group. Then, based on the distribution of the projection points of the point cloud set on the corresponding projection plane, a target point cloud set and a target projection plane are determined from the obtained point cloud set and the corresponding projection plane. Finally, the target cylindrical surface is detected based on the target point cloud set and the target projection plane. Thus, cylindrical surfaces can be detected from point clouds with high detection accuracy.
[0149] In the several embodiments provided in this disclosure, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative; for example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions configured to perform a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0150] In addition, the functional modules in the various embodiments of this disclosure 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.
[0151] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, or a portion 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, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this disclosure. 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.
[0152] The above description is merely an optional embodiment of this disclosure and is not intended to limit this disclosure. Various modifications and variations can be made to this disclosure by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure. Industrial applicability
[0153] This application provides a method and apparatus for detecting cylindrical surfaces, which can detect cylindrical surfaces from point clouds and has high detection accuracy.
Claims
1. A method for detecting cylindrical surfaces, characterized in that, The method includes: Obtain the planar detection results corresponding to the point cloud to be detected; The planes in the plane detection results are divided into plane groups. When a plane group includes multiple planes, the angle between the normals of one plane in the plane group and the normals of the other planes is less than a preset angle. For each plane group, the point cloud set corresponding to the plane group and the projection plane corresponding to the point cloud set are determined from the point cloud to be detected. The point cloud points in a point cloud set and the acquisition device configured to obtain the point cloud to be detected are located on the same side of the projection plane corresponding to the point cloud set. The projection plane is the plane in the corresponding plane group. Based on the distribution of projection points of the point cloud set on the corresponding projection plane, the target point cloud set and the target projection plane are determined from the obtained point cloud set and the corresponding projection plane. The target cylindrical surface is detected based on the target point cloud set and the target projection plane.
2. The method according to claim 1, characterized in that, For each plane group, determining the point cloud set corresponding to that plane group and the projection plane corresponding to that point cloud set from the point cloud to be detected includes: When the number of planes in the plane group is greater than 1, for each pair of planes in the plane group, the point cloud points located in the pair of planes are obtained from the point cloud to be detected to obtain the initial point cloud set corresponding to the pair of planes, and the lower plane in the pair of planes is used as the initial projection plane corresponding to the initial point cloud set. The pair of planes are two planes that are spatially adjacent in the plane group, and the upper plane in the pair of planes is closer to the acquisition device and the lower plane is farther away from the acquisition device. Based on the initial point cloud set and initial projection plane corresponding to each plane pair, the point cloud set and projection plane corresponding to the plane group are obtained.
3. The method according to claim 2, characterized in that, The step of obtaining the point cloud set and projection plane corresponding to the plane group based on the initial point cloud set and initial projection plane corresponding to each plane pair includes: For each initial point cloud set, the centroid of the initial point cloud set is calculated, and the number of point clouds in the initial point cloud set is obtained; The first distance between the centroid and the lower plane in the corresponding plane pair, and the second distance between the centroid and the upper plane in the corresponding plane pair are calculated. Based on the number of points in the initial point cloud set, the corresponding first distance, and the second distance, determine whether to use the initial point cloud set and the initial projection plane as a point cloud set and projection plane corresponding to the plane group.
4. The method according to claim 3, characterized in that, The step of determining whether to use the initial point cloud set and initial projection plane as a point cloud set and projection plane corresponding to the plane group based on the number of point points in the initial point cloud set, the corresponding first distance, and the second distance includes: It is determined that the number of points in the point cloud is greater than a first preset number; Determine whether the distance difference is less than a preset distance difference, wherein the distance difference is the value obtained by subtracting the second distance from the first distance; If the number of point cloud points is greater than the first preset number and the distance difference is less than the preset distance difference, then the initial point cloud set and the initial projection plane are taken as a point cloud set and projection plane corresponding to the plane group.
5. The method according to claim 2, characterized in that, The step of determining, for each plane group, the point cloud set corresponding to that plane group and the projection plane corresponding to that point cloud set from the point cloud to be detected further includes: When the number of planes in the plane group is 1, point cloud points located above the planes in the plane group are obtained from the point cloud to be detected to obtain a point cloud set corresponding to the plane group, and the planes in the plane group are used as the projection planes corresponding to the point cloud set. Here, a point cloud point located above a plane indicates that the point cloud point and the acquisition device are located on the same side of the plane; and / or, When the number of planes in the plane group is greater than 1, the point cloud points located above the plane closest to the acquisition device in the plane group are obtained from the point cloud to be detected to obtain a point cloud set corresponding to the plane group. The plane closest to the acquisition device in the plane group is used as the projection plane corresponding to the point cloud set. When there are multiple planes in a plane group, the point cloud set corresponding to the plane group includes the point cloud set determined based on the plane pair and the point cloud set determined based on the plane closest to the acquisition device in the plane group.
6. The method according to claim 2, characterized in that, The step of dividing the planes in the plane detection results into plane groups includes: For each plane in the plane detection result, the normal and distance parameters of the plane are obtained according to the initial normal and initial distance parameters of the plane and the position of the acquisition device. The initial normal and initial distance parameters of a plane are configured to indicate the plane. The normal of a plane is towards the acquisition device. When the initial normal of a plane is opposite to the normal, the initial distance parameters of the plane are opposite to the distance parameters. Based on the distance parameters of each plane, the planes in the plane detection results are sorted in ascending order of distance parameters to obtain a plane list; The planes in the plane list are traversed according to the plane sorting in the plane list. The first plane that is not assigned to a plane group is taken as the base plane of a plane group. Based on the base plane and the plane sorting, the plane list is traversed again. Planes that are not assigned to a plane group and whose normals are less than the preset angle with the normals of the base plane are added to the plane group in which the base plane is located. The planes in the plane group are sorted according to the plane distance parameter. The planes in the plane group are configured in order to determine the spatially adjacent planes in the plane group.
7. The method according to any one of claims 1-6, characterized in that, The step of determining the target point cloud set and the target projection plane from the obtained point cloud set and the corresponding projection plane based on the distribution of projection points of the point cloud set on the corresponding projection plane includes: For each point cloud set, the point cloud points in the point cloud set are projected onto the corresponding projection plane to obtain the projected points; For each point cloud set, the average width of the point cloud set is calculated based on the projection points corresponding to that point cloud set. The average width is calculated based on the width of the minimum bounding box of the projection point set that conforms to the arc feature. The point cloud set corresponding to the maximum average width among the obtained average widths is taken as the target point cloud set, and the target projection plane is determined.
8. The method according to claim 7, characterized in that, The step of calculating the average width of each point cloud set based on its corresponding projection points includes: Based on the projection points corresponding to the point cloud set, at least one first cluster corresponding to the point cloud set is obtained through clustering; For each second cluster, the width of the minimum bounding box and the corresponding average line width of the second cluster are calculated, wherein the second cluster is the first cluster determined from the obtained first cluster; Based on the width of the minimum bounding box and the corresponding average line width of each second cluster, the width of the minimum bounding box and the corresponding average line width of the target cluster are determined, wherein the target cluster is a second cluster that conforms to the arc feature. The average width of the minimum bounding box of the target cluster is taken as the average width of the point cloud set.
9. The method according to claim 8, characterized in that, The step of calculating the average line width corresponding to each second cluster includes: For each projection point in the second cluster, the corresponding straight line is determined, wherein the straight line of the projection point passes through the projection point and takes the normal of the projection point as its direction; For each projection point, the projection value of the projection point in the second cluster that is near the line is determined on the line, and the difference between the maximum and minimum projection values obtained based on the line is taken as the projection width of the projection point. The average projection width of each projection point in the second cluster is taken as the average line width of the second cluster.
10. The method according to claim 8, characterized in that, The step of determining the width of the minimum bounding box and the corresponding average line width of the target cluster based on the width of the minimum bounding box of each second cluster and the corresponding average line width includes: For each second cluster, determine whether the width of the minimum bounding box of the second cluster is not less than the first preset width, and determine whether the average line width of the second cluster is not greater than the second preset width; If the width of the minimum bounding box of the second cluster is not less than the first preset width, and the average line width of the second cluster is not greater than the second preset width, then the second cluster is determined to be a target cluster.
11. A cylindrical surface detection device, characterized in that, The device includes: The module is configured to obtain the planar detection results corresponding to the point cloud to be detected. The grouping module is configured to divide the planes in the plane detection results into plane groups. When a plane group includes multiple planes, the angle between the normals of one plane in the plane group and the normals of the other planes is less than a preset angle. The point cloud segmentation module is configured to determine, for each plane group, the point cloud set corresponding to the plane group and the projection plane corresponding to the point cloud set from the point cloud to be detected. The point cloud points in a point cloud set and the acquisition device configured to obtain the point cloud to be detected are located on the same side of the projection plane corresponding to the point cloud set. The projection plane is the plane in the corresponding plane group. The filtering module is configured to determine the target point cloud set and the target projection plane from the obtained point cloud set and the corresponding projection plane based on the distribution of the projection points of the point cloud set on the corresponding projection plane. The detection module is configured to detect the target cylindrical surface based on the target point cloud set and the target projection plane.