Point cloud normal information calculation method and device, electronic equipment and readable storage medium

By combining PCA and Hough voting methods, the type of point cloud points is judged and the corresponding normal calculation is performed, the problem of inaccurate normal calculation at the edge of point cloud is solved, and fast and accurate point cloud normal information acquisition is achieved.

CN120451194APending Publication Date: 2025-08-08FAIR INNOVATION (SUZHOU) ROBOTIC SYSTEM CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510524455.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-24
Publication Date
2025-08-08

AI Technical Summary

Technical Problem

When the prior art calculates the normal at the edge of the point cloud, the PCA-based method calculation is inaccurate, resulting in inaccurate information in the point cloud normal information.

Method used

Using a combination of PCA and Hough voting, we use PCA to calculate the normal of non-edge points by judging whether the point cloud point is an edge point, and use Hough voting to calculate the normal of edge points to ensure the accuracy and efficiency of normal calculation.

Benefits of technology

It realizes rapid and accurate acquisition of point cloud normal information, improves the calculation accuracy of normal at the edge, and improves the calculation efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120451194A_ABST
    Figure CN120451194A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a point cloud normal information calculation method and device, electronic equipment and a readable storage medium, and relates to the technical field of computers. The method comprises the following steps: for each point cloud point in a target point cloud, judging whether the point cloud point is an edge point or not; if the point cloud point is not the edge point, taking a first normal direction of the point cloud point obtained by a PCA-based point cloud point normal calculation mode as a target normal direction of the point cloud point; and if the point cloud point is an edge point, taking a second normal direction of the point cloud point obtained by a point cloud point normal calculation mode based on Hough voting as a target normal direction of the point cloud point. Therefore, the normal information of the point cloud can be quickly and accurately obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and more specifically, to a method, device, electronic device, and readable storage medium for calculating point cloud normal information. Background Art

[0002] When processing point clouds, it's necessary to calculate the normals of each point in the cloud. This is typically done using a point cloud normal calculation method based on PCA (Principal Component Analysis). However, this method doesn't effectively calculate normals at the edges of the point cloud. At the intersection of two or more faces, the calculated normals are inaccurate, resulting in inaccurate information in the point cloud normals. Summary of the Invention

[0003] The embodiments of the present application provide a method, device, electronic device and readable storage medium for calculating point cloud normal information, which can quickly and accurately obtain point cloud normal information.

[0004] The embodiments of the present application can be implemented as follows:

[0005] In a first aspect, an embodiment of the present application provides a method for calculating normal information of a point cloud, the method comprising:

[0006] For each point cloud point in the target point cloud, determine whether the point cloud point is an edge point;

[0007] If the point cloud point is not an edge point, the first normal of the point cloud point obtained by the point cloud point normal calculation method based on principal component analysis PCA is used as the target normal of the point cloud point;

[0008] If the point cloud point is an edge point, the second normal of the point cloud point obtained by the point cloud point normal calculation method based on Hough voting is used as the target normal of the point cloud point.

[0009] In a second aspect, an embodiment of the present application provides a point cloud normal information calculation device, the device comprising:

[0010] A judgment module is used to judge whether each point in the target point cloud is an edge point;

[0011] a normal direction determination module, configured to use the first normal direction of the point cloud point obtained by the PCA-based point cloud point normal calculation method as the target normal direction of the point cloud point when the point cloud point is not an edge point;

[0012] The normal determination module is also used to use the second normal of the point cloud point obtained by the point cloud point normal calculation method based on Hough voting as the target normal of the point cloud point when the point cloud point is an edge point.

[0013] In a third aspect, an embodiment of the present application provides an electronic device comprising a processor and a memory, wherein the memory stores machine-executable instructions that can be executed by the processor, and the processor can execute the machine-executable instructions to implement the point cloud normal information calculation method described in the aforementioned embodiment.

[0014] In a fourth aspect, an embodiment of the present application provides a readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the point cloud normal information calculation method as described in the aforementioned embodiment.

[0015] The point cloud normal information calculation method, device, electronic device, and readable storage medium provided in the embodiments of the present application determine, for each point in the target point cloud for which normal information is to be calculated, whether the point is an edge point. If not, the first normal of the point obtained by calculating the point cloud normal using principal component analysis (PCA) is used as the target normal for the point cloud. If so, the second normal of the point obtained by calculating the point cloud normal using Hough voting is used as the target normal for the point cloud. In this way, the normal information of the target point cloud can be obtained quickly and accurately. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without creative work.

[0017] Figure 1 A schematic diagram comparing point cloud normal results calculated using different methods provided in the embodiments of the present application;

[0018] Figure 2 A block diagram of an electronic device provided in an embodiment of the present application;

[0019] Figure 3 A flowchart of a method for calculating point cloud normal information provided in an embodiment of the present application;

[0020] Figure 4 for Figure 3 Schematic diagram of the flow of sub-steps included in step S110;

[0021] Figure 5 for Figure 4 A schematic flow chart of the sub-steps included in sub-step S113;

[0022] Figure 6 The judgment provided in the embodiment of this applicationi Flowchart of whether a point is an edge point;

[0023] Figure 7 for Figure 3 Schematic diagram of the flow of sub-steps included in step S130;

[0024] Figure 8 for Figure 7 A schematic flow chart of the sub-steps included in sub-step S132;

[0025] Figure 9 for Figure 7 A schematic flow chart of the sub-steps included in sub-step S133;

[0026] Figure 10 for Figure 7 A schematic flow chart of the sub-steps included in sub-step S136;

[0027] Figure 11 A schematic diagram of a process for calculating point cloud point normals based on Hough voting provided in an embodiment of the present application;

