A spherical fitting method for grid structure point cloud
By partitioning and creating cuboids on the grid structure point cloud, and combining the global optimization of genetic algorithms, the problem of spherical fitting of grid structure point clouds in the existing technology is solved, achieving efficient and accurate spherical fitting effect.
Patent Information
- Application Number
- CN202310653121.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-02
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2043-06-02
AI Technical Summary
The prior art is difficult to efficiently and accurately spherical fitting of point clouds of grid structures under certain noise conditions, especially when rod members and non-spherical structural parts exist between spherical nodes.
By partitioning the point cloud of the target grid structure, and creating cubes in each partition, a genetic algorithm is used to search for the cube boundary coordinates globally to find the cube with the best spherical fitting effect, thereby achieving spherical fitting.
Under the presence of certain noise conditions, accurate spherical fitting of the point cloud of the grid structure is achieved, the fitting accuracy and efficiency are improved, and the optimal cube area of the point cloud of the spherical node is quickly and accurately extracted.
Smart Images

Figure CN116758240B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of point cloud spherical surface fitting, in particular to a spherical surface fitting method for grid structure point cloud. Background Art
[0002] There are more and more large-scale spatial structures under construction. Due to the complexity of such large-scale spatial structures and the construction technology of the construction process, large-scale spatial structures may experience excessive structural deformation (exceeding the warning value). In order to prevent such large-scale spatial structures from deforming during the construction process, scanning is usually used to obtain point clouds of large-scale spatial structures, and the point clouds are used to simulate whether structural deformation will occur during the construction process.
[0003] Large-scale spatial structures generally use large grid structures, usually single-layer or double-layer grids, which are usually designed as a curved surface structure. In the grid structure, there are usually thousands of ball nodes and rods. In order to reflect the ball nodes in the grid structure, it is necessary to fit the spherical surface in the point cloud. At present, the least squares method or the random sampling consistency method is usually used for the spherical surface fitting of the point cloud. The least squares method has strict requirements on noise, and the random sampling consistency method can only maintain good fitting accuracy within a certain noise range. However, for the point cloud of the grid structure, the point cloud formed by the rods, protective nets and other non-spherical structural parts between the ball nodes are all noise points for the spherical surface. And because there are occlusion and viewing angle problems in the scanning required to actually form the point cloud, the point cloud of some real ball nodes will also be missing, which makes it difficult to fit the point cloud to the spherical surface, especially it is difficult to balance the accuracy and efficiency of segmentation and clustering. Therefore, it is hoped that under certain noise, the point cloud of the grid structure can still be automatically cut and spherical surface fitted while taking into account accuracy and efficiency. Summary of the invention
[0004] In view of the deficiencies in the prior art, an object of the present invention is to provide a spherical fitting method for grid structure point cloud, which can solve the technical problems described in the background technology.
[0005] The technical solution to achieve the purpose of the present invention is: a spherical fitting method for a grid structure point cloud, comprising the following steps:
[0006] Step 1: partition the point cloud of the target grid structure into cuboids to obtain at least two point cloud partitions, each of which is a cuboid;
[0007] Step 2: Create a corresponding cube in each point cloud partition, perform spherical fitting on the point cloud in each cube, and obtain the optimal spherical surface after fitting;
[0008] Step 3: Take each cube as a sample point of the population. All cubes constitute a population. The boundary coordinates of the cube are used as the gene value of the sample point. A genetic algorithm is used to perform global optimization on each point cloud partition to find the cube with the best spherical fitting effect.
[0009] Step 4: Extract the coordinates and radius of the ball nodes of the final optimal fitting sphere to complete the spherical fitting of the target grid structure.
[0010] Furthermore, the specific implementation process of step 1 includes the following steps:
[0011] The point cloud of the target grid structure is partitioned in the horizontal direction, and the cutting length and overlapping length of each partition are the same, so that each partition occupies the same area in the point cloud of the target grid structure, and any two adjacent partitions overlap and have the same overlapping area.
[0012] Furthermore, the specific implementation of step 2 includes the following steps:
[0013] Step 21: Slice each point cloud partition in the XYZ direction, and the interval between two adjacent slices is the same, so as to obtain M slice coordinate values of the point cloud partition in the X and Y directions and T slice coordinate values in the Z direction. In each slice, randomly select s / 3 coordinate values in the X, Y, and Z directions respectively to obtain the randomly selected coordinates, and calculate the average coordinate values of the randomly selected coordinates in the X, Y, and Z directions and Create a coordinate system with average coordinate values and As the center, the cube V with side length d, the coordinate range of the cube V is
[0014] Among them, s is a multiple of 3, which represents the number of gene values.
[0015] Step 22: randomly select sampleS fitting point clouds for fitting the spherical surface in the cube V, sampleS ≥ 4, perform spherical surface fitting on the sampleS fitting point clouds to obtain an initial spherical surface;
[0016] Step 23: Calculate the distance D from each point cloud in the cube to the initial spherical surface, and count the total number of point clouds Num whose distance D is less than the distance threshold DistS. If the total number of point clouds Num ≤ the number threshold T, execute step 24; if the total number of point clouds Num > the number threshold T, execute step 25;
[0017] Step 24: randomly select sampleS new point clouds as new fitting point clouds, at least one point cloud among the sampleS new point clouds is different from the sampleS point clouds selected previously, and jump to step 22;
[0018] Step 25: refitting a sphere based on the point clouds with a total number Num of point clouds to obtain a second fitting sphere, counting all point clouds in the cube V whose distance from the second fitting sphere is less than the distance threshold DistS as inliers, thereby obtaining the number of inliers Num1;
[0019] Step 26: until all point clouds in the cube are traversed or the spherical fitting is iterated iter times, iter ≥ 2, so as to obtain the initial spherical surface based on sampleS fitting point clouds and the second spherical surface based on the point cloud with a total number of point clouds Num, and take the initial spherical surface or the second spherical surface corresponding to the maximum value of the total number Num in the point cloud and the number of internal points Num1 in all the initial spherical surfaces and the second spherical surface as the optimal spherical surface, thereby obtaining the optimal spherical surface.
[0020] Furthermore, the specific value of the slice interval is determined by the scanning accuracy of the laser scanner used to scan and form the point cloud.
[0021] Furthermore, the slice interval is 1-3 times the distance between the two nearest point clouds in the rectangular point cloud partition.
[0022] Furthermore, the value of d is 1-1.2 times the diameter of the largest ball node in the current slice.
[0023] Furthermore, the specific implementation of step 3 includes the following steps:
[0024] Step 31: In an iterative process of partitioning the point cloud, randomly generate the boundary coordinates of NP groups of cubes, thereby obtaining NP cubes. The number of cubes constitutes a population of the current target grid structure point cloud. The total number of the population is NP. Each cube is a sample of the population. The boundary coordinates of the cube are the gene values of the sample. The number of iterations of the genetic algorithm is preset Q. The number of inner points of the optimal sphere is selected as the fitness function, that is, the number of inner points of the optimal sphere fitted by each cube V is used as the fitness function value of the cube V.
[0025] Step 32: Current point cloud partitioning generates contemporary population NP popm Then, the same method as step 2 is used to obtain the contemporary population NP popm The optimal sphere corresponding to each of the NP samples in total, as well as the coordinates of the sphere center and the number of interior points corresponding to the optimal sphere;
[0026] Step 33: Calculate the contemporary population NP based on the fitness function popm The coordinates of the center of the fitting sphere corresponding to the maximum value of the fitness function (X popm ,Y popm ,Z popm ), radius Rpopm and the maximum number of internal points maxNum popm ;
[0027] Step 34: Select the contemporary population NP popm Individuals with larger fitness functions are inherited from the contemporary population NP popm Each time, sn sample points are selected, and the cycle is repeated NP times. Each time, the sample point with the largest fitness function value is selected from the sn sample points as the next generation population NP popm-1 The next generation population NP is obtained popm-1 ;
[0028] Step 35: In the population NP popm-1 The crossover operation occurs between any two sample points to exchange gene values and obtain two new sample points. By presetting the crossover probability Pc, Pc*NP popm-1 The sample points undergo multi-point crossover to generate the next generation population NP popm-2 ;
[0029] Step 36: NP popm-2 Perform mutation operation, which also occurs between any two sample points, so as to randomly change the gene value of the sample point to form a new sample point. The mutation probability Pmutation is preset, and a random number between 0 and 1 is generated each time. The size of the random number and Pmutation is judged. If the random number is less than Pmutation, the gene value at the basic position of the sample point is changed; otherwise, the sample point does not mutate, and the cycle is repeated NP times, thereby obtaining the next generation population NP popm-sel ;
[0030] Step 37: Repeat steps 32 to 33 to obtain the next generation population NP popm-sel The coordinates of the center of the sphere (X popm-sel ,Y popm-sel ,Z popm-sel ), radius R popm-sel and the maximum number of internal points maxNum popm-sel , select the sample point in the population corresponding to the larger value of the maximum value of the fitness function in the previous generation population and the maximum value of the fitness function in the next generation population and assign it to the next generation population NP popm-sel sample points, so as to ensure that the optimal sample points can be saved in each iteration;
[0031] Step 38: Set the next generation population NP popm-sel Assigned to the previous generation of the contemporary population NP popm Then repeat steps 31 to 37, iterate Q times, and extract the coordinates of the center of the best fitting sphere (X best ,Ybest ,Z best ) and the maximum number of interior points maxNum best ;
[0032] Step 39: Traverse all point cloud partitions. For the current point cloud partition, remove the point cloud corresponding to the best fitting sphere obtained in step 38, and repeat steps 31 to 38 P times, where P is the number of ball nodes in the current point cloud partition, to obtain the final best fitting sphere for each point cloud partition.
[0033] Furthermore, NP is 50-500, the number of iterations Q is usually 20-50, the genetic algorithm is any one of roulette selection, elite preservation, and tournament selection, and the crossover operation is any one of single-point crossover, multi-point crossover, and uniform crossover.
[0034] Furthermore, the specific implementation process of step 4 includes the following steps:
[0035] Step 41: According to the radius of all ball nodes of the target grid structure and the scanning accuracy used to scan the target grid structure to form a point cloud, determine the radius range of the ball nodes used to fit the spherical surface [R min R max ] and the threshold value of the number of internal points Y num ;
[0036] Step 42: Traverse all the cuboid point cloud partitions of the target grid structure after partitioning, and extract the point cloud partitions with a radius of [R min R max ] and the maximum number of internal points is greater than Y num The center coordinates, radius, and number of inner points of the fitted sphere are used as the center coordinates, radius, and number of inner points of the ball nodes in the corresponding point cloud partition.
[0037] Furthermore, R min Take 0.9-1 times the minimum radius of the structural ball node, R max Take 1-1.1 times the maximum radius of the structure ball node, and the threshold value of the number of internal points Y num The spherical surface of the smallest structural ball node contains 0.3-0.6 times the number of point clouds.
[0038] The beneficial effects of the present invention are as follows:
[0039] (1) By reasonably setting the relevant parameters of the random sampling consensus method (including sampling times, distance threshold, quantity threshold, and number of sample points), the spherical point cloud can be accurately fitted even in the presence of certain noise conditions, without the need to strictly extract the spherical point cloud manually or through other clustering methods;
[0040] (2) The cube side length can be adjusted based on the maximum spherical node diameter of the actual structure through global optimization, and the number of noise points in the spherical point cloud in the cube area can be controlled according to the actual situation;
[0041] (3) By using different optimization algorithms and optimization criteria for global optimization, the optimal cube area corresponding to each spherical node in the region can be quickly found, so that the cube area not only contains a complete point cloud of the spherical surface, but also can control the noise points within the range required by the random sampling consistency method through the cube side length. On the basis of taking into account the accuracy of spherical surface fitting, the efficiency of spherical surface fitting of the overall structure is improved;
[0042] (4) It is not affected by the noise of the overall structure point cloud. For large-scale spherical node grid structures with arbitrary noise and radius range, it is possible to quickly and accurately extract the optimal cube area and spherical surface fitting of the spherical node point cloud. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 It is a schematic diagram of the process of the present invention;
[0044] Figure 2 A schematic diagram of point cloud partitioning obtained by dividing the point cloud of the target grid structure;
[0045] Figure 3 This is a schematic diagram of the comparison of the point cloud before and after the best fitting sphere is obtained through global optimization using a genetic algorithm;
[0046] Figure 4 Schematic diagram for comparing the effects of the optimal fitting sphere. DETAILED DESCRIPTION
[0047] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments:
[0048] like Figure 1 - Figure 4 As shown, a spherical surface fitting method for a grid structure point cloud comprises the following steps:
[0049] Step 1: Partition the point cloud of the target grid structure into rectangular blocks to obtain at least two point cloud partitions, each of which is a rectangular block.
[0050] In this step, the point cloud of the target grid structure is partitioned into rectangular blocks to obtain at least two point cloud partitions. The specific implementation process includes the following steps:
[0051] The point cloud of the target grid structure is partitioned in the horizontal direction, that is, in the XY direction (X direction and Y direction), and the cutting length and overlapping length of each partition are the same, so that each partition occupies the same area in the point cloud of the target grid structure, and any two adjacent partitions overlap and the overlapping area is the same.
[0052] The reason for partitioning in the horizontal direction is that the grid structure is generally a single-layer grid or a double-layer grid, and the top plate is a curved surface design. Therefore, it is not necessary to divide in the Z direction (ie, the height direction) to form partitions.
[0053] refer to Figure 2 , Figure 2 The point cloud of the target grid structure is divided into at least four point cloud partitions, namely point cloud partition 1 to point cloud partition 4. These four point cloud partitions are all rectangular and have the same area. Point cloud partition 1 overlaps with the adjacent point cloud partition 2 and point cloud partition 3, which are overlapping areas 12 and 13. Similarly, point cloud partition 2 and point cloud partition 4 constitute overlapping area 24, and point cloud partition 3 and point cloud partition 4 constitute overlapping area 34. The areas of these four overlapping areas (12, 13, 24, 34) are the same. That is, the division length in the XY direction is the same, so that the area of each point cloud partition is the same, and the overlapping length is the same, so that the area of each overlapping area is the same. Among them, the length and width of the rectangular point cloud partition are the division length in the XY direction, and the width of the overlapping area is the overlapping length.
[0054] The sum of the division length and the overlap length is usually 1-5 times the distance between the two smallest ball nodes, and the overlap length is 1-1.2 times the diameter of the largest ball node, that is, larger than the diameter of the largest ball node, to prevent the boundary of each point cloud partition from being on the ball node, resulting in the loss of the point cloud of the ball node. This ensures that if the boundary of the previous point cloud partition is exactly on the ball node, the next point cloud partition can include the complete ball node through the overlap length, thereby ensuring that all complete ball node point clouds can exist in a certain point cloud partition, avoiding the loss of ball node point clouds.
[0055] In an optional implementation, each point cloud partition includes the same number of P spherical node point clouds.
[0056] Step 2: Create a corresponding cube in each point cloud partition, perform spherical fitting on the point cloud in each cube, and obtain the optimal spherical surface after fitting, that is, obtain the optimal spherical surface corresponding to each cube.
[0057] The specific implementation of step 2 includes the following steps:
[0058] Step 21: Slice each point cloud partition in the XYZ direction, with the interval between two adjacent slices being the same. The specific value of the slice interval is determined by the scanning accuracy of the laser scanner used to scan the point cloud, and is usually 1-3 times the distance between the two nearest point clouds in the rectangular point cloud partition. This will result in M slice coordinate values in the X and Y directions and T slice coordinate values in the Z direction of the point cloud partition. The values of M and T may be the same or different. For example, the M slice coordinate values in the X, Y, and Z directions can be recorded as {X1, X2,…, X i ,…X M}, {Y1,Y2,…,Y i ,…Y M} and {Z1,Z2,…,Z i ,…Z T}, where {X1, Y1, Z1} represents the coordinates of the first slice, and so on. The coordinates of the last slice (i.e., the Mth slice) are {X M ,Y M ,Z T Of course, the number of slices formed by slicing in the XY directions at the same slicing interval is the same, but the number of slices in the XY direction may be the same as or different from the number of slices in the Z direction, which does not mean that the number of slices in the three directions is M.
[0059] In each slice, randomly select s / 3 coordinate values from the slice coordinate values in the X, Y, and Z directions to obtain the randomly selected coordinates, and calculate the average coordinate values of the randomly selected coordinates in the X, Y, and Z directions and Create a coordinate system with average coordinate values and As the center, the cube V with side length d, the coordinate range of the cube V is
[0060] Among them, s is a multiple of 3, s represents the number of gene values, that is, s takes the value of the gene value. If the gene value is a multiple of 3, the gene value itself is taken. If the gene value is not a multiple of 3, the value closest to the gene value and divisible by 3 is taken. For example, if the gene value is 11, s can take the value of 12. The value of d is 1-1.2 times the diameter of the largest ball node in the current slice.
[0061] Step 22: Randomly select sampleS fitting point clouds in the cube V for fitting the spherical surface, sampleS ≥ 4, perform spherical surface fitting on the sampleS fitting point clouds to obtain the initial spherical surface.
[0062] Step 23: Calculate the distance D between each point cloud in the cube and the initial sphere, that is, the distance between each point cloud and the center of the initial sphere. Count the total number of point clouds Num whose distance D is less than the distance threshold DistS. If the total number of point clouds Num ≤ the number threshold T, execute step 24. If the total number of point clouds Num > the number threshold T, execute step 25.
[0063] Step 24: Randomly reselect sampleS new point clouds as new fitting point clouds, at least one point cloud among the sampleS new point clouds is different from the sampleS point clouds selected previously, and jump to step 22.
[0064] Step 25: Refit the sphere based on the total number of point clouds Num to obtain a second fitted sphere, and count all point clouds in the cube V whose distance from the second fitted sphere is less than the distance threshold DistS as internal points, thereby obtaining the number of internal points Num1.
[0065] Step 26: until all point clouds in the cube are traversed or the spherical fitting is iterated iter times, iter ≥ 2. Thus, the initial spherical surface obtained based on sampleS fitting point clouds and the second spherical surface obtained based on the point cloud with the total number of point clouds Num are obtained. The initial spherical surface or the second spherical surface corresponding to the maximum number of the total number of point clouds Num and the number of inner points Num1 in all the initial spherical surfaces, the second spherical surface is taken as the optimal spherical surface, thereby obtaining the optimal spherical surface. The coordinates of the center of the optimal spherical surface are marked as (X b ,Y b ,Z b ), whose radius is denoted by R b .
[0066] Step 3: Take each cube V as a sample point of the population. All cubes V constitute a population, and the inner boundary coordinates of cube V are used as the gene value of the sample point. The range coordinates of the boundary coordinates of cube V are used to characterize the sample points. For example, the boundary coordinates of the cube in the XYZ direction are [100 200], [300 400], and [500 600], respectively. The coordinates within this boundary coordinate range are the gene values. For example, (100, 300, 500) is a gene value. Genetic algorithms are used to globally select the cube with the best spherical fitting effect for each point cloud partition. The genetic algorithm plays a role in global optimization, that is, the genetic algorithm can search and find the best cube with the best spherical fitting effect in the entire point cloud.
[0067] The specific implementation of step 3 includes the following steps:
[0068] Step 31: All cubes V are formed into a population. The number of cubes V constitutes the total population number NP of the current target grid structure point cloud. The value of NP is usually 50-500. Each cube V is used as a sample of the population. The boundary coordinates of cube V are the gene values of the sample. The number of iterations Q of the genetic algorithm is preset. The number of iterations Q is usually 20-50. The number of inner points of the optimal sphere is selected as the fitness function, that is, the number of inner points of the optimal sphere fitted by each cube V is used as the fitness function of the cube V.
[0069] Step 32: Current point cloud partitioning generates contemporary population NP popm Then, the same method as step 2 is used to obtain the contemporary population NP popm The optimal sphere corresponding to each of the NP sample points, as well as the coordinates of the sphere center and the number of inner points corresponding to the optimal sphere. popm In the optimal sphere process, assuming that the slice interval is 5 and the boundary coordinate range of the cube is {[100 200], [300 400], [500 600]}, the coordinates obtained by slicing the cube V representing the point cloud partitions through the slice interval are: the coordinates in the X direction include 100, 105, 110, ..., 200, the coordinates in the Y direction include 300, 305, 310, ..., 400, and the coordinates in the Y direction include 500, 505, 510, ..., 600. Then a set of gene values can be randomly generated within this coordinate range, for example, a set of gene values (150, 230, 560) can be randomly generated. Assuming that the side length of the cube is 15, the boundary parameters of the cube corresponding to the gene value are {[150-7.5 150+7.5], [230-7.5230+7.5], [560-7.5 560+7.5]}, which is the coordinate range of the cube V.
[0070] Step 33: Calculate the contemporary population NP based on the fitness function popm The coordinates of the center of the fitting sphere corresponding to the maximum value of the fitness function (X popm ,Y popm ,Z popm ), radius R popm and the maximum number of internal points maxNum popm .
[0071] Step 34: Select the contemporary population NP popm The individuals with larger fitness functions are inherited. The genetic algorithm can be any one of roulette selection, elite preservation, and tournament selection. In this embodiment, the tournament selection method is preferred for inheritance. popmEach time, sn sample points are selected, and the value of sn can be 2-NP / 2. The cycle is repeated NP times, and each time the sample point with the largest fitness function value is selected from the sn sample points as the next generation population NP. popm-1 The next generation population NP is obtained popm-1 .
[0072] Step 35: In the population NP popm-1 The crossover operation occurs between any two sample points to exchange gene values and obtain two new sample points. The crossover operation includes single-point crossover, multi-point crossover, and uniform crossover. In this embodiment, multi-point crossover is preferred, and the crossover probability Pc is preset so that Pc * NP popm-1 The sample points undergo multi-point crossover to generate the next generation population NP popm-2 .
[0073] Step 36: NP popm-2 Perform mutation operation, which also occurs between any two sample points, so as to randomly change the gene value of the sample point to form a new sample point. Mutation operation includes basic position mutation, uniform mutation, boundary mutation, non-uniform mutation, etc., and the present embodiment preferably uses basic position mutation. Preset mutation probability Pmutation, generate a random number between 0 and 1 each time, judge the size of the random number and Pmutation, if the random number is less than Pmutation, change the gene value at the basic position of the sample point; otherwise, the sample point does not mutate. Repeat NP times to obtain the next generation population NP popm-sel .
[0074] Through steps 34 to 37, the current population can be updated to obtain the next generation population, that is, by defining a population update strategy, the population update strategy includes one of selection, crossover and mutation operations, and the current population NP is updated through the population update strategy. popm For the next generation of population NP popm-sel .
[0075] Step 37: Repeat steps 32 to 33 to obtain the next generation population NP popm-sel The coordinates of the center of the sphere (X popm-sel ,Y popm-sel ,Z popm-sel ), radius R popm-sel and the maximum number of internal points maxNum popm-sel Select the sample point in the population corresponding to the larger value of the maximum value of the fitness function in the previous generation population and the maximum value of the fitness function in the next generation population and assign it to the next generation population NP popm-sel sample points, thus ensuring that the optimal sample points can be saved in each iteration.
[0076] Step 38: Set the next generation population NP popm-sel Assigned to the previous generation of the contemporary population NP popm Then repeat steps 31 to 37, iterate Q times, and extract the coordinates of the center of the best fitting sphere (X best ,Y best ,Z best ) and the maximum number of interior points max Num best .
[0077] Step 39: Traverse all point cloud partitions. For the current point cloud partition, remove the point cloud corresponding to the best fitting sphere obtained in step 38, and repeat steps 31 to 38 P times, where P is the number of ball nodes in the current point cloud partition, to obtain the final best fitting sphere for each point cloud partition.
[0078] refer to Figure 3 and Figure 4 , Figure 3 This is a schematic diagram of the comparison of the point cloud before and after the optimal fitting sphere is obtained through step 3, i.e., global optimization through genetic algorithm. Figure 3 In the figure, the left half is a schematic diagram of a point cloud that has not been processed by a genetic algorithm, and the right half is a schematic diagram of a point cloud that has been processed by a genetic algorithm and includes an optimal fitting sphere. Figure 4 This is a schematic diagram of the comparison of the effects of the optimal fitting sphere. It can be seen from the figure that under certain noise conditions, the point cloud in the V area of the cube can still achieve a good fitting effect of the fitting sphere.
[0079] Step 4: Extract the coordinates and radius of the ball nodes of the final optimal fitting sphere to complete the spherical fitting of the target grid structure.
[0080] The specific implementation process of step 4 includes the following steps:
[0081] Step 41: According to the radius of all ball nodes of the target grid structure and the scanning accuracy used to scan the target grid structure to form a point cloud, determine the radius range of the ball nodes used to fit the spherical surface [R min R max ] and the threshold value of the number of internal points Y num Taking into account the spherical fitting error, R min It can be taken as 0.9-1 times of the minimum radius of the structural ball node. max It can be 1-1.1 times the maximum radius of the structure ball node. Considering that the scanner is usually set up on the ground and there are occlusions and cannot scan the entire surface of the ball, the internal point number threshold Y num The spherical surface of the minimum structural ball node can contain 0.3-0.6 times the number of point clouds.
[0082] Step 42: Traverse all the cuboid point cloud partitions of the target grid structure after partitioning, and extract the point cloud partitions with a radius of [R min R max ] and the maximum number of internal points is greater than Y num The center coordinates, radius, and number of inner points of the fitted sphere are used as the center coordinates, radius, and number of inner points of the ball nodes in the corresponding point cloud partition.
[0083] The embodiment disclosed in this specification is only an example of a unilateral feature of the present invention, and the protection scope of the present invention is not limited to this embodiment, and any other functionally equivalent embodiments fall within the protection scope of the present invention. For those skilled in the art, various other corresponding changes and deformations can be made according to the technical solutions and concepts described above, and all of these changes and deformations should fall within the protection scope of the claims of the present invention.
Claims
1. A spherical fitting method for grid structure point cloud, characterized in that: The steps include: Step 1: partition the point cloud of the target grid structure into cuboids to obtain at least two point cloud partitions, each of which is a cuboid; Step 2: Create a corresponding cube in each point cloud partition, perform spherical fitting on the point cloud in each cube, and obtain the optimal spherical surface after fitting. The specific implementation of step 2 includes the following steps: Step 21: Slice each point cloud partition in the XYZ direction, and the interval between two adjacent slices is the same, so as to obtain M slice coordinate values of the point cloud partition in the X and Y directions and T slice coordinate values in the Z direction. In each slice, randomly select s / 3 coordinate values in the X, Y, and Z directions respectively to obtain the randomly selected coordinates, and calculate the average coordinate values of the randomly selected coordinates in the X, Y, and Z directions , and , create a , and As the center, the cube V with side length d, the coordinate range of the cube V is , Among them, s is a multiple of 3, which represents the number of gene values. Step 22: randomly select sampleS fitting point clouds for fitting the spherical surface in the cube V, sampleS ≥ 4, perform spherical surface fitting on the sampleS fitting point clouds to obtain an initial spherical surface; Step 23: Calculate the distance D from each point cloud in the cube to the initial spherical surface, and count the total number of point clouds Num whose distance D is less than the distance threshold DistS. If the total number of point clouds Num ≤ the number threshold T, execute step 24; if the total number of point clouds Num > the number threshold T, execute step 25; Step 24: randomly select sampleS new point clouds as new fitting point clouds, at least one point cloud among the sampleS new point clouds is different from the sampleS point clouds selected previously, and jump to step 22; Step 25: refitting a sphere based on the point clouds with a total number Num of point clouds to obtain a second fitting sphere, counting all point clouds in the cube V whose distance from the second fitting sphere is less than the distance threshold DistS as inliers, thereby obtaining the number of inliers Num1; Step 26: until all point clouds in the cube are traversed or the spherical fitting is iterated iter times, iter ≥ 2, so as to obtain an initial spherical surface based on sampleS fitting point clouds and a second spherical surface based on the point cloud with a total number of point clouds Num, and take the initial spherical surface or the second spherical surface corresponding to the maximum value of the total number Num in the point cloud and the number of inner points Num1 in all the initial spherical surfaces, the second spherical surface as the optimal spherical surface, so as to obtain the optimal spherical surface; Step 3: Take each cube as a sample point of the population. All cubes constitute a population. The boundary coordinates of the cube are used as the gene value of the sample point. A genetic algorithm is used to perform global optimization on each point cloud partition to find the cube with the best spherical fitting effect. The specific implementation of step 3 includes the following steps: Step 31: In an iterative process of partitioning the point cloud, randomly generate the boundary coordinates of NP groups of cubes, thereby obtaining NP cubes. The number of cubes constitutes a population of the current target grid structure point cloud. The total number of the population is NP. Each cube is a sample of the population. The boundary coordinates of the cube are the gene values of the sample. The number of iterations of the genetic algorithm is preset Q. The number of inner points of the optimal sphere is selected as the fitness function, that is, the number of inner points of the optimal sphere fitted by each cube V is used as the fitness function value of the cube V. Step 32: Current point cloud partitioning generates contemporary populations , and then use the same method as step 2 to get the contemporary population The optimal sphere corresponding to each of the NP samples in total, as well as the coordinates of the sphere center and the number of interior points corresponding to the optimal sphere; Step 33: Calculate the contemporary population based on the fitness function The coordinates of the center of the fitting sphere corresponding to the maximum value of the fitness function ,radius and the maximum number of interior points ; Step 34: Select the contemporary population The individual with the largest fitness function value is inherited from the contemporary population Each time, sn sample points are randomly selected, and the cycle is repeated NP times. Each time, the sample point with the largest fitness function value is selected from the sn sample points as the next generation population. of samples to obtain the next generation population ; Step 35: In the population The crossover operation occurs between any two sample points to exchange gene values and obtain two new sample points. The crossover probability Pc is preset so that Pc* The sample points undergo multi-point crossover to generate the next generation population ; Step 36: Population Perform mutation operation, which also occurs between any two sample points, so as to randomly change the gene value of the sample point to form a new sample point. Preset the mutation probability Pmutation, generate a random number between 0 and 1 each time, and judge the size of the random number and Pmutation. If the random number is less than Pmutation, the gene value at the basic position of the sample point is changed; otherwise, the sample point does not mutate, and the cycle is repeated NP times to obtain the next generation of population. ; Step 37: Repeat steps 32-33 to obtain the next generation population The coordinates of the center of the sphere ,radius and the maximum number of interior points , select the sample points in the population corresponding to the larger value of the maximum value of the fitness function in the previous generation population and the maximum value of the fitness function in the next generation population and assign them to the next generation population sample points, so as to ensure that the optimal sample points can be saved in each iteration; Step 38: The next generation of population Assign to the current population of the previous generation Then repeat steps 31 to 37, iterate Q times, and extract the coordinates of the center of the best fitting sphere. and the maximum number of interior points ; Step 39: traverse all point cloud partitions, for the current point cloud partition, remove the point cloud corresponding to the best fitting sphere obtained in step 38, and repeat steps 31 to 38 P times, where P is the number of ball nodes in the current point cloud partition, to obtain the final best fitting sphere for each point cloud partition; Step 4: Extract the coordinates and radius of the ball node center of the final optimal fitting sphere to complete the spherical fitting of the target grid structure. The specific implementation process of step 4 includes the following steps: Step 41: Determine the radius range of the ball nodes used to fit the spherical surface according to the radius of all ball nodes of the target grid structure and the scanning accuracy used to scan the target grid structure to form a point cloud. and the threshold of the number of inliers ; Step 42: Traverse all the point cloud partitions of the target grid structure after partitioning, and extract the point cloud partitions with a radius of The maximum number of inner and outer points is greater than The center coordinates, radius, and number of inner points of the fitted sphere are used as the center coordinates, radius, and number of inner points of the ball nodes in the corresponding point cloud partition.
2. The spherical surface fitting method of the grid structure point cloud according to claim 1, characterized in that: The specific implementation process of step 1 includes the following steps: The point cloud of the target grid structure is partitioned in the horizontal direction, and the cutting length and overlapping length of each partition are the same, so that each partition occupies the same area in the point cloud of the target grid structure, and any two adjacent partitions overlap and have the same overlapping area.
3. The spherical surface fitting method of the grid structure point cloud according to claim 1, characterized in that: The specific value of the slice interval is determined by the scanning accuracy of the laser scanner used to scan and form the point cloud.
4. The spherical surface fitting method of the grid structure point cloud according to claim 3, characterized in that: The slice interval is 1-3 times the distance between the two nearest point clouds in the rectangular point cloud partition.
5. The spherical surface fitting method of grid structure point cloud according to claim 4, characterized in that: The value of d is 1-1.2 times the diameter of the largest ball node in the current slice.
6. The spherical surface fitting method of grid structure point cloud according to claim 1, characterized in that: NP is 50-500, the number of iterations Q is 20-50, the genetic algorithm is any one of roulette selection, elite preservation, and tournament selection, and the crossover operation is any one of single-point crossover, multi-point crossover, and uniform crossover.
7. The spherical surface fitting method of grid structure point cloud according to claim 1, characterized in that: Take 0.9-1 times the minimum radius of the structural ball node, Take 1-1.1 times the maximum radius of the structure ball node, the threshold of the number of inner points The sphere of the smallest structural ball node contains 0.3-0.6 times the number of point clouds.
Citation Information
Patent Citations
Three-dimensional point cloud splicing method based on standard ball rack
CN113269673A
Method for extracting welding ball from space truss based on point cloud and processing terminal
CN115564761A