Disclosure of Invention
Aiming at the defects in the prior art, the invention provides a point cloud tolerance self-adaptive building perpendicularity detection method, which comprises the steps of scanning the outer contour of a building through a three-dimensional laser scanning technology, splicing the building into a whole by using a point cloud registration technology, and then slicing the building by using horizontal sections with different heights; the data processing flow is selected in a self-adaptive mode by judging the shape of the contour, then the shape of the whole or partial outer contour of the corresponding building is estimated and fitted through robust fitting, and different strategies are selected to estimate the gravity center of the building through the obtained outer contour; then, fitting the gravity center points with different heights into a straight line or a curve through least square estimation or machine learning; the method overcomes the limitation of the traditional building verticality detection method, and is more accurate in calculation of building verticality and less affected by scenes.
The invention adopts the technical scheme that a point cloud tolerance self-adaptive building perpendicularity detection method is adopted;
in a first implementation, the method comprises the following steps:
collecting point cloud data of a building;
preprocessing the point cloud data to obtain a preprocessed building point cloud;
self-adaptive judgment is carried out on the point cloud outer contour type of the pre-processed building, and the building type is determined;
carrying out layered slicing on the preprocessed building point cloud;
carrying out plane projection on the sliced point cloud of the building structure to obtain the outer contour of the building structure;
combining the types of the building, and performing robust fitting estimation on the outer contour of the building according to different modes;
calculating gravity center coordinates of the building at different heights according to the robust fitting estimation result;
and calculating the verticality of the building according to the gravity center coordinates of different heights of the building.
In combination with the first implementable manner, in a second implementable manner,
the preprocessing comprises registration, segmentation, filtering and labeling.
In combination with the first implementable manner, in a third implementable manner, the self-adaptive judgment is performed on the point cloud outer contour type of the preprocessed building structure, and the self-adaptive judgment is specifically performed according to the following steps:
s31, reading all the preprocessed point clouds of the building structures into a computer memory according to a preset format, and distinguishing different building structures by using mark numbers;
s32, searching and inquiring the maximum value and the minimum value of the height value of each building point cloud, calculating the slice height, selecting a point with the slice height as a first characteristic quantity, projecting the point to an XOY plane, setting the pixel size, and converting the point cloud into a plane binary image;
and S33, sequentially carrying out Hough transformation circle detection and straight line detection on the plane binary image, and carrying out self-adaptive judgment according to a detection result.
With reference to the third implementable manner, in a fourth implementable manner, the types of buildings include prismatic buildings, incomplete prismatic buildings, cylindrical buildings.
With reference to the fourth implementable mode, in a fifth implementable mode, for a prismatic building structure, barycentric coordinates of different heights are calculated according to the following steps:
s41, carrying out layered slicing on the preprocessed building point cloud;
s42, carrying out plane projection on the sliced point cloud of the building structure to obtain the outer contour of the building structure;
S431-A, carrying out robust fitting estimation on the outer contour of the prismatic building to obtain a straight line point set;
S432-A, extracting main edge lines of the prismatic building according to the straight line point set;
S433-A, calculating coordinates of each corner point of the prism according to the main edge line;
S434-A, calculating the gravity center coordinates of the prismatic building according to the corner point coordinates;
and S435-A, repeating the calculation for multiple times according to the steps S41-S434-A until the maximum height is reached, and obtaining barycentric coordinates of different section heights of the prismatic building.
In combination with the fourth implementable manner, in the sixth implementable manner, for an incomplete prismatic building structure, barycentric coordinates of different heights are calculated as follows:
s41, carrying out layered slicing on the preprocessed building point cloud;
s42, carrying out plane projection on the sliced point cloud of the building structure to obtain the outer contour of the building structure;
S431-B, carrying out robust fitting estimation on the outer contour of the incomplete prismatic building to obtain a straight line point set;
S432-B, extracting two mutually vertical main edge lines of the incomplete prismatic building according to the straight line point set;
S433-B, traversing each point in two mutually perpendicular main edges of the incomplete prismatic building structure, and extracting angular points according to curvature changes of the points;
S434-B, calculating the center point coordinates of two mutually perpendicular main edges according to the corner point projection;
S435-B, acquiring barycentric coordinates of the incomplete prismatic building structure according to the midpoint coordinates;
and S436-B, repeating the calculation for multiple times according to the steps S41-S435-B until the maximum height is reached, and obtaining barycentric coordinates of different section heights of the incomplete prismatic building.
With reference to the fourth implementable manner, in a seventh implementable manner, for a cylindrical building, the barycentric coordinates of different heights are calculated as follows:
s41, carrying out layered slicing on the preprocessed building point cloud;
s42, carrying out plane projection on the sliced point cloud of the building structure to obtain the outer contour of the building structure;
S431-C, performing robust fitting estimation on the outer contour of the cylindrical building to obtain a fitting circle center, and obtaining barycentric coordinates of the cylindrical building;
and S432-C, repeating the calculation for multiple times according to the steps S41-S432-C until the maximum height is reached, and obtaining barycentric coordinates of the cylindrical building with different section heights.
In combination with the first implementable manner, in an eighth implementable manner, the verticality of the building is calculated according to the coordinates of the center of gravity of the building at different heights, specifically according to the following steps:
fitting a straight line or a curve to the coordinate data of the gravity center point of the building under different heights according to least square estimation or machine learning;
and calculating the verticality of the building through a straight line or a curve.
According to the technical scheme, the beneficial technical effects of the invention are as follows:
the method is suitable for the verticality detection of regular prismatic and cylindrical building structures, irregular prismatic and cylindrical building structures without obvious angle characteristics and unequal upper and lower widths, is also suitable for a columnar body which can only collect point clouds on two mutually perpendicular surfaces under limited field conditions, and has higher universality compared with the existing measurement technical method.
The shape of the outer contour of the building structure is estimated by adopting robust fitting, the main contour line of the contour can be accurately identified, the influences of non-main contour lines and measurement gross errors are reduced, the workload of manual point cloud filtering is reduced, and the working efficiency and the reliability of results can be greatly improved.
Calculating the verticality by adopting a method of segmenting slices and fitting to calculate the gravity center according to the building structure, and considering the whole building structure; and meanwhile, the influence of rough difference points caused by construction irregularity and errors is considered.
Detailed Description
Embodiments of the present invention will be described in detail below with reference to the accompanying drawings. The following examples are only for illustrating the technical solutions of the present invention more clearly, and therefore are only examples, and the protection scope of the present invention is not limited thereby.
It is to be noted that, unless otherwise specified, technical or scientific terms used herein shall have the ordinary meaning as understood by those skilled in the art to which the present invention belongs.
Examples
The method for detecting the perpendicularity of the building according to the technical scheme is suitable for prismatic buildings, incomplete prismatic buildings and cylindrical buildings. As shown in fig. 1, the method specifically comprises the following steps:
and S1, collecting point cloud data of the building.
S11, when scanning the building, the selection of the three-dimensional laser scanner is not limited, and in a specific embodiment, the three-dimensional laser scanner with a circular level and horizontal tilt compensation is preferably selected. The method comprises the steps of carrying out horizontal and vertical axis system error calibration on a three-dimensional laser scanner before scanning, and ensuring that the error in distance measurement is not more than 2mm @100m and the point location error is not more than 3mm @100m so as to obtain an accurate point cloud data acquisition effect.
S12, the erection position of the three-dimensional laser scanner is not limited, and in a specific implementation mode, a relative high position with wide view and stable ground around the building to be tested is preferably selected, and the horizontal distance between the building to be tested and the building to be tested is not less than one time of the height of the building to be tested. During scanning, the number of the measuring stations is not limited, in a specific implementation mode, preferably, the number of the measuring stations is not less than 3, so that complete three-dimensional point cloud of a building to be measured is obtained, and meanwhile, 2 targets are placed at positions where different measuring stations look through and serve as common points for registration. If a plurality of measuring stations are not convenient to set due to the influence of factors such as environmental conditions (close to the wall, close to the water) and the like, the complete point cloud of 2 mutually non-parallel main surfaces of the building to be measured should be obtained. If deformation monitoring is carried out, absolute coordinates of a building to be detected are needed, reference points are arranged around an area to be detected, the reference points are uniformly distributed, the number of the reference points is not less than 4, the coordinates can be obtained by adopting a total station lead measurement method, and a target is placed at the reference points.
S13, when the scanning operation is performed, the three-dimensional laser scanner is strictly leveled and the scanning density is set. The scanning density is not limited, and in a specific embodiment, the scanning dot pitch is preferably selected to be less than or equal to 3 mm. In addition to scanning the building to be tested, the common parts between the different stations and the targets should also be scanned for registration. During scanning, the laser beam incident angle is less than or equal to 45 ° with respect to the target plane.
And S2, preprocessing the point cloud data, wherein the preprocessing comprises registration, segmentation, filtering and labeling, and obtaining the preprocessed building point cloud.
The scanned point cloud data is registered using computer point cloud data processing software. Firstly, preliminarily registering two point clouds by using a common target point, and then accurately registering the common part point clouds to obtain a complete building point cloud. In particular embodiments, the overall registration error is guaranteed to be less than or equal to 3 mm. If absolute coordinates are needed for deformation monitoring, the point cloud after registration needs to be converted into an absolute coordinate system through coordinates of a known reference point. If a plurality of building structures are scanned simultaneously, preferably registering a single building structure, then registering a plurality of point cloud blocks together to form a complete point cloud, completing coordinate conversion, and carrying out slice inspection on the complete point cloud to ensure that the width of the outline point cloud is less than or equal to 3mm, otherwise, carrying out registration again.
After the registration operation is completed, the point cloud of each building to be detected is firstly segmented from the surrounding environment, and then the main part point cloud of the building to be detected is segmented.
And carrying out outlier filtering processing on the subdivided isolated points and environmental noise of the point cloud of the main body part to be constructed to obtain the denoised complete point cloud data of the building.
Marking each processed point cloud of the building to be detected, and combining all the point clouds to form a file only containing a plurality of point clouds of building main bodies.
And S3, carrying out self-adaptive judgment on the preprocessed point cloud outer contour type of the building, and determining the building type.
S31, reading all the preprocessed point clouds of the building structures into a computer memory in a certain format (txt, las, pts and the like), and distinguishing different building structures by marking numbers.
S32, searching and inquiring the maximum value h of the Z value (height value) of each building point cloud
max And a minimum value h
min Calculating the slice height
And selecting points with the slice height as the first characteristic quantity to project to an XOY plane, setting the pixel size, and converting the point cloud into a plane binary image. In a specific embodiment, the first characteristic amount is h
0 At ± 7.5mm (i.e. a slice thickness of 1.5cm), the pixel size is set to 3mm, where the pixel value at the point cloud is 1.
S33, carrying out Hough transformation circle detection on the planar binary image because the building structure can be prismatic or cylindrical; if the circle cannot be detected, the straight line detection is continued, and if the number of the straight lines is detected to be larger than or equal to the second characteristic quantity and the distance between the approximate parallel lines is larger than the third characteristic quantity, the prism result is complete, and the building is a prism building. And detecting that the number of straight lines is less than the second characteristic quantity or the distance between the approximate parallel lines is less than or equal to the third characteristic quantity, indicating that the prism is incomplete and the building is an incomplete prism building. If a circle is detected, the building is a cylindrical building. In a specific embodiment, the second characteristic amount is set to 4, and the third characteristic amount is set to 0.2 m.
S4, carrying out layered slicing on the preprocessed building point cloud; carrying out plane projection on the sliced point cloud of the building structure to obtain the outer contour of the building structure; and combining the types of the building, performing robust fitting estimation on the outer contour of the building according to different modes, and calculating barycentric coordinates of the building at different heights according to robust fitting estimation results.
S41, slicing the preprocessed point cloud of the building structure in layers
Searching and inquiring the maximum value h of the Z value (height value) of each building point cloud max And a minimum value h min A loop is established in steps, slicing at height h. The slice height is not limited, and in a specific embodiment, for each slice height h, a point with a height h ± 7.5mm (i.e., a slice thickness of 1.5cm) is selected as a step size for cyclic layered slicing.
And S42, carrying out plane projection on the sliced point cloud of the building structure to obtain the outer contour of the building structure.
And projecting the building point cloud of each slice to a plane with Z being h to obtain a two-dimensional plane point cloud data set P, wherein the two-dimensional plane point cloud data set P is the outer contour of the building, and Z is a height value. Generally, a building cannot be a regular prism or a cylinder, the outer contour line of the building may have a little concave-convex or no obvious angle characteristic, the point cloud of the outer contour line has a certain width due to measurement errors, surface unevenness and the like, and the straight line fitting by the least square method is inevitably influenced by the gross errors, so that the robust fitting estimation is needed.
And S43, combining the types of the building, performing robust fitting estimation on the outer contour of the building according to different modes, and calculating barycentric coordinates of the building at different heights according to robust fitting estimation results.
According to the type of building determined in step S3, the building can be classified into prismatic building, incomplete prismatic building, cylindrical building. The following description will be made on the methods for estimating the contour robust fit and calculating the barycentric coordinates of different heights of the three structures
1. Prismatic building
And S431-A, carrying out robust fitting estimation on the outer contour of the prismatic building to obtain a straight line point set.
Randomly selecting S points in the two-dimensional plane point cloud data set P as inner points of an outer contour model of a building at a certain height, fitting a straight line, calculating errors of the rest points and the outer contour model of the building at the height, judging whether the points are added into the point set S according to the errors, counting the number n of the inner points, fitting straight line parameters suitable for the point set S by using a least square method, and storing. In a specific embodiment, the selected number of s is greater than or equal to 2; and when the error is less than 6mm, the point is regarded as an inner point and is added into the point set S. In a specific embodiment, the outer contour model for a prismatic building is a prismatic model.
And (4) reselecting the points S, repeating the operation of the step, updating the linear point set S and the linear parameters if the number n of the points is larger than that of the points, and iterating for multiple times until the linear parameters are converged. In a specific embodiment, the number of iterations is preferably 10000, and when the number of iterations reaches 10000, the best result can be basically obtained, so that the influence of the rough point on the straight line fitting can be greatly reduced through robust fitting estimation.
And S432-A, extracting main edge lines of the prismatic building according to the straight line point set.
And removing the linear point set S estimated by robust fitting from the two-dimensional plane point cloud data set P. This is done so as not to affect the fit of the other major edges. And continuing to fit the remaining two-dimensional plane point clouds according to the step S43 until all side lines of the building are obtained. If the outer contour edge lines of the building are concave-convex due to design, decoration and the like, a plurality of straight lines are obtained by fitting one surface, main edge lines need to be searched, and redundant edge lines are eliminated. And classifying the straight lines with similar slopes into one class for all the straight lines obtained by fitting, calculating and sequencing the distance values between two end points of each straight line, wherein the distance values are ranked as the first two straight lines, namely the two main edge lines of the building.
And S433-A, calculating coordinates of each corner point of the prism according to the main edge line.
And (4) carrying out pairwise intersection calculation on all main lines of the building according to the sequence to obtain coordinates of each intersection point, wherein each intersection point coordinate is the coordinate of each corner point of the prism.
And S434-A, calculating barycentric coordinates of the prismatic building according to the corner point coordinates.
And according to the coordinates of each corner point, calculating the coordinates of the gravity center point of the prism by using a polygon gravity center accurate calculation formula, wherein the calculation formula is as follows:
in the above formula, n represents the number of intersection points, x represents the abscissa, and y represents the ordinate; x is the number of n+1 =x 1 ,y n+1 =y 1 。
S435-A, repeating the calculation for a plurality of times according to the step S41, the step S42 and the steps A-S43-1 to A-S43-4 until the maximum height h is reached max Thus, barycentric coordinates of different section heights of the prismatic building are obtained.
2. Incomplete prismatic building
And S431-B, carrying out robust fitting estimation on the outer contour of the incomplete prismatic building to obtain a straight line point set.
Randomly selecting S points in the two-dimensional plane point cloud data set P as inner points of an outer contour model of a building at a certain height, fitting a straight line, calculating errors of the rest points and the outer contour model of the building at the height, judging whether the points are added into the point set S according to the errors, counting the number n of the inner points, fitting straight line parameters suitable for the point set S by using a least square method, and storing. In a specific embodiment, the selected number of s is greater than or equal to 2; and when the error is less than 6mm, the point is regarded as an inner point and is added into the point set S. In a specific embodiment, the outer contour model for an incomplete prismatic building is a prismatic model.
And (4) reselecting the points S, repeating the operation of the step, updating the linear point set S and the linear parameters if the number n of the points is larger than that of the points, and iterating for multiple times until the linear parameters are converged. In a specific embodiment, the number of iterations is preferably 10000, and when the number of iterations reaches 10000, the best result can be basically obtained, so that the influence of the rough point on the straight line fitting can be greatly reduced through robust fitting estimation.
And S432-B, extracting two mutually vertical main edge lines of the incomplete prismatic building according to the straight line point set.
For an incomplete prismatic building, all edges of the building cannot be obtained by fitting, so in a specific embodiment, the outer contour of the incomplete prismatic building can be characterized by extracting two mutually perpendicular main edges. Specifically, the linear point set S estimated by robust fitting is removed from the two-dimensional plane point cloud data set P, and a plurality of straight lines are obtained by fitting the remaining two-dimensional plane point clouds. And judging whether the two straight lines are vertical or not according to whether the product of the slopes of all the straight lines obtained by fitting is-1 or not, and indicating that the two straight lines are two main edges which are vertical to each other if the product of the slopes is-1.
And S433-B, traversing each point in two mutually perpendicular main edges of the incomplete prismatic building structure, and extracting a corner point according to the curvature change of the points.
And traversing each point in the outer contour of the incomplete prism building structure, searching points which are smaller than or equal to the radius threshold value in the neighborhood range of the points, calculating the curvature of the points, and extracting angular points according to the curvature change. In a specific embodiment, the radius threshold R is 0.003 m.
And S434-B, calculating the coordinates of the middle points of the two main edges which are perpendicular to each other according to the projection of the corner points.
And projecting each corner point to the nearest main edge line, taking the two corner points which are farthest away on each main edge line as two end points of the main edge line, and calculating the coordinates of the middle points of the two main edge lines which are perpendicular to each other according to the two end points, wherein the number of the coordinates of the middle points is two.
And S435-B, acquiring barycentric coordinates of the incomplete prismatic building according to the midpoint coordinates.
And extending the two middle points along coordinate axes to obtain an intersection point, wherein the intersection point is the barycentric coordinate of the prism, namely the barycentric coordinate of the incomplete prism-shaped building structure.
S436-B, repeating the calculation for multiple times according to the steps S41, S42 and S431-B to S435-B until the maximum height h is reached max So far, barycentric coordinates of different section heights of the incomplete prismatic building are obtained.
3. Cylindrical building
And S431-C, performing robust fitting estimation on the outer contour of the cylindrical building to obtain a fitting circle center, wherein the coordinate of the fitting circle center is the barycentric coordinate of the cylindrical building.
Randomly selecting S points in the two-dimensional plane point cloud data set P as inner points of an outer contour model of a building at a certain height for fitting, calculating errors of the rest points and the outer contour model of the building at the height, judging whether the inner points are added into the point set S according to the errors, counting the number n of the inner points, fitting parameters suitable for the point set S by using a least square method, and storing the parameters. In a specific embodiment, the selected number of s is greater than or equal to 2; and when the error is less than 6mm, the point is regarded as an inner point and is added into the point set S. In a specific embodiment, the outer contour model for a cylindrical building is a circular model.
And (5) reselecting the points S, repeating the operation of the step, if the number n of the internal points is larger than that of the previous internal points, updating the point set S and the parameters, and iterating for multiple times until the parameters are converged. In a specific embodiment, the number of iterations is preferably 10000, and when the number of iterations reaches 10000, the best result can be basically obtained, so that the influence of the rough error point on the fitting can be greatly reduced through the robust fitting estimation.
Through the robust fitting estimation in the step, a fitting circle center can be obtained, and the coordinate of the fitting circle center is the barycentric coordinate of the cylindrical building.
S432-C, repeating the calculation according to the steps S41, S42 and S432-C for a plurality of times until the maximum height h is reached max The barycentric coordinates of the cylindrical building at different cross-sectional heights are obtained.
And S5, calculating the verticality of the building according to the gravity center coordinates of different heights of the building.
The perpendicularity is defined as the ratio of the horizontal offset of the same position to the height difference under different heights, so that the horizontal offset of the building under different heights can be calculated through a straight line or a curve, and the perpendicularity of the building is obtained. In a specific embodiment, fitting a straight line or a curve to the coordinate data of the gravity center point of the building at different heights according to least square estimation or machine learning, wherein the straight line or the curve represents the inclination condition of the building; the method for calculating the verticality of the building through a straight line or a curve is not limited, and is performed in any way that can be realized by the prior art, such as: and calculating the horizontal offset of the building under different heights through a straight line or a curve, wherein the ratio of the horizontal offset to the height difference is the perpendicularity of the building.
Through the technical scheme of this implementation, carry out automated processing according to building profile shape self-adaptation, not only be applicable to regular prism shape, cylindrical building, also be applicable to the straightness detection that hangs down of irregular prism shape, cylindrical and upper and lower unequal width building that does not have obvious angle characteristic, be applicable to the column body that can only gather two mutually perpendicular face point clouds to the site conditions restriction simultaneously, compare current measurement technique method, the universality is higher.
The shape of the outer contour of the building structure is estimated by adopting robust fitting, the main contour line of the contour can be accurately identified, the influences of non-main contour lines and measurement gross errors are reduced, the workload of manual point cloud filtering is reduced, and the working efficiency and the reliability of results can be greatly improved.
Calculating the verticality by adopting a method of segmenting slices and fitting to calculate the gravity center according to the building structure, and considering the whole building structure; and meanwhile, the influence of rough difference points caused by construction irregularity and errors is considered.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; such modifications and substitutions do not depart from the spirit and scope of the present invention, and they should be construed as being included in the following claims and description.