[0028] Figure 12 A block diagram of a point cloud normal information calculation device provided in an embodiment of the present application.

[0029] Icon: 100 - electronic device; 110 - memory; 120 - processor; 130 - communication unit; 200 - point cloud normal information calculation device; 210 - judgment module; 220 - normal determination module. DETAILED DESCRIPTION

[0030] To make the objectives, technical solutions, and advantages of the embodiments of the present application more clear, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Generally, the components of the embodiments of the present application described and shown in the drawings herein can be arranged and designed in various different configurations.

[0031] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for protection, but merely represents selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making any creative efforts shall fall within the scope of protection of the present application.

[0032] It should be noted that relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus comprising the element.

[0033] The steps for calculating the point cloud normal based on PCA are as follows. Use i to traverse the points in the point cloud, and for the i-th point p i , use the KD tree to find the neighborhood of the point and calculate the covariance matrix of the neighborhood points Among them, p j Represents the jth point in the neighborhood, N represents the size of the neighborhood, and C is decomposed into eigenvalues to obtain the eigenvector n corresponding to the minimum eigenvalue, and n is used as p i Normal direction of the point.

[0034] Using PCA decomposition to find the normal is actually a i The neighborhood of the point is fitted with a local plane, and the normal of the local plane is used as the normal of the point. The normal calculation method based on PCA cannot calculate the normal at the edge of the point cloud well. At the intersection of two or more faces, the calculated normal will deviate from any of the faces. Figure 1 An example is given in Figure 1 A part of the input point cloud is given in a, which mainly contains the intersection of the plane and the cylinder; Figure 1 The normal direction calculated by the PCA algorithm is given in b. It can be seen that at the edge where the plane and the cylinder intersect, the normal direction is inaccurate and deviates from the plane and the cylinder.

[0035] The inventors of this application have discovered that, in order to overcome the shortcomings of the PCA-based point cloud normal calculation method, a Hough voting-based point cloud normal calculation method can be used to calculate the point cloud normal. The Hough voting-based point cloud normal calculation method is roughly as follows.

[0036] Use i to traverse the points in the point cloud, for the i-th point p i , use KD tree to find the neighborhood of the point, let the neighborhood of point pi (i.e. the set of neighborhood points) be recorded as exist A certain number of voting point groups are randomly selected from The 3-tuple consisting of 3 points in the 3-tuple is used to vote for the normal direction. The normal directions falling in the same voting interval will accumulate the number of votes. Compare the voting confidence value difference between the maximum voting confidence value and the second largest voting confidence value. When the voting confidence value difference is greater than a value, the voting can be terminated, and the normal direction corresponding to the position of the maximum voting confidence value is taken as the normal direction of the point. The above process is repeated until i is traversed. The normal calculation method based on Hough voting can accurately calculate the normal direction at the edge of the point cloud, overcoming the problem of normal calculation based on PCA. Figure 1 The normal direction calculated by Hough voting is given in c. It can be seen that the normal direction is accurate at the edge where the plane and the cylinder intersect.

[0037] By analyzing the point cloud normal calculation process based on Hough voting, it can be seen that the above voting process is performed for all points in the point cloud, that is, when the point belongs to a flat area (and does not belong to an edge area) or belongs to an edge area, the above voting process is performed. For points belonging to the edge area (i.e., edge points), Hough voting can calculate the accurate normal of the point, so it is necessary to perform Hough voting on points belonging to the edge area. For points belonging to the flat area, Hough voting can also calculate the accurate normal of the point, but when a point belongs to the flat area, Hough voting is not required, and the normal obtained by the PCA decomposition result of the point can be directly used as the normal of the point. This normal has the same accuracy as the normal obtained by voting. That is, the point cloud normal calculation process based on Hough voting has the possibility of further improving the computational efficiency.

[0038] Based on the above analysis, in order to further improve the computational efficiency of the above-mentioned point cloud normal calculation method based on Hough voting and ensure the accuracy of point cloud normal information (including the normal of each point cloud point in the point cloud), the embodiment of the present application provides a point cloud normal information calculation method, device, electronic device and readable storage medium. For each point cloud point in the target point cloud for which point cloud normal information needs to be calculated, it is first determined whether the point belongs to a flat area or an edge area. If the point belongs to a flat area, Hough voting is not performed, but the normal obtained by the PCA decomposition result of the point is used as the normal of the point. For points belonging to the edge area, the normal obtained by Hough voting is used as the normal of the point. After the points are distinguished, the calculation speed of the entire algorithm can be accelerated, and the accuracy of the normal calculation result is the same as the accuracy of the above-mentioned point cloud normal calculation method based on Hough voting. It is worth noting that the defects existing in the above schemes are the results obtained by the inventors after practice and careful research. Therefore, the discovery process of the above-mentioned problems and the solutions proposed in the embodiments of the present application for the above-mentioned problems below should be the contributions made by the inventors to the present application during the application process.

[0039] The following describes some embodiments of the present application in detail with reference to the accompanying drawings. In the absence of conflict, the following embodiments and features therein may be combined with each other.

[0040] Please refer to Figure 2 , Figure 2 This is a block diagram of an electronic device 100 provided in an embodiment of the present application. The electronic device 100 may be, but is not limited to, a computer, a server, or the like. The electronic device 100 may include a memory 110, a processor 120, and a communication unit 130. The memory 110, the processor 120, and the communication unit 130 are electrically connected to each other, directly or indirectly, to enable data transmission or interaction. For example, these components may be electrically connected to each other via one or more communication buses or signal lines.

