Disclosure of Invention
The invention discloses a binocular three-dimensional vision fusion fire detection device for an outdoor transformer, and solves the problems that how to find temperature abnormity and locate the spatial position of an abnormal area by using a vision method in an outdoor complex environment aiming at the irregular surface of the transformer. The invention fuses the heat radiation image of the transformer with the high-sensitivity visible light video image outdoors, and makes the monitoring information more comprehensive and clear while judging the position of the fire source of the transformer through three-dimensional recovery and reconstruction, thereby realizing early recognition and early warning of the fire hazard of the outdoor transformer and finding the fire source in time to avoid the occurrence and expansion of accidents.
In order to realize early identification and early warning of fire hazard of the outdoor transformer, the key of the fire detection system is to find temperature abnormality and locate the spatial position of an abnormal area by taking a body, an oil conservator, a sleeve lifting seat and a radiator of the oil immersed transformer as objects under an outdoor complex environment aiming at the irregular surface of the transformer. The technical scheme adopted by the invention is as follows: a binocular three-dimensional vision-based fire detection method for an outdoor oil-immersed transformer comprises the following steps:
step S1, establishing a model: according to the imaging effect of the thermal infrared imager, taking the thermal infrared imager geometric imaging model as a pinhole camera model, and establishing the pinhole camera model;
step S2, internal reference calibration: cutting the square blocks of the white grids on the basis of the black and white grid calibration plate, and adhering the cut square blocks at the black grids through heat insulation foam adhesive to completely cover the black grids to obtain a grid calibration plate; attaching a special checkerboard calibration plate to the surface of a heat source by adopting an external transmission infrared radiation method, wherein the heat insulation capacity of processed grids and unprocessed grids in the checkerboard calibration plate is different, so that the surface temperature is different, and checkerboard grids are obviously displayed in an infrared image; collecting infrared images of a plurality of calibration plates at different angles, and then calibrating by adopting a camera calibration tool provided by OpenCV;
step S3, collection of characteristic reference point coordinates: the intersection center of the ladder stand transverse rod and the vertical rod is used as a characteristic reference point to calibrate the external parameters of the thermal infrared imager;
s4, calculating the pose of the camera by adopting an EPnP algorithm and the pose estimation of 3D-3D based on ICP: firstly, estimating the pose of a camera by using an EPnP algorithm, and then constructing a problem of minimized reprojection error to adjust an estimated value; after the pose of the characteristic reference point under the camera coordinate system is obtained, ICP solution is carried out by adopting a linear algebra mode,
step S5, registration of infrared image and visible light image: acquiring depth information by using a depth camera, and then indirectly obtaining depth information corresponding to the infrared image by using a matching relation between the infrared image and the depth camera image;
step S6, extracting the abnormal high temperature region and the target point: and after the three-dimensional space point corresponding to the infrared image pixel point is recovered, if an abnormal high-temperature point is monitored, extracting the space position of the abnormal high-temperature point.
Further preferably, the calibration step of step S2 is as follows: initializing, and distributing a storage space of space coordinates and pixel coordinates for the corner points; reading a calibration plate image and extracting angular points; judging whether the angular points are successfully extracted, if not, directly judging whether all the calibration images are read; if so, calculating sub-pixel coordinates of the corner points, drawing the corner points, then storing the coordinates of the corner points, and then judging whether all the calibration images are read; and if all the calibration images are not read, returning to the step of reading one calibration plate image and extracting the corner points, and if all the calibration images are read, calibrating the infrared thermal imager and outputting the result.
More preferably, in step S4, a plurality of control points are selected by a principal component analysis method using a characteristic reference point whose coordinates are known in a world coordinate system, and the characteristic reference point is expressed in a weighted form of the plurality of control points; the same representation is carried out under a camera coordinate system, and the weight distribution corresponding to the feature reference points is the same as that under a world coordinate system; and then calculating the position of each virtual point under a camera coordinate system according to the obtained weight distribution, the internal parameters of the thermal infrared imager and the coordinates of the two-dimensional points in the image, and further obtaining the coordinates of the reference point under the camera coordinate system.
Further preferably, in step S6, the spatial region in which the transformer is located is divided into a plurality of voxel arrays by using three-dimensional voxels having a predetermined size, and abnormal high temperature points exceeding a threshold value in each voxel are counted to determine whether or not the region is an abnormal high temperature region.
Preferably, in step S6, first, a rectangular parallelepiped box is used to envelop the transformer, and then the rectangular parallelepiped is divided by the small grid voxels with side length of l to obtain a voxel array; after obtaining the voxel array, the specific steps of abnormal region division and target point determination are as follows:
(1) for any point piCalculating the voxel grid of the point, and recording the voxel grid of the point as SjThe members of the voxel grid object have all spatial points, all high-temperature abnormal spatial points, the highest temperature and the regional target points contained in the voxel grid object.
(2) For any point piIf its temperature is greater than the set threshold value TsIt is added to the abnormal spatial point member of its corresponding voxel grid.
(3) For any voxel grid SjIf the number of the abnormal points is larger than the set threshold value N, the area is judged to be an abnormal area, the target point of the area is the centroid of all the abnormal points, and the highest temperature of the area is the temperature of the highest temperature space point.
The invention has the beneficial effects that: the method changes the traditional fire detection direct contact transformer surface detection method of the existing transformer, overcomes the defects that the traditional contact type fire detector has low response speed, single response threshold value, weak electromagnetic interference resistance, easy interference from external environment, incapability of accurately judging the position of a fire source, influence on operation, maintenance and overhaul of the transformer and the like, solves the problem that the single-waveband infrared fire detection method has large errors due to the interference of outdoor sunlight, humidity and wind speed, adopts a heating and light-emitting device to design a chessboard calibration device for calibrating infrared images, improves the calibration accuracy, can accurately judge the position of the fire source, and has important significance for detecting and early warning the fire danger sign of the transformer in the outdoor environment.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings.
Referring to fig. 1, a binocular three-dimensional vision-based fire detection method for an outdoor oil-immersed transformer comprises the following steps,
step S1, establishing a model;
the thermal infrared imager geometric imaging model can project external three-dimensional points to an internal imaging plane of the thermal infrared imager, so that internal parameters of the thermal infrared imager are formed, and the form of the internal parameters of the thermal infrared imager depends on the selection of the thermal infrared imager geometric imaging model. And according to the imaging effect of the thermal infrared imager, taking the thermal infrared imager geometric imaging model as a pinhole camera model, establishing the pinhole camera model, and then calibrating the internal parameters according to the pinhole camera model. In the pinhole camera model, the camera imaging is simplified to pinhole imaging, but for convenience of processing, the imaging plane is often moved to the front of the camera in mathematical processing.
The coordinates of the point P in the world coordinate system and the camera coordinate system are respectively Pw=[Xw,Yw,Zw]TAnd Pc= [Xc,Yc,Zc]TThen the coordinate P in the world coordinate systemwTo the coordinates P in the camera coordinate systemcThe conversion formula of (c) is as follows:
Pc=RPw+t (1)
wherein R is a rotation matrix of third-order orthogonal units, and t is a translation vector.
Considering the central projection of point P onto a plane, the projection plane is at a position where z ═ f (f is the focal length, in mm), as shown in fig. 2. p ═ x, y]TIs a projection plane coordinate, Pc=[Xc,Yc,Zc]TIs a camera coordinate systemThe following coordinates, from the similarity relationship, can be obtained:
the above formula is rewritten in matrix form with homogeneous coordinates:
let the pixel coordinate of point P be [ mu, v]T,[μ0,ν0]TThe pixel coordinate of the camera center (optical center), a and b are the scale expansion factors from the image plane to the pixel plane in the directions of the x axis and the y axis, respectively, and γ is the non-perpendicular factor of the μ axis and the v axis under the pixel coordinate system, then the relationship between the pixel coordinate and the image coordinate is:
by substituting the formulae (3) and (4) into the formula (1), it is possible to obtain:
let α ═ af and β ═ bf simplify the above equation:
in formula (6): k is an internal reference matrix of the camera; d is the external parameter matrix of the camera.
Step S2, calibrating internal parameters;
and cutting 28 mm square blocks of white squares on the basis of the black and white chessboard grid calibration plate, and adhering the cut 28 mm square blocks at the black squares through heat insulation foam glue to completely cover the black squares to obtain the special chessboard grid calibration plate of the embodiment. The special chessboard is attached to the surface of a heat source by adopting a method of adding transmission infrared radiation, and the temperature of the surface is different due to the different heat insulating capability of the treated grids and the untreated grids in the special chessboard, so that the chessboard grids can be obviously displayed in an infrared image. And acquiring infrared images of the calibration plate at a plurality of different angles, and then calibrating by adopting a camera calibration tool provided by OpenCV. As shown in fig. 3, the calibration steps are as follows: initializing, and distributing a storage space of space coordinates and pixel coordinates for the corner points; reading a calibration plate image and extracting angular points; judging whether the angular points are successfully extracted, if not, directly judging whether all the calibration images are read; if so, calculating sub-pixel coordinates of the corner points, drawing the corner points, then storing the coordinates of the corner points, and then judging whether all the calibration images are read; and if all the calibration images are not read, returning to the step of reading one calibration plate image and extracting the corner points, and if all the calibration images are read, calibrating the infrared thermal imager and outputting the result.
Marking the world homogeneous coordinate of the mth point on the calibration plate as Pm=[X,Y,Z,1]TAnd the homogeneous coordinate of the pixel of the corresponding two-dimensional camera plane is pm=[μ,ν,1]TThen, according to the pinhole camera model, there are:
spm=K[R t]Pm (7)
wherein s is a non-zero scale factor, K is an internal reference matrix of the camera, R is a rotation matrix of a third-order orthogonal unit, and t is a translation vector.
Regarding the checkerboard plane as a plane where z is 0 in the world coordinate system, we can obtain:
[r1 r2 r3 t]is a matrix [ R t]The column vector expansion form of (1);
in formula (8): h is a homography matrix, which is expanded according to column vectors and comprises the following components:
H=[h1 h2 h3]=λK[r1 r2 t] (9)
[h1 h2 h3]is a vector [ H]The column vector expansion form of (1);
in formula (9): λ is an arbitrary scaling factor. R is known from the orthogonal property of the rotation matrix R of the third-order orthogonal unit1And r2Being orthogonal, we can get the constraint equation of the internal reference:
for ease of calculation, the following matrix definition is made:
It can be seen that B is a symmetric matrix with 6 active elements, defining a vector B of active elementsmComprises the following steps:
bm=[B11 B12 B22 B13 B23 B33]T (12)
it can be deduced that:
in formula (13):
[hi1,hi2,hi3]、[hj1,hj2,hj3]is a vector [ H]In the form of an expansion of the row vector of,
the constraint equation can be re-expressed as:
assuming that the acquired images with n different angles are acquired, all the internal reference constraint equations are written into a large linear equation set:
Vbm=0 (16)
in formula (16): v is a 2n × 6 matrix. When n is not less than 3, b can be obtainedmThe unique solution of (a) is solved by using a Singular Value Decomposition (SVD) method, and then the internal reference matrix K can be obtained.
Step S3, collecting the coordinates of the characteristic reference points;
the external reference calibration of the thermal infrared imager is to solve the pose of the thermal infrared imager in a world coordinate system, and is related to the selection of the world coordinate system and the pose of the thermal infrared imager. The thermal infrared imager cannot obtain depth information, 3-dimensional space coordinates and corresponding 2-dimensional image coordinates of more than three reference points need to be known when the pose of the camera needs to be solved, and then a Perspectral-n-Point (PnP) problem is constructed and solved. The ladder stand grids on the transformer are in regular shapes, the space positions are easy to measure, and the ladder stand grids are obvious in infrared images, so that the intersection centers of the transverse rods and the vertical rods of the ladder stand are used as characteristic reference points, and 10 ladder stand grids are used for calibrating external parameters of the thermal infrared imager.
S4, calculating the pose of the camera by adopting an EPnP algorithm and the pose estimation of 3D-3D based on ICP;
firstly, estimating the pose of a camera by using an Efficient perceptual-n-point (EPnP) method, and then constructing a problem of minimizing a reprojection error to adjust an estimated value.
The core idea of the EPnP algorithm is to represent the three-dimensional coordinates of the characteristic reference points by linear combination of a plurality of virtual control points. And selecting 4 control points by a principal component analysis method by using a characteristic reference point with known coordinates in a world coordinate system, and expressing the characteristic reference point by using a weighted form of the 4 control points. The same is also expressed in the camera coordinate system, and the weight assignment corresponding to the feature reference point is the same as in the world coordinate system. And then calculating the position of each virtual point under a camera coordinate system according to the obtained weight distribution, the internal parameters of the thermal infrared imager and the coordinates of the two-dimensional points in the image, and further obtaining the coordinates of the reference point under the camera coordinate system.
The coordinates of the characteristic reference point in the world coordinate system and the camera coordinate system are respectively set as
And
the coordinates of the 4 control points in the world coordinate system and the camera coordinate system are respectively
And
the feature reference points can be expressed as follows:
in the formula, alphaijFor each index point 4 weighting coefficients aij(j ═ 1,2,3,4) and the sum is 1.
Assuming that the external parameter of the thermal infrared imager is [ R t ], there are:
since the characteristic reference points can be expressed as a weighted sum form of the control points, it is further possible to obtain:
by substituting formula (18) for formula (19), it is possible to obtain:
according to the formula, for a certain space point, the weight corresponding to each control point is the same under the two coordinate systems, and the external parameters of the thermal imager can be further obtained after the coordinates of the control points under the camera coordinate system are solved.
Let ui(i=1,…,n)=[μi,νi]TIs a reference point Pi(i 1, …, n) on the image plane (z 1 xy plane), then the projection model of the camera can obtain:
two constraint equations are available:
in the above formula except for the coordinates of the control point
Unknown, the others known, combining the constraint equations corresponding to all points to obtain a linear equation:
Mcx=0 (23)
in formula (23): m represents a matrix of 2n x 12,
and x is in the right null space of M, then:
in formula (24): n is MTDimension of M nuclear space, viIs the right singular vector of M, the corresponding singular value is 0. Beta is aiIs a pending coefficient, so for the ith control point:
in formula (25):
is a feature vector v
kThe ith 3 × 1 sub-vector of (1).
To obtain
The coordinates of the reference point can then be calculated according to equation (20)
And then solving the pose of the camera by using an ICP (inductively coupled plasma) method.
After the pose of the feature reference point in the camera coordinate system is obtained, the pose solution problem is transformed into a problem of pose estimation according to a set of matched 3D points, and ICP can be generally used for solution. The ICP solution has two different linear and nonlinear modes, under the condition that the 3D point pair matching is known, the nonlinear solution mode can also obtain an analytic solution, and iterative optimization is not needed, so the ICP solution is carried out by adopting a linear algebra mode, and the steps are as follows:
(1) computing parameters under world coordinate systemCentroid of examination point
And a centroid coordinate matrix a:
(2) calculating the center of mass of a reference point in a camera coordinate system
And removing the centroid coordinate matrix B:
(3) defining matrix H ═ BTA, and calculating SVD decomposition of H: h ═ U ∑ VT。
(4) Calculating a rotation matrix R in the pose of the thermal infrared imager: r ═ UVT(ii) a If R | < u ><0, then R [2 ]:]=-R[2,:]。
(5) calculating a translation vector t in the pose:
step S5, registration of infrared image and visible light image:
after the internal reference and the external reference of the camera are known, the depth information is obtained by adopting the depth camera, and then the depth information corresponding to the infrared image is indirectly obtained by utilizing the matching relation between the infrared image and the depth camera image.
Suppose that the spatial coordinates of a certain point P in the infrared camera coordinate system are P [ X, Y, Z ]]TThe pixel point of the infrared image is p1The pixel point in the visible light image is p2If so, the pixel positions of the two pixel points are:
in formula (29): k is1Is an internal reference of the thermal infrared imager; k2Is an internal reference of a visible light camera; and R and t are relative pose relations between the thermal imager coordinate system and the visible light coordinate system. The above formula can be rewritten using homogeneous coordinates as:
let x1=K1 -1p1,x2=K2 -1The formula (30) can be substituted with:
x2=Rx1+t (31)
two sides of the above formula are simultaneously multiplied by t and then multiplied by t
It is possible to obtain:
re-substituting p1And p2The method comprises the following steps:
let E be t R, which is an intrinsic matrix, and equation (33) above is referred to as antipodal constraint. It can be seen that K1And K2It is known that if E is solved, the pixel coordinate of a point in one image corresponding to the E in the other image can be solved according to the pixel coordinate of the point in the other image, and thus registration between images is achieved.
Step S6, extracting the abnormal high temperature region and the target point: after the three-dimensional space point corresponding to the infrared image pixel point is recovered, if an abnormal high-temperature point is monitored, the space position of the abnormal high-temperature point can be extracted.
In fact, if the transformer has temperature anomaly, the high-temperature region extracted from the infrared image is in an irregular shape with high probability, so that it is difficult to perform effective uniform segmentation of the three-dimensional space of the anomaly region based on an image method. Therefore, the invention divides the space region where the transformer is located by using three-dimensional voxels with certain sizes to form a voxel array, then counts abnormal high-temperature points exceeding a threshold value in each voxel, and further judges whether the region is an abnormal high-temperature region. The early recognition and early warning of the fire hazard of the outdoor transformer are realized, and the fire source is found in time to avoid the occurrence and expansion of accidents.
Firstly, a cuboid box is used for enveloping a ratio transformer, and then a small square voxel with the side length of l is used for dividing the cuboid to obtain a voxel array. After obtaining the voxel array, the specific steps of abnormal region division and target point determination are as follows:
(1) for any point piCalculating the voxel grid of the point, and recording the voxel grid of the point as SjThe members of the voxel grid object have all spatial points, all high-temperature abnormal spatial points, the highest temperature and the regional target points contained in the voxel grid object.
(2) For any point piIf its temperature is greater than a set threshold value TsIt is added to the abnormal spatial point member of its corresponding voxel grid.
(3) For any voxel grid SjIf the number of the abnormal points is larger than the set threshold value N, the area is judged to be an abnormal area, the target point of the area is the centroid of all the abnormal points, and the highest temperature of the area is the temperature of the highest temperature space point.
Example 1
Step S1, establishing a model: taking the thermal infrared imager geometric imaging model as a pinhole camera model, establishing the pinhole camera model, and then calibrating internal parameters according to the pinhole camera model;
step S2, calibrating internal reference
When the visible light camera is calibrated, the calibration work can be completed by using a printed black and white checkerboard. However, for an infrared thermal imaging camera, there is no thermal radiation difference between grids of a common black and white chessboard grid calibration plate, so there is no grid texture information in an infrared image, and the infrared thermal imaging camera cannot be used as a calibration plate of a thermal infrared imager. Therefore, this embodiment improves the zhang's scaling method and produces a scale plate with a clear and distinct grid texture in the infrared image.
The length and width of each chequer board is 28 mm; the special checkerboard calibration plate of the embodiment is obtained by cutting 28 mm square blocks of white squares on the basis of the black and white checkerboard calibration plate, and adhering the cut 28 mm square blocks at the black squares through heat insulation foam glue to completely cover the black squares. The special chessboard is attached to the surface of a heat source by adopting a method of adding transmission infrared radiation, and the temperature of the surface is different due to the different heat insulating capability of the treated grids and the untreated grids in the special chessboard, so that the chessboard grids can be obviously displayed in an infrared image.
Acquiring infrared images of a plurality of calibration plates at different angles, and then calibrating by using a camera calibration tool provided by OpenCV (open computer vision library), wherein the calibration steps are as follows with reference to FIG. 3: initializing, and distributing a storage space of space coordinates and pixel coordinates for the corner points; reading a calibration plate image and extracting angular points; judging whether the angular points are successfully extracted, if not, directly judging whether all the calibration images are read; if so, calculating sub-pixel coordinates of the corner points, drawing the corner points, then storing the coordinates of the corner points, and then judging whether all the calibration images are read; and if all the calibration images are not read, returning to the step of reading one calibration plate image and extracting the corner points, and if all the calibration images are read, calibrating the infrared thermal imager and outputting the result.
The result of the internal reference matrix obtained by calibration is shown as formula (34), and the corresponding back projection error is 0.456.
2 calibration of external parameters of thermal infrared imager
Step S3, collection of characteristic reference point coordinates: in order to carry out external reference calibration, pixel coordinates in an image and three-dimensional coordinates in space of the intersection center of the ladder climbing cross rod and the vertical rod need to be extracted. Firstly, extracting pixel coordinates, selecting 2D points near a reference point by using a mouse, then searching for near corner points and performing sub-pixelation, taking the centroid coordinates of all the corner points as the pixel coordinates of an actual characteristic reference point, and obtaining the pixel coordinates of 10 reference points as follows: (705, 510), (706, 573), (707, 632), (707, 695), (707, 757), (763, 511), (762, 570), (763, 631), (763, 693), (763, 755).
The feature reference point space coordinates are obtained by actual measurement and are (2824, 2484, 2638), (2799, 2484, 2240), (2774, 2484, 1842), (2749, 2484, 1444), (2724, 2484, 1046), (2824, 2133, 2638), (2799, 2133, 2240), (2774, 2133, 1842), (2749, 2133, 1444), (2724, 2133, 1046), respectively, in millimeters (mm).
S4, estimating and calculating the pose of the camera by adopting an EPnP algorithm based on the pose of 3D-3D of ICP;
utilizing a solvePnP tool in OpenCV and adopting an EPnP method to calibrate external parameters, obtaining the external parameters of the camera as follows:
tcw=[3900.93 3497.12 6020.03]T
the coordinates of the origin of the camera in the world coordinate system are:
twc=-Rcw -1·tcw=[-5589.39 2853.46 4230.19]T
step S5, registration of infrared image and visible light image
Because the difference between the infrared image and the visible light image is large, the gray scale and the texture features are inconsistent, and the effect of automatically extracting the feature reference points and registering is poor. Therefore, the characteristic reference points are extracted and matched in a manual mode, and the angular points which are obvious are extracted from the infrared image and the visible light image obtained by the depth camera and are used as the characteristic reference points and are matched.
In formula (33), let
The mapping conversion between image pixels can be completed by solving F. Next, F is solved by the eight-point method.
Considering a pair of matching points, the homogeneous pixel coordinate is p1=[u1,v1,1]T,p2=[u2,v2,1]TAccording to the epipolar constraint, the following components are provided:
according to the epipolar constraint of all the matching points, the following linear equation system can be obtained:
the linear equation system comprises the epipolar constraint relation of 8 pairs of matched feature points, and the solution f of the equation is in the null space of the coefficient matrix. Substituting the pixel coordinates of each characteristic reference point to obtain an F matrix as follows:
and after F is solved, the relative pose relations R and t between the thermal infrared imager and the depth camera can be solved according to the SVD decomposition method. Due to the fact that
Therefore, for any point p in the infrared image
1All can find out the corresponding point p in the visible light image
2According to point p
2The coordinates of the corresponding space point under the depth camera can be obtained according to the depth d, and the coordinates of the point under a world coordinate system are recovered according to the relative pose between the thermal infrared imager and the depth camera and the external parameters of the thermal infrared imager.
Step S6, extracting abnormal high temperature area and target point
Firstly, a cuboid box is used for enveloping a ratio transformer, and then a small square voxel with the side length of l is used for dividing the cuboid to obtain a voxel array. After obtaining the voxel array, the specific steps of abnormal region division and target point determination are as follows:
(1) for any point piCalculating the voxel grid of the point, and recording the voxel grid of the point as SjThe members of the voxel grid object have all spatial points, all high-temperature abnormal spatial points, the highest temperature and the regional target points contained in the voxel grid object.
(2) For any point piIf its temperature is greater than the set threshold value TsIt is added to the abnormal spatial point member of its corresponding voxel grid.
(3) For any voxel grid SjIf the number of the abnormal points is larger than the set threshold value N, the area is judged to be an abnormal area, the target point of the area is the centroid of all the abnormal points, and the highest temperature of the area is the temperature of the highest temperature space point.
And observing abnormal areas, realizing early identification and early warning of fire hazards of the outdoor transformer, and finding out a fire source in time to avoid accidents and expansion.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents and improvements made within the spirit and principle of the present invention are intended to be included within the scope of the present invention.