Disclosure of Invention
Aiming at the defects of the existing method, the invention provides the tree height measuring method which is large in measuring range, small in data calculation amount, convenient to carry and capable of being intelligently realized. The invention relates to a method for collecting a hemisphere image by using an intelligent terminal provided with a fisheye lens, establishing a tree height measurement model based on the calibration and correction principle of the fisheye lens and calculating the tree height.
1. Establishing fish-eye camera imaging model
The imaging system model of the fisheye camera is shown in fig. 1. The model establishes a world coordinate system (X)W,YW,ZW) -a fisheye lens coordinate system (X, Y, Z), a camera coordinate system (X ', Y ', Z ') and an image coordinate system (u, v). An imaging process is determined in which a target point in world coordinates is projected to an image point in image coordinates.
Let a given point P in space have world coordinates (x, y, z), OO ' is the optical axis imaged by the fisheye camera, r is the distance from point P to the optical axis, point P ' is the point P imaged, and r ' is the distance from point P ' to the image center O '. According to the theorem of equidistant projection, the method comprises the following steps of,
r'=fω (4)
wherein f is the object focal length of the optical system, ω is the incident angle of the P point relative to the optical axis,
since the fisheye lens has barrel distortion and radial distortion, in order to ensure the uniformity of image plane illumination, a distortion coefficient lambda is introduced, and then the expression (4) is modified to
r′=λfω (6)
The point P ' projected to the camera plane during imaging has coordinates (x ', y ') and the center point O ' of the camera plane has coordinates (x '0,y′0) The components of the distortion coefficient λ in the x 'direction and the y' direction are λxAnd λyThe distance from point P ' to point O ' is r ', then there is,
where θ is the azimuth of point P, and also the azimuth of point P' in the camera coordinate system (see fig. 1),
let the center point O' in the image coordinate system be the coordinate (u)0,v0) The coordinate of the P 'point which projects the P' point in the camera coordinate system to the image coordinate system at equal intervals is (u, v), the conversion formula from the camera coordinate to the image coordinate is as follows,
let kx=λxmxf,ky=λymyf, combined vertical type (5), (6), (7) and (8) to obtain
Wherein k isxAnd kyThe distortion coefficient is called as a model distortion coefficient, an equidistant projection model of the distortion coefficient is introduced into the fisheye camera by the formula (9), and a transformation relation between world coordinates and image coordinates is established. The parameters to be determined by the model are the optical centers (u) of the images0,v0) Distortion coefficient kxAnd kyAnd the z value of point P in world coordinates, as can be seen from figure 1,
z=h+l (10)
wherein l is the virtual imaging distance of the fisheye lens; h is the distance between the top tangent plane of the fisheye lens and the projection point of the point P in the z direction. After the model parameters are determined, the world coordinates can be obtained by knowing the coordinates of the image points.
According to the isometric projection theorem, when a distortion coefficient k is introducedxAnd kyThe component r 'of the distance r' from the projected point P 'to the central point O' of the image in the directions of the x-axis and the y-axisxAnd r ″)yAnd the incident angle omega of the point P in the calibration plate relative to the optical axis is satisfied
When neglecting l, the distance between the top tangent plane of the fish head of the glasses and the plane of the calibration plate is h, so that
Where r is the distance from point P to the optical axis.
Calibration projection model As shown in FIG. 3, the pixel coordinate of the center point O' of the fisheye image in the image plane is (u)0,v0) If the projected point P' of a point P in the calibration plate in the image plane has coordinates of (u, v)0) Then r ″ ═ r ″x=|u-u0If the projected point P' of a point P in the calibration plate in the image plane is in coordinates of (u)0V), then r ″ ═ r ″y=|v-v0The calculation formula for obtaining the distortion coefficient by the joint type (11) and (12) is
Wherein the pixel coordinate of the center point O' of the image is (u)0,v0) H is the distance from the intelligent terminal to the calibration board, the pixel coordinate of the angular point P is (u, v), and r is the distance from the point P to the optical axis.
2. Measuring method and procedure
The method comprises the steps of adopting a measuring device consisting of an intelligent terminal, a fisheye lens matched with the intelligent terminal and a laser range finder, determining a distortion coefficient by utilizing a black-white checkerboard calibration plate and the measuring device, selecting the highest point and the lowest point of a tree to be measured on a screen of the intelligent terminal, and calculating through a measuring program to obtain the tree height. Wherein: the fisheye lens and the laser range finder are fixed on the intelligent terminal through the clamp. The intelligent terminal is provided with a touch screen, a gyroscope and a Bluetooth module, a camera on the intelligent terminal is provided with a cross center reference line, and the intelligent terminal can be an intelligent tool such as a mobile phone or a tablet computer. Laser range finder passes through bluetooth communication with intelligent terminal, and laser range finder can be the laser range finder finished product that has bluetooth function, also can adopt industry laser rangefinder sensor module to install bluetooth module additional and realize the function. The black and white checkerboard is square, the side length is 1 meter, and the size of each grid is 50mm x 50 mm; the intelligent terminal solidifies the measuring operation program.
The measuring method comprises the following steps:
1) shooting a black and white chessboard pattern calibration board photo by using an intelligent terminal: the calibration plate is fixed perpendicular to the ground, shooting is guaranteed to be conducted by the aid of the intelligent terminal gyroscope, the camera is perpendicular to the ground, the distance between the camera and the calibration plate is preferably 1-2 m, the accurate distance value h is measured by the laser range finder, the center point of the cross center reference line of the camera is aligned to any angular point of any square of the calibration plate during shooting, and the point is the original point of the calibration plate.
2) Importing the photos to the MATLAB program of the computer system, centering the imagesEstablishing an image coordinate system by taking the point as an original point O' of the image coordinate system, respectively selecting 10 calibration plate small grid angular points along the directions of horizontal and vertical coordinate axes by taking a pixel as a unit, knowing the pixel coordinate, and determining a distortion coefficient k of a fisheye lens matched with an intelligent terminal camera through calculationxAnd kyDistortion coefficient kxAnd kyIs a function of the pixel coordinates P (u, v) of the corner points of the calibration plate, i.e.:
wherein the pixel coordinate of the center point O' of the image is (u)0,v0) H is the distance from the intelligent terminal to the calibration board and is measured by a laser range finder; the pixel coordinates of the angular point P are (u, v), r is the distance from the inner angular point of the calibration plate to the origin of the calibration plate, and the unit is millimeter; substituting 10 angular point data into the average value calculated by formula (1) to be used as kxAnd kyThe final value of (c). Will kxAnd kyAnd substituting the data into the solidified measuring program of the intelligent terminal.
3) Measuring the tree height: the method comprises the steps of starting a measurement program of the intelligent terminal to measure, enabling the intelligent terminal gyroscope to be perpendicular to the ground, transmitting the measured tree distance H to be measured to the intelligent terminal through Bluetooth by the laser range finder, selecting the highest point B and the lowest point A of the measured tree on a touch screen of the intelligent terminal, and calculating through the measurement program to obtain the tree height H.
And constructing a tree height measuring and calculating system model by taking a fisheye camera equidistant projection model with introduced distortion coefficients as a theoretical basis. The whole measuring system consists of an intelligent terminal with a fish-eye lens and a range finder. A schematic diagram of which is shown in fig. 2.
The coordinates of the hemispherical image point A 'and the hemispherical image point B' are known to be (u) respectivelyA′,vA′) And (u)B′,vB′) The unit is pixel, and the coordinates of the point A and the point B in the world coordinate system are determined.
According to the equation (9), the corresponding relationship between the image coordinate and the x coordinate in the world coordinate system is,
since in practical measurements typically h is greater than 1000mm and l is 8mm-16mm, then with l < < h, equation (7) is simplified to z ═ h. Combined vertical type (9), (11) are obtained
The coordinates of the point A and the point B in the world coordinate system are respectively (x)A,yAH) and (x)B,yBH), the calculation formula is:
wherein (u, v) are pixel coordinates of the point A and the point B in an image coordinate system, the step 3) is used for selecting on the display screen of the intelligent terminal, H is the distance of the tree to be measured by the laser range finder, the tree height H is obtained by calculation according to the distance between the two points in the space,
Detailed Description
The specific implementation mode of the invention is illustrated by taking a group of data of field shooting experiments of experimental forest farms of northeast forestry university as an example.
The experimental equipment adopts an iPhone7 apple mobile phone with a fisheye lens, a black and white chessboard grid calibration board, a laser range finder (a Bluetooth module is additionally arranged on a laser range finding industrial sensor module), an ultrasonic range finder (Vertex III & Transponder T3) and a total station (southern NTS-362). The experimental scheme is as follows: the data measured by the method and the data measured by the ultrasonic distance meter are respectively compared with the true value by taking the total station instrument 5-time measurement mean value as the true value, so as to verify the accuracy of the method.
Shooting a black and white chessboard pattern calibration board photo by using an intelligent terminal: the size of each grid of the black and white checkerboard calibration board is 50mm x 50mm, the intelligent terminal gyroscope is utilized to enable the terminal to be perpendicular to the ground, the center of a cross reference line of the camera is aligned to any angular point of any grid of the calibration board during shooting, the angular point is used as an original point of calibration, a world coordinate system is established by taking an intersection point O of an optical axis of the fisheye camera and a bottom plane of the fisheye camera as a central point, and the laser range finder measures an accurate distance value h by taking millimeters as a unit. The image capturing distances were 541mm, 631mm, 766mm, 842mm, and 942mm, respectively.
Importing the photos into an MATLAB program of a computer system, establishing an image coordinate system, taking pixels as units, taking the central point position of the photos as an original point O' of the image coordinate system, respectively selecting pixel coordinates P of 10 small grid corner points of a calibration board along the horizontal and vertical directions of the original point, wherein the size of a hemispherical image is 3024 pixels by 3024 pixels, taking 12 image points for each of five images, obtaining 60 corner point coordinates, and determining a distortion coefficient k suitable for the intelligent terminal and a fisheye lens matched with the intelligent terminal through calculation
xAnd k
y,k
xAnd k
yRespectively take the average value of
And
will k
xAnd k
yAnd substituting the data into the solidified measuring program of the intelligent terminal.
Measuring the tree height: the method comprises the steps of starting a measurement program of an intelligent terminal to measure, enabling the terminal to be perpendicular to the ground by using an intelligent terminal gyroscope, selecting the highest point B and the lowest point A of a tree to be measured on a screen of the intelligent terminal, transmitting the distance H between a mobile phone and the tree to be measured to the intelligent terminal through Bluetooth by using a laser range finder, and calculating by the measurement program to obtain the tree height H.
The numbers of the collected hemisphere images are respectively 1, 2 and 3 in field measurement, the shooting distances h are respectively 8080mm, 8380mm and 8980mm, the numbers of trees to be calculated are respectively I-VI, the shooting distances are selected according to the characteristic that the total station and the ultrasonic distance meter have the highest precision when the height of a measured object is equal to the measuring distance, and the average value of 5 times of measurement of the total station is used as a true value. The measured tree heights of the ultrasonic range finder and the measured tree heights of the measuring tree proposed herein were compared under the same conditions as the shooting points and the measuring points, and the comparison data are shown in table 1.
TABLE 1 real ground stumpage estimation
Compared with the traditional ultrasonic height measurement method, the method for measuring the tree height has higher precision and more stable measurement result.
The invention combines the fisheye camera calibration technology, the close-range photogrammetry technology and the machine vision technology, and provides a stumpage measurement method based on fisheye images, the method has wide measurement range, the single collected stumpage information amount is large, the tree height measurement of a row of trees can be realized in a hemisphere image, and the measurement workload is effectively reduced; the cost is low, the equipment is portable, the operation is simple, and the measurement can be finished by a single person.