[0041] The memory 110 is used to store programs or data. The memory 110 may be, but is not limited to, a random access memory (RAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), etc.

[0042] The processor 120 is used to read / write data or programs stored in the memory 110 and execute corresponding functions. For example, the memory 110 stores a point cloud normal information calculation device 200, which includes at least one software function 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 software programs and modules stored in the memory 110, such as the point cloud normal information calculation device 200 in the embodiment of the present application, thereby implementing the point cloud normal information calculation method in the embodiment of the present application.

[0043] The communication unit 130 is used to establish a communication connection between the electronic device 100 and other communication terminals through a network, and to send and receive data through the network.

[0044] It should be understood that Figure 2 The structure shown is only a schematic diagram of the structure of the electronic device 100. The electronic device 100 may also include Figure 2 More or fewer components than shown, or with Figure 2 Different configurations shown. Figure 2 Each component shown in the figure can be implemented by hardware, software or a combination thereof.

[0045] Please refer to Figure 3 , Figure 3 This is a schematic diagram of a process flow for a method for calculating point cloud normal information provided in an embodiment of the present application. The method can be applied to the aforementioned electronic device. The specific process flow of the method for calculating point cloud normal information is described in detail below. In this embodiment, the method may include steps S110 to S130.

[0046] In step S110 , for each point cloud point in the target point cloud, it is determined whether the point cloud point is an edge point.

[0047] If the point cloud point is not an edge point, step S120 is executed.

[0048] In step S120 , the first normal of the point cloud point obtained by calculating the point cloud point normal based on principal component analysis (PCA) is used as the target normal of the point cloud point.

[0049] If the point cloud point is an edge point, step S130 is executed.

[0050] In step S130 , the second normal of the point cloud point obtained by calculating the point cloud point normal based on Hough voting is used as the target normal of the point cloud point.

[0051] In this embodiment, the target point cloud is the point cloud for which point cloud normal information is required. The specific normal information can be determined based on actual needs. The point cloud normal information includes the target normal of each point in the target point cloud. For example, when identifying a plane in a workpiece, the workpiece point cloud can be used as the target point cloud, and the normal of each point in the point cloud can be calculated. The plane in the point cloud can then be analyzed based on the normals of each point in the point cloud.

[0052] A parallel processing method can be used to determine whether the point cloud points in the target point cloud are edge points, or a traversal method can be used to determine whether the point cloud points in the target point cloud are edge points. The specific processing method can be determined based on actual needs.

[0053] Each point in the target point cloud can be analyzed and determined by any method to determine whether it is an edge point. Specifically, the method determines whether the point cloud point belongs to a flat region or an edge region. If the point cloud point belongs to a flat region, it is not an edge point; if the point cloud point belongs to an edge region, it is an edge point. The specific method for determining whether a point cloud point is an edge point can be determined based on actual needs and is not specifically limited here.

[0054] If the point cloud point is determined not to be an edge point, the first normal of the point cloud point is calculated using principal component analysis (PCA) and used as the target normal for the point cloud point. This allows the target normal of the point cloud point, which is not an edge point, to be obtained with less computational effort and with more accurate results.

[0055] If the point cloud point is determined to be an edge point, the second normal of the point cloud point is calculated using the Hough voting method, and this second normal is used as the target normal of the point cloud point. In this way, the target normal of the point cloud point that is an edge point can be accurately obtained.

[0056] After completing the above-mentioned edge point judgment and target normal determination for each point cloud point in the target point cloud, the point cloud normal information of the target point cloud can be obtained. The point cloud normal information includes the target normal of each point cloud point in the target point cloud. Compared with the point cloud normal calculation method based on PCA (i.e., using PCA decomposition to calculate the normal of each point in the point cloud), the above method can ensure the accuracy of the obtained point cloud normal information; compared with the point cloud normal calculation method based on Hough voting (i.e., obtaining the normal of each point in the point cloud through Hough voting), the calculation efficiency can be improved. The above method is an improved point cloud normal calculation method based on Hough voting.

[0057] As a possible implementation, Figure 4 The method shown is to determine a point cloud point pi Is it an edge point? Please refer to Figure 4 , Figure 4 for Figure 3 Schematic diagram of the flow of sub-steps included in step S110. In this embodiment, step S110 may include sub-steps S111 to S113.

[0058] Sub-step S111: obtaining a first normal of the point cloud point.

[0059] In this embodiment, a KD tree can be established for the target point cloud. i Point, we can use KD tree to find p i Neighborhood of a point (i.e., the neighborhood point set), perform eigenvalue decomposition on the covariance matrix composed of the neighborhood point set, and obtain the eigenvector n corresponding to the minimum eigenvalue i .n i That is the point cloud point p i The first normal direction of .

[0060] The inventor of this application has found through research that when the point cloud point p i When the point cloud point p belongs to a flat area (i.e. not an edge point) or an edge area, i The projection of each vector formed by the neighborhood points in the neighborhood point set on the first normal direction is different. Therefore, the projection can be used to analyze whether the point cloud point is an edge point.

[0061] Sub-step S112 , for each neighborhood point in the neighborhood point set of the point cloud point, calculate the projection length of the vector formed by the neighborhood point and the point cloud point in the first normal direction.

[0062] In this embodiment, the point cloud point p i The neighborhood point set Each neighborhood point in the point cloud is determined to determine the neighborhood point and the point cloud point p i The vector formed is then calculated to obtain the vector in the first normal direction p i The projection length on the point cloud is i , a neighborhood point. In this way, the neighborhood point set can be obtained The projection length corresponding to each neighborhood point in .

