A method for detecting a cylinder in a point cloud and related equipment
By quantizing the normal vectors in the point cloud and performing voting, suspected axial directions are identified and unnecessary points are removed, solving the problems of low efficiency and low accuracy in cylinder detection in point clouds, and achieving more efficient cylinder detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- FAIR INNOVATION (SUZHOU) ROBOTIC SYSTEM CO LTD
- Filing Date
- 2026-06-23
- Publication Date
- 2026-07-21
AI Technical Summary
Existing technologies suffer from low detection efficiency and low accuracy when detecting cylinders in point clouds.
By quantizing the normal vector of each point in the point cloud, a voting array is generated through voting. Elements whose angle between the reverse recovery normal vector and the new axis detected in the previous round is greater than the first angle threshold are marked as approximately perpendicular. If the axis identification condition is met, the cross product vector is determined as the suspected axis. Points that are approximately perpendicular to the suspected axis are removed from the current point cloud, and single cylinder detection is performed.
It improves the efficiency and accuracy of detecting the axis of a cylinder, reduces unnecessary processing steps, and enhances the efficiency and accuracy of detection.
Smart Images

Figure CN122434933A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of point cloud detection, and more specifically, to a method and related equipment for detecting cylinders in point clouds. Background Technology
[0002] There is a large demand for welding in modern industrial settings. Welding robots can be used to improve welding efficiency. Welding robot operations require the identification of weld seams in advance, which involves the detection and identification of cylinders.
[0003] Existing methods suffer from low efficiency and low accuracy in detecting the axis of cylinders in point clouds. Summary of the Invention
[0004] The purpose of this invention is to provide a method and related equipment for detecting cylinders in point clouds, so as to improve the above-mentioned problems.
[0005] To achieve the above objectives, the technical solutions adopted in the embodiments of the present invention are as follows: In a first aspect, embodiments of the present invention provide a method for detecting cylinders in point clouds, the method comprising: Quantization is performed based on the normal vector of each point in the current point cloud; Voting is conducted based on the quantization results of each normal vector to obtain a voting array. The voting array includes multiple elements sorted from high to low vote count. Each element contains the corresponding quantization result, the inverse recovery normal vector corresponding to the quantization result, the number of votes, and the voting point. Add an approximately perpendicular marker to elements whose angle between the reverse recovery normal vector and the new axis detected in the previous round is greater than the first angle threshold; If there are two elements in the voting array that satisfy the criteria for axis identification, determine the cross product vector of the two elements as the suspected axis. Among them, the conditions for axial identification include: neither element carries an approximately perpendicular identifier, the angle between their reverse recovery normal vectors is greater than a second angle threshold, and the total number of points in all first-type elements is greater than or equal to a first quantity threshold. The first-type elements are those whose reverse recovery normal vector and the cross product vector have an angle greater than a first angle threshold, and whose reverse recovery normal vector and the reverse recovery normal vectors of both elements have an angle greater than a third angle threshold. Move points approximately perpendicular to the suspected axis from the current point cloud to the suspected cylinder set; Among them, the point that is approximately perpendicular to the suspected axis is the point where the angle between the reverse recovery normal vector and the suspected axis is greater than the first angle threshold. Perform single-cylinder detection on the suspected set of cylinders.
[0006] Secondly, embodiments of the present invention provide a cylinder detection device in a point cloud, the device comprising: The first processing unit is used for quantization based on the normal vector of each point in the current point cloud; The first processing unit is further configured to vote based on the quantization results of each normal vector to obtain a voting array. The voting array includes multiple elements sorted from high to low vote counts. Each element contains the corresponding quantization result, the inverse recovery normal vector corresponding to the quantization result, the number of votes, and the voting points. The first processing unit is also used to add an approximately perpendicular label to elements whose angle between the reverse recovery normal vector and the new axis detected in the previous round is greater than a first angle threshold; The first processing unit is further configured to determine the cross product vectors of two elements that meet the axis identification conditions in the voting array, as suspected axes; wherein, meeting the axis identification conditions includes: neither element carries an approximately perpendicular identifier, the angle between their back-recovery normal vectors is greater than a second angle threshold, and the total number of points in all first-type elements is greater than or equal to a first quantity threshold, and the first-type elements are elements whose back-recovery normal vector and the cross product vector have an angle greater than the first angle threshold, and whose back-recovery normal vector and the back-recovery normal vectors of both elements have an angle greater than a third angle threshold; The first processing unit is further configured to move points that are approximately perpendicular to the suspected axis from the current point cloud to a set of suspected cylinders; wherein, the points that are approximately perpendicular to the suspected axis are points where the angle between the reverse recovery normal vector and the suspected axis is greater than a first angle threshold. The second processing unit is used to perform single cylinder detection on the set of suspected cylinders.
[0007] Thirdly, embodiments of the present invention provide a storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-described method.
[0008] Fourthly, embodiments of the present invention provide an electronic device, the electronic device comprising: a processor and a memory, the memory being used to store one or more programs; when the one or more programs are executed by the processor, the above-described method is implemented.
[0009] Compared to existing technologies, the cylinder detection method and related equipment in point clouds provided by this invention quantize the normal vector of each point in the current point cloud; vote based on the quantization results of each normal vector to obtain a voting array; add an approximately perpendicular marker to elements whose angle between the inversely recovered normal vector and the new axis detected in the previous round is greater than a first angle threshold; if there are two elements in the voting array that meet the axis identification conditions, determine their corresponding cross product vector as a suspected axis; move points approximately perpendicular to the suspected axis from the current point cloud to a suspected cylinder set; and perform single cylinder detection on the suspected cylinder set. By adding an approximately perpendicular marker, some normal vectors in the voting array that do not need to be processed are removed, thereby improving the efficiency and accuracy of detecting cylinder axes.
[0010] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0011] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0012] Figure 1 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention.
[0013] Figure 2 This is one of the flowcharts illustrating the cylinder detection method in point clouds provided in this embodiment of the invention.
[0014] Figure 3 This is the second flowchart illustrating the cylinder detection method in point clouds provided in this embodiment of the invention.
[0015] Figure 4 This is a schematic diagram of a cylinder detection device in a point cloud provided in an embodiment of the present invention.
[0016] In the diagram: 10-Processor; 11-Memory; 12-Bus; 13-Communication interface; 501-First processing unit; 502-Second processing unit. Detailed Implementation
[0017] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0018] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.
[0019] It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Furthermore, in the description of this invention, terms such as "first," "second," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0020] It should be noted that, in this document, relational terms such as "first" and "second" are used only 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.
[0021] In the description of this invention, it should be noted that the terms "upper," "lower," "inner," "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, or the orientation or positional relationship in which the product of this invention is usually placed when in use. They are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limiting this invention.
[0022] In the description of this invention, it should also be noted that, unless otherwise explicitly specified and limited, the terms "set" and "connection" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.
[0023] The following detailed description of some embodiments of the present invention is provided in conjunction with the accompanying drawings. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0024] This invention provides an electronic device, which can be a control device for a welding robot, or a mobile phone, server, or computer device that is directly or indirectly connected to the control device. Please refer to... Figure 1 This is a schematic diagram of the structure of an electronic device. The electronic device includes a processor 10, a memory 11, and a bus 12. The processor 10 and the memory 11 are connected via the bus 12. The processor 10 is used to execute executable modules, such as computer programs, stored in the memory 11.
[0025] Processor 10 can be an integrated circuit chip with signal processing capabilities. During implementation, each step of the cylinder detection method in the point cloud can be completed through integrated logic circuits in the hardware or software instructions within processor 10. The processor 10 can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0026] The memory 11 may include high-speed random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage.
[0027] Bus 12 can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus, etc. Figure 1 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus 12 or one type of bus 12.
[0028] The memory 11 is used to store programs, such as programs corresponding to a cylinder detection device in a point cloud. The cylinder detection device in a point cloud includes at least one software functional module that can be stored in the memory 11 as software or firmware, or embedded in the operating system (OS) of an electronic device. Upon receiving an execution instruction, the processor 10 executes the program to implement the cylinder detection method in the point cloud.
[0029] The electronic device provided in this embodiment of the invention may further include a communication interface 13. The communication interface 13 is connected to the processor 10 via a bus.
[0030] It should be understood that, Figure 1 The structure shown is only a partial schematic diagram of the electronic device; the electronic device may also include components that are larger than... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown. Figure 1 The components shown can be implemented using hardware, software, or a combination thereof.
[0031] The method for detecting cylinders in point clouds provided in this embodiment of the invention can be applied to, but is not limited to, applications. Figure 1 For the specific process of the electronic devices shown, please refer to [link / reference]. Figure 2 The method for detecting cylinders in point clouds includes steps 11 to 16, which are described in detail below.
[0032] Step 11: Quantize based on the normal vector of each point in the current point cloud.
[0033] Each time an axis is detected, the point on the corresponding cylinder is removed from the point cloud, so the current point cloud is continuously updated.
[0034] Step 12: Vote based on the quantization results of each normal vector to obtain a voting array (normal_array).
[0035] The voting array includes multiple elements sorted from highest to lowest vote count. Each element contains the corresponding quantization result, the inverse recovery normal vector corresponding to the quantization result, the number of votes, and the voting points. It should be understood that different normal vectors may yield the same quantization result after quantization, and thus, after inverse recovery of the quantization result, they will correspond to the same inverse recovery normal vector.
[0036] Each normal vector corresponds to a pair of integers (theta_index, pai_index), and voting is conducted at that position. Points with the same or similar normal vectors will vote for the same position. After voting, the number of votes for each position and which points voted for that position can be obtained.
[0037] For each normal vector voting position, it is stored in the normal vector voting array normal_array. Each element in the voting array represents a normal vector voting position, which includes the inverse normal vector corresponding to the position, the number of votes, and the voting point (3D coordinates in the point cloud).
[0038] Step 13: Add an approximately perpendicular marker (normal_array[i].use_ = 0) to elements whose angle between the reverse recovery normal vector and the new axis detected in the previous round is greater than the first angle threshold.
[0039] The first angle threshold can be a value close to 90°, such as 85°.
[0040] The purpose of adding approximately perpendicular markers is to remove some normals from the voting array that do not need to be processed. When one or more axes have been detected, all points whose normals are approximately perpendicular to that axis do not need to be processed again, because when that axis is significant, cylinder detection has already been performed on points whose normals are approximately perpendicular to the axis. If no new axis was detected in the previous round, no marker needs to be added.
[0041] Step 14: If there are two elements in the voting array that meet the criteria for axis identification, determine the cross product vectors of the two elements as potential axes.
[0042] The conditions for axial identification include: neither element carries an approximately perpendicular identifier; the angle between their reverse recovery normal vectors is greater than the second angle threshold; the total number of points in all first-type elements is greater than or equal to the first quantity threshold; and the first-type element is an element whose angle between its reverse recovery normal vector and cross product vector is greater than the first angle threshold, and whose angle between its reverse recovery normal vector and the reverse recovery normal vectors of both elements is greater than the third angle threshold (which may be, but is not limited to, 10°).
[0043] The second angle threshold can be, but is not limited to, 45°. The purpose of ensuring that the angle between the reverse recovery normal vectors normal_i and normal_j of the two elements is greater than a threshold is to avoid the two normal vectors coming from the same plane. Furthermore, when the two normal vectors are approximately parallel, their cross product result is unstable.
[0044] The first quantity threshold can be the scale threshold multiplied by the number of points in the current point cloud. The scale threshold can be, but is not limited to, 0.3. If this condition is met, it means that there are a large number of points whose normal is approximately perpendicular to the cross product vector t_ij. This cross product vector t_ij may be the axis of a cylinder.
[0045] The third angle threshold can be, but is not limited to, 10°. If there are no two elements in the voting array that satisfy the axial determination condition, it means that there may be no cylinder or only one cylinder in the point cloud at this time, and the process ends.
[0046] Step 15: Move the points that are approximately perpendicular to the suspected axis from the current point cloud to the suspected cylinder set (points_ij).
[0047] Among them, the point that is approximately perpendicular to the suspected axis is the point where the angle between the reverse recovery normal vector and the suspected axis is greater than the first angle threshold. Step 16: Perform single cylinder detection on the suspected set of cylinders.
[0048] Alternatively, the points in the suspected cylinder set points_ij can be directly projected onto a plane perpendicular to the suspected axis t_ij to perform circle detection, thereby detecting cylinders.
[0049] In the cylinder detection method in point cloud provided in this embodiment of the invention, by adding an approximately vertical identifier and removing some normals in the voting array that do not need to be processed, the efficiency and accuracy of detecting the cylinder axis are improved.
[0050] Please refer to Figure 3 In an optional implementation, the cylinder detection method in point cloud further includes steps 17 to 20, which are described in detail below.
[0051] Step 17: Determine if the target cylinder has been detected. If yes, proceed to step 18; otherwise, proceed to step 19.
[0052] Step 18: Store the points belonging to the target cylinder into the cylinder set (cylinds), and add the points in the suspected cylinder set that do not belong to the target cylinder back into the current point cloud.
[0053] Step 19: Add the points that are suspected to be clustered into the current point cloud.
[0054] Step 20: Determine whether the number of cylinders in the cylinder set is less than the target number N.
[0055] The target number N can be, but is not limited to, 2.
[0056] If the number of cylinders in the cylinder set is less than the target number N, repeat step 11 to quantize based on the normal vector of each point in the current point cloud. If the number of cylinders in the cylinder set is greater than or equal to the target number N, then end the process.
[0057] Optionally, the normal vector of a point includes two angle descriptions, θ and φ. θ represents the angle between the projection of the point's normal vector onto the xy plane and the positive x-axis, and φ represents the angle between the point's normal vector and the positive z-axis. The formula for quantizing the normal vector of each point in the current point cloud is as follows: theta_index = int(θ / π ×theta_num + 0.5); pai_index = int(φ / π× pai_num + 0.5); Where theta_index represents the quantization result of θ, pai_index represents the quantization result of φ, theta_num and pai_num represent the quantization resolution, that is, how many parts the interval [0, π] is divided into, and (theta_index, pai_index) represents the quantization result of the normal vector (θ, φ).
[0058] In the case of a new axis detected in the previous round, it can be added to the axis information set t_ijs. By traversing the axis and the reverse recovery normal vector in the voting array in the axis information set t_ijs, the reverse recovery normal vector that is approximately perpendicular to each axis in the voting array can be found.
[0059] In this case, regarding the content of step 13, this embodiment of the invention also provides an optional implementation method. Please refer to the following: Step 13, adding an approximately perpendicular marker to elements whose angle between the reverse recovery normal vector and the new axis detected in the previous round is greater than a first angle threshold, includes: Step A-1, let i=1; Step A-2, let j=1; Step A-3: Determine whether the angle between the reverse recovery normal vector normal_i of the i-th element in the voting array and the j-th axis t_ijs[j] in the axis information set t_ijs is greater than the first angle threshold; if the angle is greater than the first angle threshold, proceed to step A-4; if the angle is less than or equal to the first angle threshold, proceed to step A-6. Step A-4: Add an approximate vertical label to the i-th element in the voting array; After step A-4, proceed to step A-5.
[0060] Step A-5: Let i = i + 1, and determine whether i is less than or equal to the total number of elements in the voting array. If i is greater than the total number of elements in the voting array, it means that the addition of the approximate vertical label in this round is complete. If i is less than or equal to the total number of elements in the voting array, repeat step A-2 and let j = 1. Step A-6: Let j = j + 1, and determine whether j is less than or equal to the total number of axes in the axial information set t_ijs; if j is less than or equal to the total number of axes in the axial information set t_ijs, then repeat step A-3; if j is greater than the total number of axes in the axial information set t_ijs, then execute step A-5.
[0061] Building upon the preceding text, since an approximate perpendicular marker is added in each round, in this round, only the new axis detected in the previous round needs to be considered, thereby reducing the number of traversals. In this case, regarding step 13, this embodiment of the invention also provides an optional implementation method. Please refer to the following: Step 13, adding an approximate perpendicular marker to elements whose angle between the reverse recovery normal vector and the new axis detected in the previous round is greater than a first angle threshold, includes: Step B-1, let i=1; Step B-2: Determine whether the angle between the reverse recovery normal vector normal_i of the i-th element in the voting array and the new axis is greater than the first angle threshold; if the angle is greater than the first angle threshold, proceed to step B-3; if the angle is less than or equal to the first angle threshold, proceed to step B-4. Step B-3: Add an approximate vertical label to the i-th element in the voting array.
[0062] After adding an approximate vertical label to the i-th element in the voting array, proceed to step B-4.
[0063] Step B-4: Let i = i + 1, and determine whether i is less than or equal to the total number of elements in the voting array; If i is greater than the total number of elements in the voting array, it means that the addition of the approximate vertical marker is complete in this round; If i is less than or equal to the total number of elements in the voting array, repeat step B-2 to determine whether the angle between the reverse recovery normal vector normal_i of the i-th element in the voting array and the new axis is greater than the first angle threshold.
[0064] Building upon the foregoing, this embodiment of the invention also provides an optional implementation method for determining whether there are two elements in the voting array that satisfy the axial determination condition, including: Step C-1, let i=1; Step C-2: Determine whether the i-th element in the voting array carries an approximate vertical identifier; if the i-th element in the voting array carries an approximate vertical identifier, proceed to step C-3; if the i-th element in the voting array does not carry an approximate vertical identifier, proceed to step C-4.
[0065] Determine if the following condition is true: normal_array[i].use_==0. If the condition is true, it means that the normal does not need to be processed.
[0066] Step C-3: Let i = i + 1, and determine whether i is less than or equal to the total number of elements in the voting array; If i is greater than the total number of elements in the voting array, it is determined that there are no two elements in the voting array that meet the axial identification condition, indicating that there may be no cylinder or only one cylinder in the point cloud at this time, and the algorithm ends; if i is less than or equal to the total number of elements in the voting array, step C-2 is repeated to determine whether the i-th element in the voting array carries an approximately vertical label. Step C-4, let j = i + 1; Step C-5: Determine if j is less than or equal to the total number of elements in the voting array; if j is greater than the total number of elements in the voting array, repeat step C-3, let i = i + 1, and determine if i is less than or equal to the total number of elements in the voting array; if j is less than or equal to the total number of elements in the voting array, proceed to step C-6. Step C-6: Determine whether the j-th element in the voting array carries an approximate vertical identifier; if the j-th element carries an approximate vertical identifier, proceed to step C-7; if the j-th element does not carry an approximate vertical identifier, proceed to step C-8. Step C-7: Let j = j + 1, and repeat step C-5; Step C-8: Determine whether the angle between the reverse recovery normal vector of the i-th element and the reverse recovery normal vector of the j-th element is greater than the second angle threshold; if the angle is less than or equal to the second angle threshold, repeat step C-7 and let j = j + 1; if the angle is greater than the second angle threshold, execute step C-9. Step C-9: Obtain the cross product vector of the reverse recovery normal vector of the i-th element and the reverse recovery normal vector of the j-th element.
[0067] Calculate the cross product vector of normal_i and normal_j, i.e., t_ij = normal_i.cross(normal_j), and normalize t_ij.
[0068] Step C-10: Determine whether the total number of points in all first-type elements is greater than or equal to the first quantity threshold; if the total number of points in all first-type elements is greater than or equal to the first quantity threshold, then execute step C-11; if the total number of points in all first-type elements is less than the first quantity threshold, then repeat step C-7, and let j = j + 1. Step C-11: Determine whether the i-th element and the j-th element in the voting array satisfy the axial identification condition.
[0069] Building upon the preceding text, this embodiment of the invention provides an optional implementation method for obtaining the total number of points in all elements of the first type, as detailed below. The total number of points in all elements of the first type includes: Step C-101: Let num_ij = 0, where num_ij represents the total number of points in all elements of the first type.
[0070] When num_ij is a significant value, it means that the direction corresponding to t_ij is likely to correspond to the axis of a cylinder.
[0071] Step C-102, let k=1; Step C-103: Determine whether the angle between the reverse recovery normal vector and the cross product vector of the k-th element in the voting array is greater than the first angle threshold, and whether the angle between the reverse recovery normal vector of the k-th element in the voting array and the reverse recovery normal vectors of the i-th and j-th elements in the voting array is greater than the third angle threshold. If both are true, let num_ij = num_ij + normal_array[k], where normal_array[k] represents the number of votes for the k-th element in the voting array. If neither is true, proceed to step C-104. The third angle threshold can be, but is not limited to, 10°. That is, it is necessary to ensure that there is a certain angle between normal_k and normal_i and normal_j, so as to avoid counting the normal on the plane, and more importantly, to count the normal on the cylindrical surface.
[0072] Step C-104: Let k = k + 1, and determine whether k is less than or equal to the total number of elements in the voting array; if k is less than or equal to the total number of elements in the voting array, repeat step C-103; if k is greater than the total number of elements in the voting array, then the total number of points in all first-type elements has been obtained.
[0073] Optionally, points approximately perpendicular to the suspected axis are moved from the current point cloud to the suspected cylinder set, including: Step D-1: Initialize the set of suspected cylinders (points_ij); points_ij is used to store points whose normal direction is approximately perpendicular to the direction t_ij.
[0074] Step D-2, let k=1; Step D-3: Determine whether the angle between the reverse recovery normal vector of the k-th element in the voting array and the suspected axis is greater than the first angle threshold. If it is true, proceed to step D-4; if it is not true, proceed to step D-5. Step D-4: Move the voting point of the kth element in the voting array from the current point cloud to the suspected cylinder set; Step D-5: Let k = k + 1, and determine whether k is less than or equal to the total number of elements in the voting array; if k is less than or equal to the total number of elements in the voting array, repeat step D-3; if k is greater than the total number of elements in the voting array, it means that all points approximately perpendicular to the suspected axis have been moved from the current point cloud to the suspected cylinder set.
[0075] In the cylinder detection method in point clouds provided in this embodiment of the invention, each pair of normals in the point cloud is traversed, the cross product vector of the normals is calculated, and it is determined whether there are enough points whose normals are perpendicular to the cross product vector. If so, cylinder detection is performed. First, normal voting is performed, and then a normal voting array is constructed by traversing each pair of normals in the normal voting array. When a significant axis is detected, the axis is saved. When a cylinder is detected, the current point cloud is updated, that is, points on the cylindrical surface are removed. In subsequent processing, points whose normals are approximately perpendicular to the significant axis are no longer processed.
[0076] Please see Figure 4 , Figure 4 The present invention provides a cylinder detection device in a point cloud, which is optionally applied to the electronic device described above.
[0077] The cylinder detection device in point cloud includes: a first processing unit 501 and a second processing unit 502.
[0078] The first processing unit 501 is used to perform quantization based on the normal vector of each point in the current point cloud; The first processing unit 501 is also used to vote based on the quantization results of each normal vector to obtain a voting array. The voting array includes multiple elements sorted from high to low vote count. Each element contains the corresponding quantization result, the inverse recovery normal vector corresponding to the quantization result, the number of votes, and the voting point. The first processing unit 501 is also used to add an approximately perpendicular label to elements whose angle between the reverse recovery normal vector and the new axis detected in the previous round is greater than a first angle threshold. The first processing unit 501 is further configured to determine the cross product vectors of two elements that meet the axis identification conditions in the voting array, as suspected axes; wherein, meeting the axis identification conditions includes: neither element carries an approximately perpendicular identifier, the angle between their back-recovery normal vectors is greater than a second angle threshold, and the total number of points in all first-type elements is greater than or equal to a first quantity threshold, and the first-type element is an element whose back-recovery normal vector and cross product vector have an angle greater than a first angle threshold, and whose back-recovery normal vector and the back-recovery normal vectors of both elements have an angle greater than a third angle threshold; The first processing unit 501 is further configured to move points that are approximately perpendicular to the suspected axis from the current point cloud to the suspected cylinder set; wherein, the points that are approximately perpendicular to the suspected axis are points where the angle between the reverse recovery normal vector and the suspected axis is greater than a first angle threshold. The second processing unit 502 is used to perform single cylinder detection on the suspected set of cylinders.
[0079] The second processing unit 502 can execute step 16 as described above, and the first processing unit 501 can execute other steps in the above method embodiment.
[0080] It should be noted that the cylinder detection device in the point cloud provided in this embodiment can execute the method flow shown in the above-described method flow embodiment to achieve the corresponding technical effects. For the sake of brevity, any parts not mentioned in this embodiment can be referred to the corresponding content in the above-described embodiments.
[0081] This invention also provides a storage medium storing computer instructions and programs, which, when read and executed, perform the cylinder detection method in the point cloud described above. The storage medium may include memory, flash memory, registers, or a combination thereof.
[0082] The following provides an electronic device, which can be a control device for a welding robot, or a mobile phone, server, or computer device that is directly or indirectly connected to the control device. This electronic device... Figure 1 As shown, the above-described method for detecting cylinders in point clouds can be implemented. Specifically, the electronic device includes: a processor 10, a memory 11, and a bus 12. The processor 10 may be a CPU. The memory 11 is used to store one or more programs, which, when executed by the processor 10, perform the cylinder detection method in point clouds described in the above embodiment.
[0083] In summary, the cylinder detection method and related equipment provided by this invention involve quantizing the normal vector of each point in the current point cloud; voting based on the quantization results of each normal vector to obtain a voting array; adding an approximately perpendicular marker to elements whose angle between the inversely recovered normal vector and the newly detected axis in the previous round is greater than a first angle threshold; if there are two elements in the voting array that meet the axis identification conditions, determining their corresponding cross product vector as a suspected axis; moving points approximately perpendicular to the suspected axis from the current point cloud to a suspected cylinder set; and performing single cylinder detection on the suspected cylinder set. By adding an approximately perpendicular marker and removing some normal vectors in the voting array that do not need processing, the efficiency and accuracy of detecting cylinder axes are improved.
[0084] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
[0085] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the invention can be implemented in other specific forms without departing from its spirit or essential characteristics. Therefore, the embodiments should be considered in all respects as exemplary and non-limiting, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within the present invention. No reference numerals in the claims should be construed as limiting the scope of the claims.
Claims
1. A method for detecting cylinders in point clouds, characterized in that, The method includes: Quantization is performed based on the normal vector of each point in the current point cloud; Voting is conducted based on the quantization results of each normal vector to obtain a voting array. The voting array includes multiple elements sorted from high to low vote count. Each element contains the corresponding quantization result, the inverse recovery normal vector corresponding to the quantization result, the number of votes, and the voting point. Add an approximately perpendicular marker to elements whose angle between the reverse recovery normal vector and the new axis detected in the previous round is greater than the first angle threshold; If there are two elements in the voting array that meet the criteria for axis identification, determine the cross product vector of the two elements as the suspected axis. Among them, the conditions for axial identification include: neither element carries an approximately perpendicular identifier, the angle between their reverse recovery normal vectors is greater than a second angle threshold, and the total number of points in all first-type elements is greater than or equal to a first quantity threshold. The first-type elements are those whose reverse recovery normal vector and the cross product vector have an angle greater than a first angle threshold, and whose reverse recovery normal vector and the reverse recovery normal vectors of both elements have an angle greater than a third angle threshold. Move points approximately perpendicular to the suspected axis from the current point cloud to the suspected cylinder set; Among them, the point that is approximately perpendicular to the suspected axis is the point where the angle between the reverse recovery normal vector and the suspected axis is greater than the first angle threshold. Perform single-cylinder detection on the suspected set of cylinders.
2. The method for detecting cylinders in point clouds as described in claim 1, characterized in that, The normal vector of a point includes two angle descriptions, θ and φ. θ represents the angle between the projection of the point's normal vector onto the xy-plane and the positive x-axis, and φ represents the angle between the point's normal vector and the positive z-axis. The formula for quantizing the normal vector of each point in the current point cloud is as follows: theta_index = int(θ / π ×theta_num + 0.5); pai_index = int(φ / π× pai_num + 0.5); Where theta_index represents the quantization result of θ, pai_index represents the quantization result of φ, theta_num and pai_num represent the quantization resolution, and (theta_index, pai_index) represents the quantization result of the normal vector (θ, φ).
3. The method for detecting cylinders in point clouds as described in claim 1, characterized in that, The step of adding an approximately perpendicular marker to elements whose angle between the reverse recovery normal vector and the new axis detected in the previous round is greater than a first angle threshold includes: Step A-1, let i=1; Step A-2, let j=1; Step A-3: Determine whether the angle between the reverse recovery normal vector normal_i of the i-th element in the voting array and the j-th axis t_ijs[j] in the axis information set t_ijs is greater than the first angle threshold; if the angle is greater than the first angle threshold, proceed to step A-4; if the angle is less than or equal to the first angle threshold, proceed to step A-6. Step A-4: Add an approximate vertical label to the i-th element in the voting array; Step A-5: Let i = i + 1, and determine whether i is less than or equal to the total number of elements in the voting array. If i is greater than the total number of elements in the voting array, it means that the addition of the approximate vertical label in this round is complete. If i is less than or equal to the total number of elements in the voting array, repeat step A-2 and let j = 1. Step A-6: Let j = j + 1, and determine whether j is less than or equal to the total number of axes in the axial information set t_ijs; if j is less than or equal to the total number of axes in the axial information set t_ijs, then repeat step A-3; if j is greater than the total number of axes in the axial information set t_ijs, then execute step A-5.
4. The method for detecting cylinders in point clouds as described in claim 1, characterized in that, The step of adding an approximately perpendicular marker to elements whose angle between the reverse recovery normal vector and the new axis detected in the previous round is greater than a first angle threshold includes: Step B-1, let i=1; Step B-2: Determine whether the angle between the reverse recovery normal vector normal_i of the i-th element in the voting array and the new axis is greater than the first angle threshold; if the angle is greater than the first angle threshold, proceed to step B-3; if the angle is less than or equal to the first angle threshold, proceed to step B-4. Step B-3: Add an approximate vertical label to the i-th element in the voting array; Step B-4: Let i = i + 1, and determine whether i is less than or equal to the total number of elements in the voting array; If i is greater than the total number of elements in the voting array, it means that the addition of the approximate vertical marker is complete in this round; If i is less than or equal to the total number of elements in the voting array, repeat step B-2 to determine whether the angle between the reverse recovery normal vector normal_i of the i-th element in the voting array and the new axis is greater than the first angle threshold.
5. The method for detecting cylinders in point clouds as described in claim 1, characterized in that, Determine whether there are two elements in the voting array that satisfy the axial identification criteria, including: Step C-1, let i=1; Step C-2: Determine whether the i-th element in the voting array carries an approximate vertical identifier; if the i-th element in the voting array carries an approximate vertical identifier, proceed to step C-3; if the i-th element in the voting array does not carry an approximate vertical identifier, proceed to step C-4. Step C-3: Let i = i + 1, and determine whether i is less than or equal to the total number of elements in the voting array; If i is greater than the total number of elements in the voting array, it is determined that there are no two elements in the voting array that satisfy the axial identification condition; if i is less than or equal to the total number of elements in the voting array, step C-2 is repeated to determine whether the i-th element in the voting array carries an approximately vertical identifier. Step C-4, let j = i + 1; Step C-5: Determine if j is less than or equal to the total number of elements in the voting array; if j is greater than the total number of elements in the voting array, repeat step C-3, let i = i + 1, and determine if i is less than or equal to the total number of elements in the voting array; if j is less than or equal to the total number of elements in the voting array, proceed to step C-6. Step C-6: Determine whether the j-th element in the voting array carries an approximate vertical identifier; if the j-th element carries an approximate vertical identifier, proceed to step C-7; if the j-th element does not carry an approximate vertical identifier, proceed to step C-8. Step C-7: Let j = j + 1, and repeat step C-5; Step C-8: Determine whether the angle between the reverse recovery normal vector of the i-th element and the reverse recovery normal vector of the j-th element is greater than the second angle threshold; if the angle is less than or equal to the second angle threshold, repeat step C-7 and let j = j + 1; if the angle is greater than the second angle threshold, execute step C-9. Step C-9: Obtain the cross product vector of the reverse recovery normal vector of the i-th element and the reverse recovery normal vector of the j-th element; Step C-10: Determine whether the total number of points in all first-type elements is greater than or equal to the first quantity threshold; if the total number of points in all first-type elements is greater than or equal to the first quantity threshold, then execute step C-11; if the total number of points in all first-type elements is less than the first quantity threshold, then repeat step C-7, and let j = j + 1. Step C-11: Determine whether the i-th element and the j-th element in the voting array satisfy the axial identification condition.
6. The method for detecting cylinders in point clouds as described in claim 5, characterized in that, The total number of points in all elements of type 1, including: Step C-101, let num_ij=0, where num_ij represents the total number of points in all elements of the first type; Step C-102, let k=1; Step C-103: Determine whether the angle between the reverse recovery normal vector of the k-th element in the voting array and the cross product vector is greater than the first angle threshold, and whether the angle between the reverse recovery normal vector of the k-th element in the voting array and the reverse recovery normal vectors of the i-th and j-th elements in the voting array is greater than the third angle threshold; if both are true, let num_ij = num_ij + normal_array[k], where normal_array[k] represents the number of votes for the k-th element in the voting array; if neither is true, proceed to step C-104. Step C-104: Let k = k + 1, and determine whether k is less than or equal to the total number of elements in the voting array; if k is less than or equal to the total number of elements in the voting array, repeat step C-103; if k is greater than the total number of elements in the voting array, then the total number of points in all first-type elements has been obtained.
7. The method for detecting cylinders in point clouds as described in claim 1, characterized in that, The step of moving points approximately perpendicular to the suspected axis from the current point cloud to the suspected cylinder set includes: Step D-1: Initialize the set of suspected cylinders; Step D-2, let k=1; Step D-3: Determine whether the angle between the reverse recovery normal vector of the k-th element in the voting array and the suspected axis is greater than the first angle threshold. If it is true, proceed to step D-4; if it is not true, proceed to step D-5. Step D-4: Move the voting point of the kth element in the voting array from the current point cloud to the suspected cylinder set; Step D-5: Let k = k + 1, and determine whether k is less than or equal to the total number of elements in the voting array; if k is less than or equal to the total number of elements in the voting array, repeat step D-3; if k is greater than the total number of elements in the voting array, it means that all points approximately perpendicular to the suspected axis have been moved from the current point cloud to the suspected cylinder set.
8. A device for detecting cylinders in point clouds, characterized in that, The device includes: The first processing unit is used for quantization based on the normal vector of each point in the current point cloud; The first processing unit is further configured to vote based on the quantization results of each normal vector to obtain a voting array. The voting array includes multiple elements sorted from high to low vote counts. Each element contains the corresponding quantization result, the inverse recovery normal vector corresponding to the quantization result, the number of votes, and the voting points. The first processing unit is also used to add an approximately perpendicular label to elements whose angle between the reverse recovery normal vector and the new axis detected in the previous round is greater than a first angle threshold; The first processing unit is further configured to determine the cross product vectors of two elements that meet the axis identification conditions in the voting array, as suspected axes; wherein, meeting the axis identification conditions includes: neither element carries an approximately perpendicular identifier, the angle between their back-recovery normal vectors is greater than a second angle threshold, and the total number of points in all first-type elements is greater than or equal to a first quantity threshold, and the first-type elements are elements whose back-recovery normal vector and the cross product vector have an angle greater than the first angle threshold, and whose back-recovery normal vector and the back-recovery normal vectors of both elements have an angle greater than a third angle threshold; The first processing unit is further configured to move points that are approximately perpendicular to the suspected axis from the current point cloud to a set of suspected cylinders; wherein, the points that are approximately perpendicular to the suspected axis are points where the angle between the reverse recovery normal vector and the suspected axis is greater than a first angle threshold. The second processing unit is used to perform single cylinder detection on the set of suspected cylinders.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the method as described in any one of claims 1-7.
10. An electronic device, characterized in that, include: Processor and memory, the memory being used to store one or more programs; When the one or more programs are executed by the processor, the method as described in any one of claims 1-7 is implemented.