Device and method for measuring three-dimensional vertical line of structured light
Technical Field
The invention belongs to the field of computer vision, and particularly relates to a device and a method for measuring a three-dimensional vertical line of structured light.
Background
The vertical line coordinatometer is a traditional instrument for measuring horizontal displacement and (vertical displacement) of a large engineering structure, is widely used for monitoring horizontal displacement and deflection of a dam and a building, and is important instrument equipment for ensuring safe operation of the dam. In order to achieve the targets of real-time acquisition, accuracy, reliability, online monitoring and quick feedback of the observation data of the plumb line gauge, an automatic measurement mode is required. With the development of sensor technology, an automatic telemetry mode is adopted to replace a traditional manual observation mode, so that the method has become a common important development direction of safety monitoring.
The plumb line coordinatometer can be divided into capacitive type, vortex type, photoelectric type and the like according to the working principle. The traditional capacitance type plumb line coordinatometer can realize measurement of plumb lines in a large range, high sensitivity and high precision, but when the measurement environment is wet and dusty, the dielectric constant between capacitance pole plates is easy to change slowly, so that the measurement result is distorted. The CCD sensor is widely used in the vertical line coordinatometer due to the advantages of small volume, light weight, high integration level, low power consumption, good linearity, large dynamic range, long service life, strong anti-interference capability and the like, and the existing automatic vertical line coordinatometer mostly adopts a displacement measurement technology based on a linear array CCD sensor. The design method of the plumb line coordinatometer based on the CCD prepares the plumb line coordinatometer based on the linear array CCD for observing the deformation of the well wall of the mine. The development method of the novel photoelectric plumb line coordinator develops a wide-range lensless CCD plumb line coordinator. But still has the problems that only two directions of a plane can be measured, a measuring device is repeated, the measuring range is small, the measuring precision is influenced by the quality of parallel light sources, and the like. On the basis, the design method of the three-dimensional vertical line coordinator based on the CCD is characterized in that a disc vertical to the disc is fixed on a vertical reference line in the horizontal direction and used as a vertical reference in the vertical direction, and the three-dimensional vertical line coordinator is designed. In order to expand the measuring range of the plumb line gauge, the development method of the wide-range stepping plumb line gauge adopts a stepping measuring principle, a stepping motor drives a photoelectric probe to realize the laser emission and receiving of planar two-dimensional displacement measurement to detect the position, the driving pulse of the stepping motor is adopted to count, and the lead screw leads are used for calculating the movement distance to give a displacement value. The high-speed high-precision plumb line coordinator adopts a similar thought to develop a high-speed high-precision plumb line coordinator, and the high-speed high-precision plumb line coordinator uses a grating ruler to carry out displacement measurement. The plumb line instrument based on the stepping measurement principle has the advantages of complex structure and high cost because the instrument comprises a motor and a screw rod mechanism.
Disclosure of Invention
Aiming at the problems in the prior art, the invention provides a device and a method for measuring a three-dimensional vertical line of structured light.
The technical scheme of the device is that the device for measuring the three-dimensional vertical line of the structured light comprises a computer, a CCD camera, a line laser transmitter, a vertical line to be measured, a bracket and a small ball;
the CCD camera is connected with the computer;
the line laser transmitter is arranged below the CCD camera, faces the vertical line to be measured and transmits a laser plane in the horizontal direction;
The ball is fixed on the vertical line to be measured, and the vertical line to be measured is suspended in front of the CCD camera through the bracket;
the technical scheme of the method is a structured light three-dimensional perpendicular line measuring method, which comprises the following steps:
The method comprises the steps that 1, a computer calibrates a CCD camera main point, a CCD camera focal length and CCD camera distortion parameters through a Zhengyou camera calibration method to obtain calibrated camera main point, calibrated camera focal length and calibrated camera distortion parameters;
step 2, calibrating the laser plane parameters by a computer through a line structure light calibration method based on a checkerboard to obtain laser plane equation parameters;
The method comprises the steps of vertically placing a checkerboard in front of a CCD camera, collecting a first-posture checkerboard image by a computer through the CCD camera, extracting first-posture image coordinates of checkerboard corner points and first-posture world coordinates under a local checkerboard world coordinate system, calculating first postures of the local checkerboard world coordinate system, calculating first-posture camera coordinates of the checkerboard corner points under the camera coordinate system, and calculating the first-posture camera coordinates of the checkerboard corner points under the camera coordinate system to obtain normal vectors of a first-posture checkerboard plane through a least square fitting method;
Step 4, after the checkerboard is rotated by a certain angle, the computer collects a second posture checkerboard image through the CCD camera, extracts a second posture image coordinate of the corner points of the checkerboard and a second posture world coordinate under a local checkerboard world coordinate system, calculates a second posture of the local checkerboard world coordinate system, calculates a second posture camera coordinate of the corner points of the checkerboard under a camera coordinate system, and calculates the second posture camera coordinate of the corner points of the checkerboard under the camera coordinate system through a least square fitting method to obtain a normal vector of a second posture checkerboard plane;
step 5, carrying out cross multiplication on the normal vector of the first gesture checkerboard plane and the normal vector of the second gesture checkerboard plane to obtain a vertical line direction vector calibration parameter;
Step 6, controlling a CCD camera to acquire a panoramic image by a computer, carrying out distortion correction on the panoramic image by combining distortion parameters of the CCD camera to obtain a distortion corrected image, extracting image coordinates of light spots where a laser plane in the horizontal direction intersects with a vertical line, extracting image coordinates of a center point of a small ball, constructing an analytical equation of the vertical line and a ray equation of projection imaging of the center point of the small ball, and solving to obtain displacement of the vertical line in the directions X, Y, Z
Preferably, the extracting the first pose image coordinates of the checkerboard corner and the first pose world coordinates under the local checkerboard world coordinate system in step 3 specifically includes:
The computer processes the first posture checkerboard image by adopting a checkerboard angular point extraction algorithm, and extracts first posture image coordinates of the checkerboard angular points and first posture world coordinates under a local checkerboard world coordinate system;
Preferably, the calculating the first pose of the local checkerboard world coordinate system in step 3 is specifically:
The computer adopts a PnP algorithm, and calculates the first gesture of the local checkerboard world coordinate system by combining the first gesture image coordinate of the checkerboard corner and the first gesture world coordinate of the checkerboard corner under the local checkerboard world coordinate system;
Preferably, in the step 3, the calculating the first pose camera coordinates of the checkerboard corner under the camera coordinate system specifically includes:
Calculating first pose camera coordinates of the checkerboard corner points under the camera coordinate system through a camera imaging model by combining the calibrated camera main points, the calibrated camera focal length, calibrated camera distortion parameters and the first pose of the local checkerboard world coordinate system;
Preferably, the extracting the second pose image coordinates of the checkerboard angular points and the second pose world coordinates under the local checkerboard world coordinate system in step 4 is specifically as follows:
the computer processes the second posture checkerboard image by adopting a checkerboard angular point extraction algorithm, and extracts second posture image coordinates of the checkerboard angular points and second posture world coordinates under a local checkerboard world coordinate system;
Preferably, the calculating of the second pose of the local checkerboard world coordinate system in step 4 is specifically as follows:
the computer adopts a PnP algorithm, and combines the second pose image coordinates of the checkerboard angular points and the second pose world coordinates of the checkerboard angular points under the local checkerboard world coordinate system to calculate the second pose of the local checkerboard world coordinate system;
preferably, in the step 4, the calculating the second pose camera coordinates of the checkerboard corner under the camera coordinate system specifically includes:
Calculating second pose camera coordinates of the checkerboard corner points under the camera coordinate system through a camera imaging model by combining the calibrated camera main points, the calibrated camera focal length, calibrated camera distortion parameters and the second pose of the local checkerboard world coordinate system;
Preferably, in the step 6, the image coordinates of the light spot where the laser plane in the horizontal direction intersects with the perpendicular line specifically include:
The image after distortion correction is processed, and the image coordinates of the light spots where the laser plane in the horizontal direction intersects with the vertical line are extracted through median filtering, binarization and gray centroid method;
Preferably, the extracting the image coordinates of the center point of the pellet in step 6 specifically includes:
the computer intercepts an image block containing the small sphere from the image after distortion correction through morphological filtering and connected domain analysis, and extracts the image coordinates of the center point of the small sphere from the image block containing the small sphere through Gaussian filtering, canny edge extraction and ellipse fitting;
Preferably, the analytical equation for constructing the perpendicular line in step 6 is specifically:
the computer is combined with the laser plane equation parameters, the coordinates of the light spots are solved through the laser triangulation principle, and an analytic equation of the vertical line is built by combining the vertical line direction vector calibration parameters;
Preferably, the light ray equation for constructing the projection imaging of the center point of the pellet in the step 6 is specifically:
the computer combines the main point of the calibrated camera, the focal length of the calibrated camera and the distortion parameters of the calibrated camera, and constructs a light ray equation of the projection imaging of the center point of the small ball according to the imaging model of the camera;
Preferably, the solving in the step 6 obtains the displacement of the perpendicular in X, Y, Z three directions, specifically:
and solving an analytic equation of the simultaneous vertical line and a light ray equation of the projection imaging of the center point of the small ball to obtain the coordinate of the center point of the small ball, wherein the variable quantity of the coordinate of the center point of the small ball is the displacement of the vertical line in three directions X, Y, Z.
The invention has the advantages that based on the laser triangulation ranging principle of line structured light, the three-dimensional displacement measurement of the vertical line can be realized by adopting a single line structured light source, three sets of light sources and sensors with the same structure are not required to be respectively configured in X, Y, Z directions, the structure is simplified, the stability is improved, and a high-resolution camera and a lens are used, so that the field of view is fully utilized, and the measurement precision and the measurement range can be improved.
Drawings
FIG. 1 is a schematic diagram of a device structure according to an embodiment of the present invention.
FIG. 2 is a flow chart of a method of an embodiment of the present invention.
FIG. 3 is a schematic diagram of a three-dimensional vertical measurement calibration vertical direction vector in accordance with an embodiment of the present invention.
FIG. 4 is a schematic diagram of three-dimensional plumb line measurement of an embodiment of the invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
In particular, the method according to the technical solution of the present invention may be implemented by those skilled in the art using computer software technology to implement an automatic operation flow, and a system apparatus for implementing the method, such as a computer readable storage medium storing a corresponding computer program according to the technical solution of the present invention, and a computer device including the operation of the corresponding computer program, should also fall within the protection scope of the present invention.
FIG. 1 is a schematic diagram of a device structure according to an embodiment of the present invention, wherein the technical scheme of the device according to the embodiment of the present invention is a device for measuring three-dimensional vertical lines of structured light, comprising a computer, a CCD camera, a line laser emitter, a vertical line to be measured, a bracket, and a small ball;
the CCD camera is connected with the computer;
the line laser transmitter is arranged below the CCD camera, faces the vertical line to be measured and transmits a laser plane in the horizontal direction;
The ball is fixed on the vertical line to be measured, and the vertical line to be measured is suspended in front of the CCD camera through the bracket.
The selection of the computer is i7-7700 CPU, 16GB memory and Windows10 operating system;
the CCD camera is selected from JAI GO-5000M-PGE;
The line laser transmitter is selected from the group consisting of permanent-100M-16A 648-50-GLXS;
The vertical line to be measured is selected from a white building string;
The bracket is a laboratory bracket with the height of 50 cm;
The pellet is a white plastic hollow pellet with the diameter of 5 mm.
The following describes a method for measuring three-dimensional plumb line of structured light according to an embodiment of the present invention with reference to fig. 2 to fig. 4, which specifically includes the following steps:
The method comprises the steps that 1, a computer calibrates a CCD camera main point, a CCD camera focal length and CCD camera distortion parameters through a Zhengyou camera calibration method to obtain calibrated camera main point, calibrated camera focal length and calibrated camera distortion parameters;
step 2, calibrating the laser plane parameters by a computer through a line structure light calibration method based on a checkerboard to obtain laser plane equation parameters;
The method comprises the steps of (3) vertically placing a checkerboard in front of a CCD camera, collecting a first posture checkerboard image by a computer through the CCD camera, processing the first posture checkerboard image by the computer through a checkerboard corner extraction algorithm, extracting first posture image coordinates of the checkerboard corner and first posture world coordinates under a local checkerboard world coordinate system, calculating a first posture of the local checkerboard world coordinate system by the computer through a PnP algorithm by combining the first posture image coordinates of the checkerboard corner and the first posture world coordinates of the checkerboard corner under the local checkerboard world coordinate system, calculating a first posture of the local checkerboard world coordinate system by combining a calibrated camera principal point, a calibrated camera focal length, calibrated camera distortion parameters and the first posture of the local checkerboard world coordinate system through a camera imaging model, and calculating the first posture camera coordinates of the checkerboard corner under the camera coordinate system through a least square fitting method to obtain a normal vector of the first posture checkerboard plane;
Step 4, after the checkerboard rotates a certain angle, the computer collects a second posture checkerboard image through the CCD camera, the computer processes the second posture checkerboard image by adopting a checkerboard angular point extraction algorithm, a second posture image coordinate of the checkerboard angular point and a second posture world coordinate under a local checkerboard world coordinate system are extracted, the computer calculates a second posture of the local checkerboard world coordinate system by adopting a PnP algorithm and combining the second posture image coordinate of the checkerboard angular point and the second posture world coordinate of the checkerboard angular point under the local checkerboard world coordinate system;
step 5, carrying out cross multiplication on the normal vector of the first gesture checkerboard plane and the normal vector of the second gesture checkerboard plane to obtain a vertical line direction vector calibration parameter;
The method comprises the steps of 6, controlling a CCD camera to collect a panoramic image by a computer, carrying out distortion correction on the panoramic image by combining distortion parameters of the CCD camera to obtain a distortion corrected image, processing the distortion corrected image, extracting image coordinates of light spots of a laser plane intersecting with a vertical line in the horizontal direction by a median filtering, binarization and gray centroid method, intercepting an image block containing a small ball by the computer through morphological filtering and connected domain analysis on the distortion corrected image, extracting image coordinates of a small ball center point by Gaussian filtering, channel edge extraction and ellipse fitting on the image block containing the small ball, solving the coordinates of the light spots by a laser plane equation parameter by a laser triangulation principle, constructing an analytic equation of the vertical line by combining the vector calibration parameters of the vertical line, constructing a ray equation of the small ball center point projection imaging according to a camera imaging model by combining camera principal point, calibrating camera focal length and calibrated camera distortion parameters, and solving the analytic equation of the small ball center point projection imaging by the computer, wherein the change quantity of the small ball center point coordinate is the displacement in X, Y, Z directions.
The principle of measuring and calibrating the vertical line direction vector by the three-dimensional vertical line in the embodiment of the invention is shown in fig. 3, wherein O-uv is a camera imaging surface, and O c-XcYcZc is a camera coordinate system. Checkerboard plane α 1 is the checkerboard plane in the first pose, and checkerboard plane α 2 is the checkerboard plane in the second pose. P c,i,j is the coordinate of an angle point on the checkerboard plane alpha 1 under the camera coordinate system, wherein the subscript c represents that the coordinate value is based on the camera coordinate system, the subscript i represents that the angle point is positioned on the ith row of the checkerboard, the subscript j represents that the angle point is positioned on the jth column of the checkerboard, the value range of the subscript i is 1-11 according to the used calibration plate size of 11 multiplied by 8, and the value range of the subscript j is 1-8. P w,i,j is the coordinate of the corner point of the ith row and jth column in the local world coordinate system, where the subscript w indicates that the coordinate value is based on the local world coordinate system. p i,j is the image coordinates of the projection points of the checkerboard corner of the ith row and the jth column. n 1 is the normal vector of the checkerboard plane α 1, n 2 is the normal vector of the checkerboard plane α 2, n is a vertical line direction vector calibration parameter, wherein the vertical line is the intersection line of the plane α 1 and the plane α 2, and then the vertical line direction vector can be obtained by the normal vector of the two planes in a cross-multiplying way, namely n=n 1×n2.
The three-dimensional plumb line measurement principle of the embodiment of the invention is shown in fig. 4, wherein O-uv is a camera imaging surface, and O c-XcYcZc is a camera coordinate system. P c is the sphere center point and P is the image point it images. P 1 is the point of light at which the laser plane intersects the vertical, and P 1 is the point of light at which it is imaged. The equation of the simultaneous ray P c P and the equation of the perpendicular line are as follows:
Wherein f x is the calibrated X-direction camera focal length, f y is the calibrated Y-direction camera focal length, u 0 is the calibrated X-direction offset of the main camera point, v 0 is the calibrated Y-direction offset of the main camera point, n x is the X-direction component of the vertical line direction vector calibration parameter n, n y is the Y-direction component of the vertical line direction vector calibration parameter n, n z is the Z-direction component of the vertical line direction vector calibration parameter n, X c is the X-coordinate value of P c in the camera coordinate system, Y c is the Y-coordinate value of P c in the camera coordinate system, and Z c is the Z-coordinate value of P c in the camera coordinate system. And solving the above overdetermined equation set by least square to obtain the coordinate value x c、yc、zc of the ball center point P c.
According to the method, a three-dimensional vertical line measuring system (hereinafter referred to as the system) based on structured light is constructed based on a Windows platform, a vertical line displacement measuring experiment is carried out on a laboratory mobile platform, a high-precision grating ruler and a guide rail are used for controlling the vertical line to move 5mm each time, the measured vertical line displacement is compared with the reading of the grating ruler, the error is calculated, and experimental data are shown in tables 1 and 2:
TABLE 1 vertical X-direction displacement measurement experiment result table (unit: mm)
TABLE 2 vertical Y-direction displacement measurement experiment result table (unit: mm)
The displacement of the vertical line in the Z direction was difficult to control precisely, so2 pellets were hung on the vertical line, the distance between the 2 pellets was measured by the above method, and experimental data are shown in table 3, in comparison with the distance measured by a vernier caliper:
TABLE 3 vertical Z-direction displacement measurement experiment result table (unit: mm)
In summary, aiming at the problems that the conventional plumb line coordinatometer can only measure the displacement of two directions of a plane, has small measuring range, complex instrument structure and the like, the invention selects a proper camera and lens based on the laser triangulation principle to construct a structured light measuring system, and simultaneously fixes a small ball on the plumb line, thereby realizing the simultaneous measurement of the displacement of the plumb line in three directions, and having high precision, large measuring range, high measuring speed, simple structure and high reliability. Experimental results prove that the method provided by the invention can be used for simultaneously measuring the displacement in three directions of the vertical line, and the measurement accuracy meets the requirement.
It should be understood that parts of the specification not specifically set forth herein are all prior art.
Although terms such as computer, CCD camera, line laser emitter, vertical line to be measured, stand, ball, etc. are used more herein, the possibility of using other terms is not excluded. These terms are only used to facilitate a more complete description of the nature of the invention and should be construed as requiring no additional limitations whatsoever.
It should be understood that the foregoing description of the preferred embodiments is not intended to limit the scope of the invention, but rather to limit the scope of the claims, and that those skilled in the art can make substitutions or modifications without departing from the scope of the invention as set forth in the appended claims.