[0063] Sub-step S113 , judging whether the point cloud point is an edge point according to the obtained projection length.

[0064] Obtaining a set of neighborhood points After obtaining the projection lengths corresponding to the neighborhood points in , the distribution of the projection lengths can be analyzed to determine whether the point cloud point is an edge point. The specific analysis method can be determined in combination with actual needs. For example, the average value of the projection lengths can be compared with a threshold. If it is less than a threshold, it is determined that it is not an edge point; if it is not less than a threshold, it is determined that it is an edge point.

[0065] As a possible implementation, Figure 5 Please refer to Figure 5 , Figure 5 for Figure 4 Flowchart of sub-steps included in sub-step S113. In this embodiment, sub-step S113 may include sub-steps S1131 to S1134.

[0066] Sub-step S1131 , calculating the standard deviation of the obtained projection lengths.

[0067] Sub-step S1132, determining whether the standard deviation is less than a preset standard deviation.

[0068] If the standard deviation is smaller than the preset standard deviation, sub-step S1133 is executed: determining that the point cloud point is not an edge point.

[0069] If the standard deviation is not less than the preset standard deviation, sub-step S1134 is executed: determining whether the point cloud point is an edge point.

[0070] In this embodiment, the neighborhood point set can be calculated as The standard deviation of the projection lengths corresponding to the neighborhood points in the point cloud is then compared with the preset standard deviation (equivalent to a preset edge threshold). If the standard deviation is less than the preset standard deviation, the point cloud point p is determined to be i is not an edge point; if the standard deviation is not less than the preset standard deviation, the point cloud point p is determined to be i is an edge point.

[0071] The inventors of this application have discovered through research that when a point belongs to a flat area, since the neighboring points of the point are basically distributed around the plane passing through the point, the numerical values of the projection lengths are relatively close and the standard deviation of the projection lengths is small. When a point belongs to an edge area, the distribution of the neighboring points of the point has large differences, resulting in large differences in the numerical values of the projection lengths and a large standard deviation of the projection lengths. Therefore, based on the standard deviation of the projection lengths of the neighboring points of point cloud point pi, it can be determined whether the point pi belongs to an edge point. It can be seen that the above method can accurately determine whether a point cloud point is an edge point.

[0072] The following combination Figure 6 How to determine the point cloud point p iAn example is given to illustrate the process of determining whether it is an edge point.

[0073] exist Figure 6 In the above example, the error (i.e. the projection length) is defined as r j =(p j -p i )·n i , where r j represents the error at point j, p i Is the point that needs to be judged whether it is an edge point, p j Represents point cloud point p i The jth point in the neighborhood point set, n i It is for p i The normal of the point obtained by PCA decomposition.

[0074] S11, perform initialization.

[0075] Use j to traverse p i For the neighborhood of a point, first set j = 0 and initialize mean and std: mean = 0, std = 0. Here, mean represents the mean of the neighborhood point error, and std represents the standard deviation of the neighborhood point error.

[0076] S12, determine whether the current j is smaller than the size of the neighborhood point set.

[0077] If it is less, execute S13.

[0078] S13, from p i Determine p from the neighborhood point set of point j Point: p j =point[indeces[j]], and calculate the p j The error of the point r j :r j =(p j -p i )·n i .

[0079] S14, after obtaining the current p j The error of the point r j After that, execute mean+=r j , std+=r j ·r j .

[0080] Then execute S15: j++ and jump to S12 until j is traversed.

[0081] After j is traversed, execute S16: std = sqrt(std - mean·mean), where Indicates pi The size of the point neighborhood.

[0082] S17, determine whether std is less than the preset standard deviation.

[0083] If std is less than the preset standard deviation, execute S18: determine p i The point is not an edge point.

[0084] If std is greater than or equal to the preset standard deviation, execute S19: determine p i The points are edge points.

[0085] After determining the point cloud point p in the target point cloud i If it is not an edge point, the point cloud point p calculated by PCA point cloud normal calculation method will be i The first normal of the point cloud point is p i The target normal direction is determined by the point cloud point p in the target point cloud. i If it is an edge point, the point cloud point p calculated by Hough voting will be i The second normal of the point cloud point is p i In this way, by performing the above processing on each point in the target point cloud, the point cloud normal information of the target point cloud can be accurately obtained at a high speed.

[0086] The following describes how to use the second normal of the point cloud point obtained by the point cloud point normal calculation method based on Hough voting as the target normal of the point cloud point.

[0087] Please refer to Figure 7 , Figure 7 for Figure 3 Schematic diagram of the flow of sub-steps included in step S130. In this embodiment, step S130 may include sub-steps S132 to S136.

[0088] Sub-step S132 : for the point cloud point, a group of voting point groups corresponding to the point cloud point that have not voted yet is selected to vote once, and a current voting accumulator is obtained.

[0089] In this embodiment, for the point cloud point, multiple voting point groups corresponding to the point cloud point can be determined based on the neighborhood point set of the point cloud point. Each voting point group includes multiple neighborhood points of the point cloud point, and each voting point group is used to determine a plane. For example, a voting point group (i.e., a group of voting point groups) may include 3 neighborhood points of the point cloud point. The multiple voting point groups corresponding to the point cloud point can be generated in a random manner. In this manner, there may be two completely identical voting point groups in the multiple voting point groups. When voting, the point cloud point p can be used in sequence. iOne of the corresponding multiple voting point groups votes.

[0090] For a point in the point cloud, when voting, a group of voting points corresponding to the point cloud point that has not yet voted can be extracted. This group of voting points is then used to update the most recent saved voting accumulator (i.e., the historical voting accumulator) to complete the vote and obtain the current voting accumulator. The vote is cast toward the corresponding voting position based on the plane normal determined by the extracted voting point group. The current voting accumulator includes the voting position and the corresponding number of votes.

