Disclosure of Invention
The invention aims to solve the defects in the prior art, and provides a round hole feature extraction method for rivet hole measurement point cloud data.
In order to achieve the above purpose, the present invention adopts the following technical scheme:
a round hole feature extraction method for 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 the Euclidean distance clustering segmentation of boundary points;
s3: and extracting the rivet hole boundary in the partition point cloud block by an ellipse fitting method.
Preferably: the extraction method of the point cloud boundary points comprises the following steps:
s11: a kd tree structure of scattered point cloud is established by adopting a kd tree method and points P are used i And k neighborhood point N j (j=0, 1,2 … k-1) to get P by least squares fitting i A local tangent plane to the point;
s12: establishing a plane coordinate system on the tangential plane to P i To the tangent plane projection point P i As origin of coordinates, P i Point and N 0 Projection point of pointVectors of constitution->As coordinate system X-axis, plane normal +.>Vector +.>Cross->×/>As a coordinate system Y-axis;
s13: converting the three-dimensional coordinates 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 used forIs->Point is the vector origin, +.>The points are used as vector end points to obtain a plane vector set(j=0,1,2…k-1) calculate->An included angle alpha j from each vector to the X axis of the local coordinate system and an included angle beta j from each vector to the Y axis;
s15: the boundary point is identified from the maximum value θmax among the boundary points θj.
Preferably: if βj in S14>Pi/2, then αj=αj+pi, then arranging αj in ascending order to obtain an angle sequence ηj, and calculating an included angle θj=ηj- ηj-1 between adjacent angles of η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 value epsilon theta, the point Pi is a boundary point, otherwise, the point Pi is a non-boundary point, and the threshold valueThe size of (2) is determined by the viewpoint cloud distribution condition, and the threshold value is generally setSet to pi/2.
Preferably: the Euclidean distance clustering segmentation of the boundary points is characterized in that different boundary features in the boundary point cloud have the characteristic that the distances between adjacent points in the same boundary feature are continuous, namely the distance between the adjacent points in the same boundary feature is smaller, and the distance between nearest points of the different boundary features is larger.
Preferably: the method for partitioning the Euclidean distance clusters of the boundary points comprises the following steps:
s31: establishing a kd tree point cloud structure 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 pointP i X is processed;
s34: after each point in the boundary point cloud X is executed in the step S33, a cluster set C is obtained;
s35: the number of points in the deletion cluster C is less thann min And (5) obtaining a final aggregation set C, and completing segmentation.
Preferably: for any point in S33P i X, the following steps are executed:
s41: handleP i Adding the mixture into Q;
s42: for each pointP i Q, the following steps are executed:
a. finding through k neighbor search algorithm of boundary point kd treeP i Is put into the point set;
b. for each ofIf->Not in Q, and->And (3) withp j Is the Euclidean distance rj of (2)<d th Then add to Q and remove from X;
s43: and when the new point addition cannot be found by the Q, putting the Q into the aggregation set C, and emptying the Q.
Preferably: the method for extracting the rivet hole boundary in the partition point cloud block by the ellipse fitting method comprises the following steps:
s51: cloud block for dividing pointsc i C least square fitting plane, constructing a local plane two-dimensional coordinate system, and forming point cloud blocksc i Converting the three-dimensional coordinates of all points into a constructed local plane two-dimensional coordinate system to obtain two-dimensional coordinates +.>;
S52: two-dimensional coordinates of opposite planeFitting the plane ellipse by least squares to obtain an ellipse equation Ax 2 +Bxy+Cy 2 +dx+ey+f=0, centre of ellipse +.>And major and minor axis radius>And->;
S53: and extracting the boundary characteristics of the rivet hole in the boundary point cloud block according to the ellipse fitting Error, the ratio of the long axis to the short axis, the maximum radius threshold value rmax, the minimum radius threshold value rmin and the circle center position threshold value epsilon d.
Preferably: the construction local plane two-dimensional coordinate system is defined by any vector on a planeAs coordinate system X-axis, normal to the plane +.>And->Is multiplied by Y-axis of a coordinate system, and is a point cloud blockc i Any of the pointsp 0 Projection point on plane->As the origin of the coordinate system.
The beneficial effects of the invention are as follows:
1. the method replaces the traditional contact type rivet hole measuring method, can effectively overcome the defects of manual scribing and manual cutting, has high measuring efficiency and good flexibility, and compared with other scattered point cloud-based rivet hole special extraction methods, has a simplified process, can reduce excessive manual participation in the extraction process, and has high automation degree.
2. A kd tree structure of the scattered point cloud is established by adopting a kd tree method, so that each point in the point cloud can be conveniently found outP i K neighborhood point set of (2)N j (j=0,1,2…k-1)。
3. Other round holes which are not rivet holes may exist in the point cloud, the round holes need to be removed, the space distance dc between the theoretical circle center of the non-rivet round hole and the circle center of the algorithm fitting ellipse is calculated, and if dc is smaller than a set threshold value, the extraction holes are removed, so that the accuracy is high.
Detailed Description
The technical scheme of the patent is further described in detail below with reference to the specific embodiments.
Embodiments of the present patent are described in detail below, examples of which are illustrated in the accompanying drawings, wherein the same or similar reference numerals refer to the same or similar elements or elements having the same or similar functions throughout. The embodiments described below by referring to the drawings are exemplary only for explaining the present patent and are not to be construed as limiting the present patent.
In the description of this patent, it should be understood that the terms "center," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," "outer," and the like indicate orientations or positional relationships based on the orientation or positional relationships shown in the drawings, merely to facilitate describing the patent and simplify the description, and do not indicate or imply that the devices or elements being referred to must have a particular orientation, be configured and operated in a particular orientation, and are therefore not to be construed as limiting the patent.
In the description of this patent, it should be noted that, unless explicitly stated and limited otherwise, the terms "mounted," "connected," and "disposed" are to be construed broadly, and may be fixedly connected, disposed, detachably connected, disposed, or integrally connected, disposed, for example. The specific meaning of the terms in this patent will be understood by those of ordinary skill in the art as the case may be.
A round hole feature extraction method for rivet hole measurement point cloud data is shown in fig. 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 the Euclidean distance clustering segmentation of boundary points;
s3: and extracting the rivet hole boundary in the partition point cloud block by an ellipse fitting method.
The extraction method of the point cloud boundary points comprises the following steps:
s11: a kd tree structure of scattered point cloud is established by adopting a kd tree method and points P are used i And k neighborhood point N j (j=0, 1,2 … k-1) to get P by least squares fitting i A local tangent plane to the point;
s12: establishing a plane coordinate system on the tangential plane to P i To the tangent plane projection point P i As origin of coordinates, P i Point and N 0 Projection point of pointVectors of constitution->As coordinate system X-axis, plane normal +.>Vector +.>Cross->×/>As a coordinate system Y-axis;
s13: converting the three-dimensional coordinates 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 used forIs->Point is the vector origin, +.>The points are used as vector end points to obtain a plane vector set(j=0,1,2…k-1) calculate->An included angle alpha j from each vector to the X axis of the local coordinate system and an included angle beta j from each vector to the Y axis;
s15: the boundary point is identified from the maximum value θmax among the boundary points θj.
Specifically, in S14, if βj>Pi/2, then αj=αj+pi, then arranging αj in ascending order to obtain an angle sequence ηj, and calculating an included angle θj=ηj- ηj-1 between adjacent angles of ηj, wherein。
Specifically, in the step S15, when the maximum included angle θmax in the adjacent angle sequence θj exceeds the maximum included angle threshold value εθ, the point Pi is a boundary point, otherwise the point Pi is a non-boundary point, and the threshold valueThe size of (2) is determined by the viewpoint cloud distribution condition, and the threshold value is generally setSet to pi/2.
The Euclidean distance clustering segmentation of the boundary points is characterized in that different boundary features in the boundary point cloud have the characteristic that the distances between adjacent points in the same boundary feature are continuous, namely the distance between the adjacent points in the same boundary feature is smaller, and the distance between nearest points of the different boundary features is larger.
Further, the method for clustering and segmenting the Euclidean distance of the boundary points comprises the following steps:
s31: establishing a kd tree point cloud structure 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 pointP i X is processed;
s34: after each point in the boundary point cloud X is executed in the step S33, a cluster set C is obtained;
s35: the number of points in the deletion cluster C is less thann min And (5) obtaining a final aggregation set C, and completing segmentation.
Further, in S33, for any pointP i X, the following steps are executed:
s41: handleP i Adding the mixture into Q;
s42: for each pointP i Q, the following steps are executed:
a. finding through k neighbor search algorithm of boundary point kd treeP i Is put into the point set;
b. for each ofIf->Not in Q, and->And (3) withp j Is the Euclidean distance rj of (2)<d th Then add to Q and remove from X;
s43: and when the new point addition cannot be found by the Q, putting the Q into the aggregation set C, and emptying the Q.
Still further, thed th A threshold is partitioned for the cluster.
Still further, then min A threshold value for the minimum number of cluster points.
The method for extracting the rivet hole boundary in the partition point cloud block by the ellipse fitting method comprises the following steps:
s51: cloud block for dividing pointsc i C least square fitting plane, constructing a local plane two-dimensional coordinate system, and forming point cloud blocksc i Converting the three-dimensional coordinates of all points into a constructed local plane two-dimensional coordinate system to obtain two-dimensional coordinates +.>;
S52: two-dimensional coordinates of opposite planeFitting the plane ellipse by least squares to obtain an ellipse equation Ax 2 +Bxy+Cy 2 +dx+ey+f=0, centre of ellipse +.>And major and minor axis radius>And->;
S53: and extracting the boundary characteristics of the rivet hole in the boundary point cloud block according to the ellipse fitting Error, the ratio of the long axis to the short axis, the maximum radius threshold value rmax, the minimum radius threshold value rmin and the circle center position threshold value epsilon d.
Further, the construction local plane two-dimensional coordinate system is defined by any vector on a planeAs coordinate system X-axis, normal to the plane +.>And->Is multiplied by Y-axis of a coordinate system, and is a point cloud blockc i Any of the pointsp 0 Projection point on plane->As the origin of the coordinate system.
The ellipse equation Ax 2 +Bxy+Cy 2 Solution of +dx+ey+f=0 as follows:
order theAnd->The optimization objective is: min->=,s.t./>>0 due to->When=0, W has a scaling factor such that all W' =aw also meet the optimization objective, thus making it possible to let/>=1, then the optimization objective becomes: min->=/>,s.t./>=1, p-structured lagrangian function: l (W, λ) = =>-λ(/>-1) deriving, letting->Can get->-λHW=0→Let s= =>Sw=λhw, and 6 possible solutions W are obtained by solving the generalized inverse matrix, λ being the positive definite matrix>0, thus can use +.>=1 and λ>0 to obtain the final qualified solution。
Wherein H=,/>>0 is the ellipse fitting parameter constraint 4AC->>0。
Calculating the center of an ellipseAnd major and minor axis radius>And->:
Calculating the ratio of the ellipse fitting Error to the long and short axes:
wherein the method comprises the steps ofF (p) is the set of grid planes, n is the point cloud ci ∈>The number of points C, if Error>Epsilon e, epsilon e is the fitting Error threshold, if the cloud block of the dividing point is non-elliptical, namely a non-rivet hole, if Error<εe, the ratio of longer minor axes; if 1- εr<ratio<1-epsilon r, wherein epsilon r is a threshold value of the ratio of the long shaft to the short shaft, the roundness of the cloud block at the dividing point is high, namely the boundary of the rivet hole, and otherwise, the boundary of the non-rivet hole; if the size of the rivet hole radius is required, a maximum radius threshold value rmax and a minimum radius can be setAnd (3) a threshold value rmin, namely comparing the average value of the long axis and the short axis with rmax and rmin to extract rivet holes meeting radius requirements, possibly other round holes which are not rivet holes in the point cloud, eliminating the rivet holes, calculating the space distance dc between the theoretical circle center of the non-rivet round hole and the fitted ellipse circle center of the algorithm, and eliminating the extracted holes if the dc is smaller than a set threshold value.
When the embodiment is used, a kd tree structure of the 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 of (2)N j (j=0,1,2…k-1) replaces the traditional contact type rivet hole measuring method, and can effectively overcome the defects of manual scribing and manual cutting.
The foregoing is only a preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art, who is within the scope of the present invention, should make equivalent substitutions or modifications according to the technical scheme of the present invention and the inventive concept thereof, and should be covered by the scope of the present invention.