Disclosure of Invention
The invention aims to solve the defects in the prior art and provides a round hole feature extraction method facing rivet hole measurement point cloud data.
In order to achieve the purpose, the invention adopts the following technical scheme:
a round hole feature extraction method facing rivet hole measurement point cloud data comprises the following steps:
s1: extracting point cloud boundary points according to the distribution condition of k neighborhood points of each point in the point cloud;
s2: obtaining point cloud blocks belonging to different boundary characteristics through Euclidean distance clustering segmentation of boundary points;
s3: and extracting the rivet hole boundary in the cloud block of the segmentation point by an ellipse fitting method.
Preferably: the method for extracting the point cloud boundary points comprises the following steps:
s11: establishing a kd-Tree structure of scattered point cloud by using a kd-Tree method to obtain a point PiAnd its k neighborhood point Nj(j =0,1,2 … k-1) to obtain P by least squares fittingiA local tangent plane to the point;
s12: establishing a plane coordinate system on the tangent plane by P
iTo the tangent plane projection point P
iAs origin of coordinates, P
iPoint sum N
0Projected point of points
Constructed vector
As the X-axis of the coordinate system, normal to the plane
With vectors
Ride across
×
As the Y axis of the coordinate system;
s13: converting the three-dimensional coordinate of each point in the point set X to the plane coordinate system to obtain a two-dimensional coordinate set of the point set X
;
S14: to be provided with
In (1)
The point is used as the starting point of the vector,
taking the point as a vector end point to obtain a plane vector set
(
j=0,1,2…
k-1), calculating
The included angle alpha j from each vector to the X axis of the local coordinate system and the included angle beta j from the Y axis;
s15: the boundary points are identified from the maximum value θ max among the boundary points θ j.
Preferably: if β j in said S14>Pi/2, then α j = αj + pi, then arranging the alpha j in ascending order to obtain an angle sequence eta j, and calculating an included angle theta j = eta j-1 between adjacent angles of the eta j, wherein
。
Preferably: in the step S15, when the maximum included angle θ max in the adjacent angle sequence θ j exceeds the maximum included angle threshold θ, the point Pi is a boundary point, otherwise, the point Pi is a non-boundary point and the threshold is set
The size of the threshold is determined according to the cloud distribution situation, and the threshold is generally set
Set to pi/2.
Preferably: the boundary point Euclidean distance clustering segmentation is that different boundary features in the boundary point cloud have the characteristic of continuous distance between adjacent points in the same boundary feature, namely, the distance between adjacent points in the same boundary feature is small, and the distance between the closest points of different boundary features is large.
Preferably: the method for partitioning the Euclidean distance clusters of the boundary points comprises the following steps:
s31: a kd tree point cloud structure is established for the boundary point cloud X, so that subsequent point neighborhood searching is facilitated;
s32: creating an empty cluster set C and a point set Q;
s33: for any point
P i Processing the X;
s34: when each point in the boundary point cloud X is subjected to the step S33, a cluster set C is obtained;
s35: deleting fewer points in the cluster set C thann minAnd (4) obtaining a final cluster set C by cloud block point, and completing segmentation.
Preferably: for any point in the S33
P i X, performing the following steps:
s41: handleP i Adding into Q;
s42: for each point
P i Q, executing the following steps:
a. k neighbor search algorithm through boundary point kd treeP i The k neighborhood of (2) is put into the point set;
b. for each one
If, if
Is not in Q, and
and
p j of Euclidean distance rj<
d th Then add Q and remove from X;
s43: and when the Q cannot find new points to be added, putting the Q into the cluster set C, and emptying the Q.
Preferably: the method for extracting the rivet hole boundary in the cloud block of the segmentation point by the ellipse fitting method comprises the following steps:
s51: cloud block with dividing points
c i C least square fitting plane, constructing local plane two-dimensional coordinate system, and blocking point cloud
c i Converting the three-dimensional coordinates of all the points into a constructed local plane two-dimensional coordinate system to obtain two-dimensional coordinates
;
S52: to plane two-dimensional coordinate
Least square fitting the plane ellipse to obtain an ellipse equation A
x 2+Bxy+C
y 2+ Dx + Ey + F =0, center of ellipse
And major and minor axis radii
And
;
s53: and extracting the rivet hole boundary characteristics in the boundary point cloud blocks according to the ellipse fitting Error, the ratio of the major axis to the minor axis, the maximum radius threshold rmax, the minimum radius threshold rmin and the circle center position threshold d.
Preferably: the local plane two-dimensional coordinate system is constructed by any vector on the plane
Normal to a plane, as the X-axis of the coordinate system
And
cross product of (a) as a coordinate system Y-axis, point cloud block
c i Any point in
p 0Projected points on a plane
As the origin of the coordinate system.
The invention has the beneficial effects that:
1. the method has the advantages that the traditional contact type rivet hole measuring method is replaced, the defects of manual marking and manual cutting can be effectively overcome, the measuring efficiency is high, the flexibility is good, compared with other rivet hole special extracting methods based on scattered point clouds, the process is simplified, excessive manual participation in the extracting process can be reduced, and the automation degree is high.
2. The kd-Tree method is adopted to establish the kd-Tree structure of the scattered point cloud, thereby being convenient to find out each point in the point cloudP i K neighborhood point set ofN j (j=0,1,2…k-1)。
3. And if the dc is smaller than a set threshold value, the extraction hole is removed, and the accuracy is high.
Detailed Description
The technical solution of the present patent will be described in further detail with reference to the following embodiments.
Reference will now be made in detail to embodiments of the present patent, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are exemplary only for the purpose of explaining the present patent and are not to be construed as limiting the present patent.
In the description of this patent, it is to be understood that the terms "center," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," "outer," and the like are used in the orientations and positional relationships indicated in the drawings for the convenience of describing the patent and for the simplicity of description, and are not intended to indicate or imply that the referenced devices or elements must have a particular orientation, be constructed and operated in a particular orientation, and are not to be considered limiting of the patent.
In the description of this patent, it is noted that unless otherwise specifically stated or limited, the terms "mounted," "connected," and "disposed" are to be construed broadly and can include, for example, fixedly connected, disposed, detachably connected, disposed, or integrally connected and disposed. The specific meaning of the above terms in this patent may be understood by those of ordinary skill in the art as appropriate.
A round hole feature extraction method facing rivet hole measurement point cloud data is disclosed, as shown in FIGS. 1-4, and comprises the following steps:
s1: extracting point cloud boundary points according to the distribution condition of k neighborhood points of each point in the point cloud;
s2: obtaining point cloud blocks belonging to different boundary characteristics through Euclidean distance clustering segmentation of boundary points;
s3: and extracting the rivet hole boundary in the cloud block of the segmentation point by an ellipse fitting method.
The method for extracting the point cloud boundary points comprises the following steps:
s11: establishing a kd-Tree structure of scattered point cloud by using a kd-Tree method to obtain a point PiAnd its k neighborhood point Nj(j =0,1,2 … k-1) to obtain P by least squares fittingiA local tangent plane to the point;
s12: establishing a plane coordinate system on the tangent plane by P
iTo the tangent plane projection point P
iAs origin of coordinates, P
iPoint sum N
0Projected point of points
Constructed vector
As the X-axis of the coordinate system, normal to the plane
With vectors
Ride across
×
As the Y axis of the coordinate system;
s13: converting the three-dimensional coordinate of each point in the point set X to the plane coordinate system to obtain a two-dimensional coordinate set of the point set X
;
S14: to be provided with
In (1)
The point is used as the starting point of the vector,
taking the point as a vector end point to obtain a plane vector set
(
j=0,1,2…
k-1), calculating
The included angle alpha j from each vector to the X axis of the local coordinate system and the included angle beta j from the Y axis;
s15: the boundary points are identified from the maximum value θ max among the boundary points θ j.
Specifically, if β j in the above-mentioned S14>Pi/2, then alpha j = alpha j + pi, then alpha j is arranged in ascending order to obtain an angle sequence eta j, and an included angle theta j = eta j-1 between adjacent angles of eta j is calculated, wherein
。
Specifically, in S15, when the maximum included angle θ max in the adjacent angle sequence θ j exceeds the maximum included angle threshold θ, the point Pi is a boundary point, otherwise, the point Pi is a non-boundary point and the threshold is set
The size of the threshold is determined according to the cloud distribution situation, and the threshold is generally set
Set to pi/2.
The boundary point Euclidean distance clustering segmentation is that different boundary features in the boundary point cloud have the characteristic of continuous distance between adjacent points in the same boundary feature, namely, the distance between adjacent points in the same boundary feature is small, and the distance between the closest points of different boundary features is large.
Further, the method for euclidean distance cluster segmentation of the boundary points comprises the following steps:
s31: a kd tree point cloud structure is established for the boundary point cloud X, so that subsequent point neighborhood searching is facilitated;
s32: creating an empty cluster set C and a point set Q;
s33: for any point
P i Processing the X;
s34: when each point in the boundary point cloud X is subjected to the step S33, a cluster set C is obtained;
s35: deleting fewer points in the cluster set C thann minAnd (4) obtaining a final cluster set C by cloud block point, and completing segmentation.
Further, the arbitrary point in S33
P i X, performing the following steps:
s41: handleP i Adding into Q;
s42: for each point
P i Q, executing the following steps:
a. k neighbor search algorithm through boundary point kd treeP i The k neighborhood of (2) is put into the point set;
b. for each one
If, if
Is not in Q, and
and
p j of Euclidean distance rj<
d th Then add Q and remove from X;
s43: and when the Q cannot find new points to be added, putting the Q into the cluster set C, and emptying the Q.
Still further, thed th A threshold is partitioned for clustering.
Still further, then minIs the minimum threshold of the number of clustering points.
The method for extracting the rivet hole boundary in the cloud block of the segmentation point by the ellipse fitting method comprises the following steps:
s51: cloud block with dividing points
c i C least square fitting plane, constructing local plane two-dimensional coordinate system, and blocking point cloud
c i Three-dimensional coordinates of all points in the three-dimensional coordinate transformation table are converted into a constructed local plane two-dimensional coordinateUnder the standard system, obtaining two-dimensional coordinates
;
S52: to plane two-dimensional coordinate
Least square fitting the plane ellipse to obtain an ellipse equation A
x 2+Bxy+C
y 2+ Dx + Ey + F =0, center of ellipse
And major and minor axis radii
And
;
s53: and extracting the rivet hole boundary characteristics in the boundary point cloud blocks according to the ellipse fitting Error, the ratio of the major axis to the minor axis, the maximum radius threshold rmax, the minimum radius threshold rmin and the circle center position threshold d.
Further, the local plane two-dimensional coordinate system is constructed by any vector on the plane
Normal to a plane, as the X-axis of the coordinate system
And
cross product of (a) as a coordinate system Y-axis, point cloud block
c i Any point in
p 0Projected points on a plane
As the origin of the coordinate system.
The ellipse equation Ax 2+Bxy+Cy 2Solution of + Dx + Ey + F =0 as follows:
order to
And
then the optimization goal is: min
=
,s.t.
>0, due to
When =0, W has a scaling factor such that all W' = aW also meet the optimization goal, so it is possible to let W
=1, then the optimization objective becomes: min
=
,s.t.
=1, construct lagrange function for equation: l (W, λ) =
-λ(
-1), deriving, order
Is obtained by
-λHW=0→
λ HW, let S =
SW = λ HW, 6 possible solutions W are obtained by solving the generalized inverse matrix, λ is the positive definite matrix since S is>0, therefore can be used
=1 and λ>0 to obtain the final qualified solution
。
Wherein H =
,
>0 is the ellipse fitting parameter constraint 4AC-
>0。
Calculating the center of the ellipse
And major and minor axis radii
And
:
calculating the ratio of the ellipse fitting Error to the major and minor axes:
wherein
F (p) is a set of grid surfaces, and n is a point cloud block ci
Number of points C, if Error>e, e is fitting Error threshold, the cloud block is non-elliptical, i.e. non-rivet hole, if Error is<e, comparing the ratio of the long axis to the short axis; if 1-r<ratio<1-r, wherein r is a long-short axis ratio threshold value, the cloud block roundness of the division point is high, namely the boundary of the rivet hole, and otherwise, the cloud block roundness is the boundary of the non-rivet hole; if the radius of the rivet hole is required, a maximum radius threshold value rmax and a minimum radius threshold value rmin can be set, the mean value of the long axis and the short axis is compared with rmax and rmin to extract the rivet hole meeting the radius requirement, other round holes which are not rivet holes in the point cloud can be eliminated, the spatial distance dc between the theoretical center of the non-rivet round hole and the center of the fitting ellipse of the algorithm is calculated, and if the dc is smaller than the set threshold value, the extracted hole is eliminated.
When the method is used, a kd tree structure of scattered point cloud is established by adopting a kd tree method, so that each point in the point cloud is found outP i K neighborhood point set ofN j (j=0,1,2…k-1), replace the method of traditional contact measurement rivet hole, can effectively overcome the shortcoming of manual marking and manual cutting.
The above description is only for the preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art should be considered to be within the technical scope of the present invention, and the technical solutions and the inventive concepts thereof according to the present invention should be equivalent or changed within the scope of the present invention.