[0091] Optionally, you can Figure 8 The current voting accumulator is obtained in the following way. Figure 8 , Figure 8 for Figure 7 Flowchart of sub-steps included in sub-step S132. In this embodiment, sub-step S132 may include sub-steps S1321 to S1324.

[0092] Sub-step S1321 : For the currently extracted voting point group, calculate the normal of the plane determined by the voting point group.

[0093] Sub-step S1322: Calculate the first angle and the second angle based on the normal of the obtained plane.

[0094] Based on the multiple neighborhood points included in the voting point group used for this vote, the normal of the plane passing through the multiple neighborhood points is calculated. After obtaining the plane normal, to facilitate voting, the plane normal can be converted into corresponding first and second angles. The first angle is the angle between the plane normal and the positive Z axis, and the second angle is the angle between the projection of the plane normal on the XY plane and the positive X axis.

[0095] Sub-step S1323: quantize the first angle according to a preset first voting resolution to obtain a first quantization value, and quantize the second angle according to a preset second voting resolution to obtain a second quantization value.

[0096] After the conversion, the first angle may be quantized based on a preset first voting resolution to obtain a first quantized value, thereby converting the first angle into a specific position in a first number of discrete positions, where the first number is equal to the first voting resolution. Furthermore, the second angle may be quantized based on a preset second voting resolution to obtain a second quantized value, thereby converting the second angle into a specific position in a second number of discrete positions, where the second number is equal to the second voting resolution. The first quantized value and the second quantized value constitute the current voting position.

[0097] Among them, quantification can be performed through the following quantification methods. theta_index=int(θ / π·theta_num+0.5), where, It represents the angle between the normal n of the plane and the positive direction of the Z axis, that is, the first angle; θ represents the angle between the projection of the normal n of the plane on the XY plane and the positive direction of the X axis, that is, the second angle; pai_index and theta_index represent the quantized position.

[0098] Sub-step S1324: updating the obtained historical voting accumulator according to the current voting position to complete one vote and obtain the current voting accumulator.

[0099] If the current voting position is included in the historical voting accumulator, the number of votes corresponding to the current voting position in the historical voting accumulator may be updated by adding 1 to obtain the current voting accumulator. If the current voting position is not included in the historical voting accumulator, the current voting position may be added to the historical voting accumulator and the number of votes corresponding to the current voting position may be set to 1 to obtain the current voting accumulator.

[0100] Sub-step S133: obtaining a current voting analysis result based on the current voting accumulator.

[0101] After obtaining the current voting accumulator, the current voting analysis result can be analyzed based on the number of votes for each voting position in the current voting accumulator. The current voting analysis result includes the current maximum voting confidence value and the current second-largest voting confidence value, and the voting confidence value is determined based on the number of votes corresponding to the voting position. One voting position corresponds to one voting confidence value, and the voting confidence value of a voting position is the result of dividing the number of votes for the voting position by the current total number of votes. The current maximum voting confidence value is the maximum value among the voting confidence values of each voting position calculated based on the current voting accumulator, and the current second-largest voting confidence value is the maximum value among the voting confidence values of each voting position calculated based on the current voting accumulator, excluding the current maximum voting confidence value.

[0102] Optionally, based on the current voting accumulator, the voting confidence value of each voting position in the current voting accumulator may be calculated to obtain the current maximum voting confidence value and the current second-largest voting confidence value.

[0103] Optionally, the current voting analysis results can be quickly obtained by combining historical voting analysis results.

[0104] The historical voting analysis results are the most recent voting analysis results obtained before the current vote. Accordingly, the historical voting analysis results include the historical maximum voting confidence value and the historical second-highest voting confidence value. The voting position corresponding to the historical maximum voting confidence value can be used as the first voting position, and the voting position corresponding to the historical second-highest voting confidence value can be used as the second voting position. To facilitate quick determination of the voting positions corresponding to the maximum and second-highest voting confidence values, the voting analysis results can also include the corresponding voting positions for the maximum and second-highest voting confidence values.

[0105] If the current voting position is the first voting position or the second voting position, the number of votes cast for the first voting position and the number of votes cast for the second voting position can be obtained from the current vote accumulator. The quotient of the number of votes cast for the first voting position and the current total number of votes cast can then be calculated as quotient 1; and the quotient of the number of votes cast for the second voting position and the current total number of votes cast can be calculated as quotient 2. The larger of the quotients 1 and 2 is then used as the current maximum vote confidence value, and the smaller of the quotients 2 is used as the current second-largest vote confidence value.

[0106] When the current voting position is different from the first voting position and the second voting position, Figure 9 The method shown above can quickly obtain the current voting analysis results. Figure 9 , Figure 9 for Figure 7 Flowchart of sub-steps included in sub-step S133. In this embodiment, sub-step S133 may include sub-steps S1331 to S1334.

[0107] Sub-step S1331 , calculating a first voting confidence value according to the number of votes corresponding to the first voting position in the current voting accumulator and the current total number of votes.

[0108] Sub-step S1332: Calculate a second voting confidence value based on the number of votes corresponding to the second voting position in the current voting accumulator and the total number of current votes.

[0109] Sub-step S1333: Calculate a third voting confidence value based on the number of votes corresponding to the current voting position in the current voting accumulator and the total number of current votes.

[0110] Sub-step S1334: determining the current maximum voting confidence value and the current second-largest voting confidence value based on the first voting confidence value, the second voting confidence value, and the third voting confidence value.

[0111] In this embodiment, the number of votes cast at the first voting position, the number of votes cast at the second voting position, and the number of votes cast at the current voting position are obtained from the current voting accumulator. Next, the quotient of the number of votes cast at the first voting position and the current total number of votes is calculated as the first voting confidence value; the quotient of the number of votes cast at the second voting position and the current total number of votes is calculated as the second voting confidence value; and the quotient of the number of votes cast at the current voting position and the current total number of votes is calculated as the third voting confidence value. The maximum of the first, second, and third voting confidence values can be used as the current maximum voting confidence value, and the second-largest value can be used as the current second-largest voting confidence value.

[0112] Sub-step S134, calculating and obtaining the difference between the current maximum voting confidence value and the current second-largest voting confidence value.

[0113] Sub-step S135, determining whether the difference is greater than the voting stop value.

[0114] If the difference is greater than the voting stop value, then sub-step S136 is executed: the normal corresponding to the voting position corresponding to the current maximum voting confidence value is used as the target normal of the point cloud point. If the difference is not greater than the voting stop value, then voting continues.

[0115] After determining the current maximum voting confidence value and the current second-largest voting confidence value, the difference between the two can be calculated, and then it can be determined whether the difference is greater than the voting stop value. If the difference is greater than the voting stop value, voting for the point cloud point is stopped, and the normal corresponding to the voting position corresponding to the current maximum voting confidence value is used as the target normal of the point cloud point. If the difference is less than or equal to the voting stop value, voting continues until the difference obtained is greater than the voting stop value, or there is no voting point group for the point cloud point that has not yet voted. When there is no voting point group for the point cloud point that has not yet voted, the normal corresponding to the voting position corresponding to the current maximum voting confidence value can also be used as the target normal of the point cloud point.

[0116] The voting stop value can be a fixed value set manually; or it can be a value set based on the current total number of votes, and increases as the current total number of votes increases, for example, 2*sqrt(M), where M represents the current total number of votes. The difference being greater than the voting stop value is a voting termination condition. Based on the normal distribution assumption, the voting stop value can be derived as 2*sqrt(M), that is, the voting termination condition is derived from the normal distribution assumption.

[0117] Optionally, as a possible implementation method, based on the method of quantizing the normal vector into the voting position, the current maximum voting confidence value can be reversely quantized into a normal direction, and the normal direction can be used as the second normal direction of the point cloud point obtained through the Hough voting method. The second direction is the target normal direction of the point cloud point which is an edge point at this time.

[0118] Alternatively, as another possible implementation, Figure 10 The method shown here obtains the target point cloud of the point cloud point based on the current maximum voting confidence value. Figure 10 , Figure 10 for Figure 7 Flowchart of sub-steps included in sub-step S136. In this embodiment, sub-step S136 may include sub-steps S1361 and S1362.

[0119] Sub-step S1361 , obtaining the sum of the normal directions of the voting positions corresponding to the current maximum voting confidence value as the value to be processed.

[0120] Sub-step S1362: normalize the value to be processed to obtain the target normal of the point cloud point.

[0121] In this embodiment, the sum of the normals of the voting positions corresponding to the current maximum voting confidence value can be obtained by any method, and the obtained sum is used as a processing value. Then, the processing value is normalized, and the processing result is the second normal direction obtained by the Hough voting method for the point cloud point. This second direction is the target normal direction of the point cloud point that is now an edge point.

[0122] Optionally, the normals voted for each voting position can be recorded during the point cloud voting process, thereby facilitating the subsequent acquisition of the sum of the normals voted for the voting position corresponding to the current maximum voting confidence value. Alternatively, the voting accumulator can further include the sum of the normals corresponding to each voting position, where the sum of the normals corresponding to a voting position represents the sum of the normals voted for that voting position. This facilitates the subsequent direct acquisition of the sum of the normals voted for the voting position corresponding to the current maximum voting confidence value.

[0123] To avoid being unable to vote, Figure 7 As shown, before sub-step S132, step S130 may further include sub-step S131.

[0124] Sub-step S131 , determining whether there is a voting point group corresponding to the point cloud point that has not voted yet.

[0125] In this embodiment, when voting for a point cloud point for the first time, a determination is made as to whether a voting point group corresponding to the point cloud point exists that has not yet been voted on. If so, substeps S132 through S135 are executed. If, after substep S135, the difference is determined to be no less than the voting stop value, the process jumps to step S131. If not, the normal corresponding to the voting position with the current maximum voting confidence value in the current voting analysis result is used as the target normal for the point cloud point.

[0126] The following combination Figure 11 , explains how to obtain the target normal of a point cloud point that is an edge point through Hough voting. The current point cloud point is p i .

[0127] S21, initialize the voting accumulator acc, assuming the number of votes is T, then it is necessary to generate T groups of voting points, each voting point group contains 3 neighborhood points; and initialize max1, max2, normal_index_1, normal_index_2.

[0128] max1 represents the maximum vote confidence value, and max2 represents the second-highest vote confidence value. The vote confidence value is the number of votes for a particular voting position divided by the total number of votes currently cast. normal_index_1 represents the voting position with the maximum vote confidence value, and normal_index_2 represents the voting position with the second-highest vote confidence value.

[0129] S22, let i = 0. Let i represent the i-th vote.

[0130] S23, determine whether i is less than T.

[0131] If i is less than T, execute S24. If i is greater than or equal to T, terminate the voting.

[0132] S24, take out the i-th group of voting points, and obtain 3 points p1, p2, and p3.

[0133] S25 , based on the three points p1 , p2 , and p3 in the i th voting point group, perform the following processing: n = ( p2 − p1 ) × ( p3 − p1 ), normalizing n , where n represents the normal to the plane passing through the three points p1 , p2 , and p3 .

[0134] S26, calculate the θ and

[0135] in, represents the angle between n and the positive direction of the Z axis, and θ represents the angle between the projection of n on the XY plane and the positive direction of the X axis. θ=n x / sqrt(1-n z ·n z ), where n x represents the x component of n, n z represents the z component of n.

[0136] S27, calculate pai_index and theta_index according to the voting resolution to obtain the voting position normal_index of this time.

[0137] theta_index=int(θ / π·theta_num+0.5), where pai_num represents The corresponding voting resolution, theta_num represents the voting resolution corresponding to θ, pai_index and theta_index represent the quantized position respectively. pai_index and theta_index are combined into normal_index, which represents the normal voting position.

[0138] S28, determine whether acc contains normal_index.

[0139] If acc contains normal_index, execute S29.

[0140] S29, acc[normal_index].count+=1, acc[normal_index].n+=n, count represents the cumulative number of votes (ie, the number of votes corresponding to a certain position), and n represents the cumulative normal direction.

[0141] If acc does not include normal_index, execute S30.

[0142] S30, initialize acc[normal_index] in acc, that is, create a new voting position, the new voting position is normal_index, and set the cumulative number of votes for this voting position to 0 and the cumulative normal to 0; then, perform the following processing: acc[normal_index].count+=1, acc[normal_index].n+=n.

[0143] After S29 or S30, S31 to S32 are executed.

[0144] S31, when normal_index is different from normal_index_1 and normal_index_2, perform the following calculations: max1=acc[normal_index_1].count / (i+1), max2=acc[normal_index_2].count / (i+1), votes_val=acc[normal_index].count / (i+1).

[0145] S32, determine whether votes_val is greater than max1.

[0146] If votes_val is greater than max1, it means that the voting confidence value at normal_index exceeds the maximum voting confidence value. At this time, S33 can be executed to perform the following update: max2=max1, normal_index_2=normal_index_1, max1=votes_val, normal_index_1=normal_index.

[0147] If votes_val is not greater than max1, execute S34: determine whether votes_val is greater than max2.

[0148] If votes_val is greater than max2, it means that the vote confidence value at normal_index exceeds the next largest vote confidence value. In this case, S35 can be executed to perform the following update: max2 = votes_val, normal_index_2 = normal_index. If votes_val is not greater than max2, no further update is performed.

[0149] In this way, it can always be ensured that max1 is the maximum voting confidence value, max2 is the second largest voting confidence value, normal_index_1 is the voting position corresponding to the maximum voting confidence value, and normal_index_2 is the voting position corresponding to the second largest voting confidence value.

[0150] After determining the maximum voting confidence value and the second largest voting confidence value, S36 is executed to determine whether the following condition is met: max1-max2>2*sqrt(1 / (i+1)).

[0151] If the above conditions are met, the voting is terminated and S38 is executed: acc[normal_index_1].n is normalized as p iThe target normal at point t. Otherwise, execute S37: i = i + 1 and jump to S23 to continue voting. The voting termination condition is derived from the normal distribution assumption. When i is greater than or equal to T, execute S38.

[0152] In order to execute the corresponding steps in the above embodiments and various possible methods, a method for implementing the point cloud normal information calculation device 200 is given below. Optionally, the point cloud normal information calculation device 200 can adopt the above Figure 3 The device structure of the electronic device 100 is shown in FIG. Figure 12 , Figure 12 This is a block diagram of a point cloud normal information calculation device 200 provided in an embodiment of the present application. It should be noted that the basic principles and technical effects of the point cloud normal information calculation device 200 provided in this embodiment are the same as those of the aforementioned embodiments. For the sake of brevity, any details not mentioned in this embodiment are referred to the corresponding contents of the aforementioned embodiments. In this embodiment, the point cloud normal information calculation device 200 may include: a judgment module 210 and a normal determination module 220.

[0153] The judgment module 210 is used to judge whether each point in the target point cloud is an edge point.

[0154] The normal direction determining module 220 is configured to use the first normal direction of the point cloud point obtained by the point cloud point normal calculation method based on PCA as the target normal direction of the point cloud point when the point cloud point is not an edge point.

[0155] The normal direction determining module 220 is further configured to use the second normal direction of the point cloud point obtained by the point cloud point normal calculation method based on Hough voting as the target normal direction of the point cloud point when the point cloud point is an edge point.

[0156] Optionally, the above modules can be stored in the form of software or firmware. Figure 3 The memory 110 shown in FIG. 110 or the operating system (OS) of the electronic device 100 may be fixed and may be used by Figure 3 Meanwhile, the data, program codes, etc. required to execute the above modules may be stored in the memory 110.

[0157] An embodiment of the present application also provides a readable storage medium having a computer program stored thereon, which implements the point cloud normal information calculation method when the computer program is executed by a processor.

[0158] In summary, the embodiments of the present application provide a method, apparatus, electronic device, and readable storage medium for calculating point cloud normal information. For each point in a target point cloud for which normal information needs to be calculated, the method determines whether the point is an edge point. If not, the first normal of the point, obtained by calculating point cloud normals using principal component analysis (PCA), is used as the target normal for the point. If so, the second normal of the point, obtained by calculating point cloud normals using Hough voting, is used as the target normal for the point. In this way, normal information for the target point cloud can be quickly and accurately obtained.

[0159] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architectures, functions and operations of the devices, methods and computer program products according to the multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and the module, program segment or a part of the code contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or can be implemented using a combination of dedicated hardware and computer instructions.

[0160] In addition, the functional modules in each embodiment of the present application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.

[0161] If the functions are implemented in the form of software function 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 the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0162] The above description is merely an optional embodiment of the present application and is not intended to limit the present application. Various modifications and variations are possible for those skilled in the art. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included within the scope of protection of the present application.

Claims

1. A method for calculating point cloud normal information, characterized in that: The method comprises: For each point cloud point in the target point cloud, determine whether the point cloud point is an edge point; If the point cloud point is not an edge point, the first normal of the point cloud point obtained by the point cloud point normal calculation method based on principal component analysis PCA is used as the target normal of the point cloud point; If the point cloud point is an edge point, the second normal of the point cloud point obtained by the point cloud point normal calculation method based on Hough voting is used as the target normal of the point cloud point.

2. The method according to claim 1, characterized in that The step of determining, for each point cloud point in the target point cloud, whether the point cloud point is an edge point includes: For the point cloud point, obtain the first normal direction of the point cloud point; For each neighboring point in the neighborhood point set of the point cloud point, calculate the projection length of a vector formed by the neighboring point and the point cloud point in the first normal direction; According to the obtained projection length, determine whether the point cloud point is an edge point.

3. The method according to claim 2, characterized in that The step of determining whether the point cloud point is an edge point according to the obtained projection length includes: Calculate the standard deviation of the obtained projection lengths; Determine whether the standard deviation is less than the preset standard deviation; If the standard deviation is less than the preset standard deviation, it is determined that the point cloud point is not an edge point; If the standard deviation is not less than the preset standard deviation, the point cloud point is determined to be an edge point.

4. The method according to any one of claims 1 to 3, characterized in that If the point cloud point is an edge point, the second normal of the point cloud point obtained by the point cloud point normal calculation method based on Hough voting is used as the target normal of the point cloud point, including: For the point cloud point, a group of voting point groups is extracted from the voting point groups corresponding to the point cloud point that have not yet voted, and a vote is performed to obtain a current voting accumulator, wherein each voting point group includes multiple neighborhood points of the point cloud point, and each voting point group is used to determine a plane. The voting is performed based on the normal direction of the plane determined by the extracted voting point group toward the corresponding voting position, and the current voting accumulator includes the voting position and the corresponding number of votes; Obtaining a current voting analysis result based on the current voting accumulator, wherein the current voting analysis result includes a current maximum voting confidence value and a current second-largest voting confidence value, and the voting confidence value is determined based on the number of votes corresponding to the voting position; Calculate the difference between the current maximum voting confidence value and the current second-largest voting confidence value; Determining whether the difference is greater than a voting stop value; If the difference is greater than the voting stop value, the normal corresponding to the voting position corresponding to the current maximum voting confidence value is used as the target normal of the point cloud point; If the difference is not greater than the voting stop value, voting continues.

5. The method according to claim 4, characterized in that The step of using the normal corresponding to the voting position corresponding to the current maximum voting confidence value as the target normal of the point cloud point includes: Obtaining the sum of the normal directions of the voting positions corresponding to the current maximum voting confidence value as the value to be processed; Normalize the value to be processed to obtain the target normal of the point cloud point.

6. The method according to claim 4, characterized in that The method of selecting a group of voting points from a plurality of voting point groups that have not voted yet and corresponding to the point cloud point for the point cloud point to vote once, and obtaining a current voting accumulator, includes: For the currently extracted voting point group, calculate the normal direction of the plane determined by the voting point group; Calculate a first angle and a second angle based on the obtained normal of the plane, wherein the first angle is the angle between the normal of the plane and the positive direction of the Z axis, and the second angle is the angle between the projection of the normal of the plane on the XY plane and the positive direction of the X axis; quantizing the first angle according to a preset first voting resolution to obtain a first quantized value, and quantizing the second angle according to a preset second voting resolution to obtain a second quantized value, wherein the first quantized value and the second quantized value constitute a current voting position; The obtained historical voting accumulator is updated according to the current voting position to complete one vote and obtain the current voting accumulator.

7. The method according to claim 4, characterized in that The first voting position is the voting position corresponding to the historical maximum voting confidence value before the current vote, and the second voting position is the voting position corresponding to the historical second largest voting confidence value before the current vote. When the current voting position corresponding to the current vote is different from both the first voting position and the second voting position, obtaining the current voting analysis result based on the current voting accumulator includes: Calculating a first voting confidence value according to the number of votes corresponding to the first voting position in the current voting accumulator and the total number of current votes; Calculating a second voting confidence value according to the number of votes corresponding to the second voting position in the current voting accumulator and the total number of current votes; Calculate a third voting confidence value according to the number of votes corresponding to the current voting position in the current voting accumulator and the total number of current votes; The current maximum voting confidence value and the current second-largest voting confidence value are determined according to the first voting confidence value, the second voting confidence value, and the third voting confidence value.

8. A point cloud normal information calculation device, characterized in that: The device comprises: A judgment module is used to judge whether each point in the target point cloud is an edge point; a normal direction determination module, configured to use the first normal direction of the point cloud point obtained by the PCA-based point cloud point normal calculation method as the target normal direction of the point cloud point when the point cloud point is not an edge point; The normal determination module is also used to use the second normal of the point cloud point obtained by the point cloud point normal calculation method based on Hough voting as the target normal of the point cloud point when the point cloud point is an edge point.

9. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor can execute the machine executable instructions to implement the point cloud normal information calculation method according to any one of claims 1 to 7.

10. A readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for calculating point cloud normal information according to any one of claims 1 to 7 is implemented.