The present invention belongs to the field of image processing and computer vision, and relates to a multispectral camera dynamic stereo calibration algorithm based on saliency features.
Infrared is an electromagnetic wave with a wavelength between microwave and visible light, and its wavelength is longer than that of red light. Substances higher than absolute zero (−273.15° C.) can generate infrared rays. Infrared images are widely used in different fields such as military and national defense, resource exploration, weather forecasting, environmental monitoring, medical diagnosis and treatment and marine research due to the capability of observation through fog and rain. The infrared can be used to shoot scenes through mist and smoke, and can also be used for infrared photography at night. An infrared camera has the advantage of imaging in extreme scenes (low light, rain, snow and dense fog), and has the disadvantages of low resolution and blurred image details. In contrast, a visible light camera has the advantages of high resolution and clear image details, but cannot be used for imaging in the extreme scenes. Therefore, the combination of the infrared camera and the visible light camera has great practical significance.
Stereo vision is an important topic in the field of computer vision. The purpose is to reconstruct the 3D geometric information of the scenes. Binocular stereo vision is an important field of stereo vision. In the binocular stereo vision, left and right camera lenses are used to simulate two eyes. Depth images are calculated by calculating the difference between binocular images. The binocular stereo vision has the advantages of high efficiency, high accuracy, simple system structure and low cost. Because the binocular stereo vision needs to match the same point on the left and right image capture points, the focal length and image capture center of the two camera lenses of the camera, as well as a positional relationship between the left and right camera lenses shall be obtained. To obtain the above data, the camera needs to be calibrated. The acquisition of the positional relationship between the visible light camera and the infrared camera is called joint calibration.
In the calibration process, two camera lens parameters and relative position parameters of the camera are obtained, but these parameters are not stable. When temperature and humidity are changed, the internal parameters of the camera lenses are also changed. In addition, due to accidental camera collision, the positional relationship between the two camera lenses may be changed. Therefore, when the camera is used, internal and external parameters must be modified, which is self-calibration. When the internal parameters of the camera are known, the positional relationship between the infrared lens and the visible light lens is corrected by extracting the features of an infrared image and the features of a visible light image respectively, that is, the joint self-calibration of the infrared camera and the visible light camera.
Because the imaging of the infrared camera is different from that of the visible light camera, features with cross-modal robustness shall be found, and the saliency of the image is found as one of the features. The influence of cross-modal imaging differences can be overcome by detecting the saliency of the infrared image and the visible light image and extracting the matching feature points on the saliency images, thereby realizing a joint self-calibration function.
The present invention aims to solve the change of a positional relationship between an infrared camera and a visible light camera due to factors such as temperature, humidity and vibration. Firstly, the saliency of an infrared image and a visible light image is detected, and matching feature points of an infrared saliency image and a visible light saliency image are extracted to correct an original calibration result.
A multispectral camera dynamic stereo calibration algorithm based on saliency features comprises the following steps:
Step 1: Original image correction: conducting de-distortion and binocular correction on an original image according to internal parameters and original external parameters of the infrared camera and the visible light camera.
Step 2: Detecting the saliency of the infrared image and the visible light image respectively based on a histogram contrast method.
Step 3: Extracting feature points on the infrared image, the visible light image and the saliency images thereof.
Step 4: Matching the feature points extracted in the previous step.
Step 5: Judging a feature point coverage area: dividing the image into m*n grids; if the feature points cover all the grids, executing a next step; otherwise continuing to shoot the image and repeating step 1 to step 4.
Step 6: Correcting the calibration result: using image coordinates of all the feature points to calculate the positional relationship between the two cameras after correction; and then superimposing with the original external parameters.
The step 1 specifically comprises the following steps:
1-1) Calculating the coordinates in a normal coordinate system corresponding to each original image point Pi.
A pixel coordinate system takes the upper left corner of the image as an origin, and x-axis and y-axis of the pixel coordinate system are parallel to x-axis and y-axis of an image coordinate system, respectively. The unit of the pixel coordinate system is the pixel. The pixel is a basic and indivisible unit of image display. The normal coordinate system takes the optical center of the camera as the origin of the image coordinate system and scales the distance from the optical center to an image plane to 1. A relationship between pixel coordinates and normal coordinates is as follows:
wherein
indicates the pixel coordinate of the image;
indicates an internal parameter matrix of the camera; fx and fy respectively indicate the focal distances of the image in x direction and y direction (the unit is the pixel); (cx, cy) indicates the principal point position of the camera; and
is a coordinate in the normal coordinate system. The normal coordinate system corresponding to the pixel points can be calculated, i.e.,
X=K−1u
The normal coordinate system of each original image point Pi is:
Xi=Kiui
1-2) Removing image distortion: calculating the normal coordinate of an original image point after de-distortion.
Due to the limitation of a lens production process, a lens under actual conditions has some distortion phenomena, causing nonlinear distortion. The nonlinear distortion can be roughly classified into radial distortion and tangential distortion.
The radial distortion of the image is a position deviation of the image pixel points with the distortion center as the center point along the radial direction, thereby causing the distortion of the picture formed in the image. The radial distortion is roughly described as follows:
xd=x(1+k1r2+k2r4+k3r6)
yd=y(1+k1r2+k2r4+k3r6)
The tangential distortion is generated by the defect in the camera manufacturing that makes the lens not parallel to the image plane, and can be quantitatively described as:
xd=x+(2p1xy+p2(r2+2x2))
yd=y+(p1(r2+2y2)+2p2xy)
In conclusion, the coordinate relationship before and after distortion is as follows:
xd=x(1+k1r2+k2r4+k3rb)+(2p1xy+p2(r2+2x2))
yd=y(1+k1r2+k2r4+k3r6)+(p1(r2+2y2)+2p2xy)
1-3) Rotating the two images according to the original rotation relationship between the two cameras: an original rotation matrix R and a translation vector t between the two cameras are known:
Xr=RXl+t
For the normal coordinate Xi of Pi after de-distortion obtained in the previous step, if Pi is a point on the infrared image, R1/2 Xi→Xi; if Pi is a point on the visible light image, R−1/2Xi→Xi.
1-4) Restoring the de-distorted and rotated image to the pixel coordinate system according to the formula u=KX; and calculating the de-distorted and corrected image coordinate according to the normal coordinate Pi of the image point Xi updated in the previous step.
KiXi→ui
It can be seen from the above that, if the coordinate ui of the point before de-distortion and correction is known, the coordinate of the de-distorted and corrected point calculated by steps 1-1)-1-4) is recorded as F(ui).
1-5) Calculating a pixel coordinate position F−1(vi) of a corresponding original image I0 of each image point vi of the de-distorted and corrected image I, and selecting a color value of the corresponding position from I0 and filling in I.
I(vi)=I0(F−1(vi))
Because F−1(vi) is a decimal coordinate, bilinear interpolation is needed to calculate the color value of the corresponding position of the decimal coordinate.
The step 2 specifically comprises the following steps:
2-1) Calculating saliency of each color. The saliency of the pixel is determined by the difference between the color of the pixel and the colors of other pixels. Therefore, pixels with the same color have the same saliency value. The saliency value of the pixel color is defined as:
2-2) Smoothing the color saliency for the purpose of reducing the noise caused by that similar colors are quantified as different values. The formula of the smoothed color saliency is as follows:
2-3) Determining the saliency according to the colors on the image pixel points to obtain a saliency image.
The step 3 specifically comprises the following steps:
Difference of Gaussian pyramid is obtained from the difference between adjacent scale spaces, and is often used for scale-invariant feature transform (SIFT). The scale space of an image is defined as: the convolution of a Gaussian convolution kernel and the image, which is a function of parameter σ in the Gaussian convolution kernel. Specifically, the scale space of a scene image I(x, y) is:
L(x,y,σ)=G(x,y,σ)*I(x,y)
is a Gaussian kernel function: σ is a scale factor; and the value of a determines the smoothness of the image. A large a value corresponds to a rough scale (low resolution), and a small σ value corresponds to a fine scale (high resolution). * indicates convolution operation. L(x,y,σ) is called as the scale space of the image I(x,y). The differences of scale spaces of different scales are calculated to obtain a layer of difference of Gaussian pyramid (as shown in
D(x,y,σ)=λ(L(x,y,kσ)−L(x,y,σ))
Unlike SIFT, only a layer of differential scale features is calculated. Two reasons for this are as follows: firstly, the amount of calculation of multilayer differential scale features is too large, and timeliness cannot be realized; and secondly, the accuracy of SIFT features obtained by using the multilayer differential scale features is too low.
3-2) Taking local extreme points of a single-layer difference of Gaussian pyramid D obtained in the previous step as a feature point set {P}.
3-2-1) Expanding D and recording the result as D1. Comparing each pixel point in D1 with a point on an 8-neighborhood; and if the pixel point is a local maximum value, adding the pixel point to a candidate point set P1.
3-2-2) Negating and expanding D, and recording the result as D2. Comparing each pixel point in D2 with a point on an 8-neighborhood; and if the pixel point is a local minimum value, adding the pixel point to a candidate point set P2.
3-2-3) Intersecting P1 and P2 to obtain P3=P1∩P2. Taking points having DoG gray value larger than 15 in P3 as a feature point set {P}, wherein the feature point set of an infrared gray image is P01l; the feature point set of an infrared saliency image is P02l; the feature point set of a visible light gray image is P01r; and the feature point set of a visible light saliency image is P02r.
3-2-4) The feature point set of the infrared image is P0l=P01l∩P02l; and the feature point set of the visible light image is P0r=P01r∩P02r.
The step 4 specifically comprises the following steps:
4-1) Dividing the infrared image and the visible light image into m×n blocks respectively. Conducting steps 4-2) to 4-6) for each feature point pil of the infrared image.
4-2) Finding a block bx
4-3) If the maximum similarity sfirst and the second maximum similarity ssecond in pil and {pir} satisfy:
F(sfirst,ssecond)≥t2
After selection according to the rule, matching the corresponding feature point p′il of pir in the infrared image according to the steps 4-2) and 4-3); reserving the matching pil, pir if p′il=pil is satisfied; if p′il=pil is not satisfied, discarding the points and selecting a next feature point to repeat step 4-2).
4-4) Based on the infrared image feature point pil=(xil,yil), conducting parabolic fitting to optimize an integer pixel feature point pir=(xir, yir) corresponding to the visible light image, to obtain a sub-pixel feature point p′ir=(xir+j*rx, yir+j*ry) corresponding to the visible light image, wherein j*rx is a sub-pixel offset in x direction and j*ry is a sub-pixel offset in y direction.
4-5) Based on the integer pixel feature point pir=(xir, yir) corresponding to the visible light image, calculating the sub-pixel feature point p′il=(xil+j*lx, yir+j*ly) corresponding to the infrared image according to the method of 4-4), wherein j*lx is a sub-pixel offset in x direction and j*ly is a sub-pixel offset in y direction.
4-6) Obtaining a final matching point pair of p′il, p′ir. Selecting a next infrared image feature point to repeat steps 4-2) to 4-6).
The step 6 specifically comprises the following steps:
6-1) Solving a basic matrix F and an essential matrix E according to the coordinates of the feature point pairs of the infrared image and the visible light image and the internal parameter matrices of the infrared camera and the visible light camera: a relationship between the pixel point pairs ul and ur corresponding to infrared light and visible light and the basic matrix F is:
urTFul=0
Further screening the point pairs by using random sample consensus (RANSAC); and substituting the coordinates of the corresponding points into the above formula to construct a homogeneous linear equation system to solve F.
A relationship between the basic matrix and the essential matrix is:
E=KrTFKl
6-2) Decomposing a relationship between rotation and translation of the infrared camera and the visible light camera after correction from the essential matrix: the relationship between the essential matrix E and rotation R and translation t is as follows:
E=[t]xR
Conducting singular value decomposition on E to obtain:
Defining two matrices
Thus, writing E in the following two forms
Obtaining four pairs of R and t, and selecting a solution with three-dimensional meaning.
6-3) Superimposing the decomposed relationship between rotation and translation into the original external parameters.
Recording the rotation matrix before de-distortion as R0 and the translation vector as t0=(tx, ty, tz)T; recording the rotation matrix calculated in the previous step as R and the translation vector as t=(t′x, t′y, t′x)T and new Rnew and tnew are as follows:
Multiplying tnew by a coefficient so that the component of tnew in x direction is txnew=tx.
The present invention has the following beneficial effects:
The present invention solves the change of a positional relationship between an infrared camera and a visible light camera due to factors such as temperature, humidity and vibration. The present invention has the advantages of high speed, accurate results and simple operation. The saliency of the image, which is a feature with cross-modal robustness, is found. The influence of cross-modal imaging differences can be overcome by detecting the saliency of the infrared image and the visible light image and extracting and matching the feature points on the saliency images.
Specific embodiments of the present invention are further described below in combination with accompanying drawings and the technical solution.
Step 1: Original image correction:
1-1) Calculating the coordinates in a normal coordinate system corresponding to each original image point Pi.
The normal coordinate system of each original image point Pi is:
Xi=Kiui
1-2) Removing image distortion: calculating the normal coordinate of an original image point after de-distortion.
Iterative computation is conducted for several times by taking (xd, yd) as the initial value of (x, y) to obtain the actual (x, y).
1-3) Rotating the two images according to the original rotation relationship between the two cameras:
For the normal coordinate Xi of Pi after de-distortion obtained in the previous step, if Pi is a point on the infrared image. R1/2 Xi→Xi; if Pi is a point on the visible light image, R−1/2Xi→Xi
1-4) Calculating the de-distorted and corrected image coordinate according to the normal coordinate Xi of the updated image point Pi.
KiXi→ui
It can be seen from the above that, if the coordinate ui of the point before de-distortion and correction is known, the coordinate of the de-distorted and corrected point calculated by steps 1-1)-1-4) is recorded as F(ui).
1-5) Calculating a pixel coordinate position F−1(vi) of a corresponding original image I0 of each image point vi of the de-distorted and corrected image I, and selecting a color value of the corresponding position from I0 and filling in I:
I(vi)=I0(F−1(vi))
Because F−1(vi) is a decimal coordinate, bilinear interpolation is needed to calculate the color value of the corresponding position of the decimal coordinate.
2) Detecting the saliency of the infrared image and the visible light image respectively based on a histogram contrast method.
2-1) Calculating saliency of each color. The saliency of the pixel is determined by the difference between the color of the pixel and the colors of other pixels. Therefore, pixels with the same color have the same saliency value. The saliency value of the pixel color is defined as:
2-2) Smoothing the color saliency for the purpose of reducing the noise caused by that similar colors are quantified as different values. The formula of the smoothed color saliency is as follows:
2-3) Determining the saliency according to the colors on the image pixel points to obtain a saliency image.
3) Extracting feature points on the infrared image, the visible light image and the saliency images thereof.
3-1) Constructing a multi-scale difference of Gaussian pyramid (DoG). The DoG pyramid is obtained from the difference between adjacent scale spaces, and is often used for scale-invariant feature transform (SIFT). The scale space of an image is defined as: the convolution of a Gaussian convolution kernel and the image, which is a function of parameter σ in the Gaussian convolution kernel. Specifically, the scale space of a scene image I(x,y) is:
L(x,y,σ)=G(x,y,σ)*I(x,y)
wherein
is a Gaussian kernel function: σ is a scale factor; and the value of a determines the smoothness of the image. A large σ value corresponds to a rough scale (low resolution), and a small σ value corresponds to a fine scale (high resolution). * indicates convolution operation. L(x,y,σ) is called as the scale space of the image I(x,y). The differences of scale spaces of different scales are calculated to obtain a layer of difference of Gaussian pyramid (as shown in
D(x,y,σ)=λ(L(x,y,kσ)−L(x,y,σ))
Unlike SIFT, only a layer of differential scale features is calculated. Two reasons for this are as follows; firstly, the amount of calculation of multilayer differential scale features is too large, and timeliness cannot be realized; and secondly, the accuracy of SIFT features obtained by using the multilayer differential scale features is too low.
3-2) Comparing each point in the DoG obtained in the previous step with the pixel points in the neighborhood to judge whether the point is a local extreme point.
3-2-1) Expanding D and recording the result as D1. Comparing each pixel point in D1 with a point on an 8-neighborhood; and if the pixel point is a local maximum value, adding the pixel point to a candidate point set P1.
3-2-2) Negating and expanding D, and recording the result as D2. Comparing each pixel point in D2 with a point on an 8-neighborhood; and if the pixel point is a local minimum value, adding the pixel point to a candidate point set P2.
3-2-3) Intersecting P1 and P2 to obtain P3=P1∩P2. Taking points having DoG gray value larger than 15 in P3 as a feature point set {P}, wherein the feature point set of an infrared gray image is P01l; the feature point set of an infrared saliency image is P02l; the feature point set of a visible light gray image is P01r; and the feature point set of a visible light saliency image is P02r.
3-2-4) The feature point set of the infrared image is P0l=P01l∩P02l; and the feature point set of the visible light image is P0r=P01r∩P02r.
4) Matching the feature points extracted in the previous step.
4-1) Dividing the infrared image and the visible light image into m×n blocks respectively; and conducting steps 4-2) to 4-6) for each corner point pil of the infrared image.
4-2) Finding a block bx
Calculating the degree of similarity of any point in pil and {Pir}. If the degree of similarity is greater than a threshold t1, regarding the point as rough matching point, and recording the set as {pir}; otherwise, discarding the point and selecting a next corner point to repeat step 4-2).
4-3) If the maximum similarity sfirst and the second maximum similarity ssecond in pil and {pir} satisfy:
F(sfirst,ssecond)≥t2
Reserving the matching, wherein a point pir having the maximum similarity in {pir} is taken as a matching point, t2 is a threshold and F(sfirst, ssecond) is used for describing a relationship between sfirst and ssecond; if the maximum similarity and the second maximum similarity do not satisfy the formula, discarding the point and selecting a next corner point to repeat step 4-2).
After selection according to the rule, matching the corresponding corner point p′il of pir in the infrared image according to the steps 4-2) and 4-3); reserving the matching pil, pir if p′il=pil is satisfied; if p′il=pil is not satisfied, discarding the points and selecting a next feature point to repeat step 4-2).
4-4) Based on the infrared image corner point pil=(xil, yil), conducting parabolic fitting to optimize an integer pixel corner point pir=(xir, yir) corresponding to the visible light image, to obtain a sub-pixel corner point p′ir=(xir+j*rx, yir+j*ry) corresponding to the visible light image, wherein j*rx is a sub-pixel offset in x direction and j*ry is a sub-pixel offset in y direction.
4-5) Based on the integer pixel corner point pir=(xir,yir) corresponding to the visible light image, calculating the sub-pixel corner point p′il=(xil+j*lx, yir+j*ly) corresponding to the infrared image according to the method of 4-4), wherein j*lx is a sub-pixel offset in x direction and j*ly is a sub-pixel offset in y direction.
4-6) Obtaining a final matching point pair of p′il, p′ir ; and selecting a next infrared image corner point to repeat steps 4-2) to 4-6).
5) Judging a feature point coverage area: dividing the image into m*n grids; if the feature points cover all the grids, executing a next step; otherwise continuing to shoot the image and repeating step 1) to step 4).
6) Correcting the calibration result: using image coordinates of all the feature points to calculate the positional relationship between the two cameras after correction; and then superimposing with the original external parameters.
6-1) Further screening the point pairs by using random sample consensus (RANSAC); and substituting the coordinates of the corresponding points into the above formula to construct a homogeneous linear equation system to solve F.
A relationship between the basic matrix and the essential matrix is:
E=KrTFKl
6-2) Decomposing a relationship between rotation and translation of the left camera and the right camera after correction from the essential matrix: the relationship between the essential matrix E and rotation R and translation t is as follows:
E=[t]xR
Conducting singular value decomposition on E to obtain:
Defining two matrices
Thus, writing E in the following two forms
Obtaining four pairs of R and t, and selecting a solution with three-dimensional meaning.
6-3) Superimposing the decomposed relationship between rotation and translation into the original external parameters.
Calculation results.
The rotation matrix R and the translation vector t before de-distortion are:
The calculated rotation matrix is R′, and the translation vector is t′
New Rnew and tnew are:
Number | Date | Country | Kind |
---|---|---|---|
201911154076.9 | Nov 2019 | CN | national |
Filing Document | Filing Date | Country | Kind |
---|---|---|---|
PCT/CN2020/077976 | 3/5/2020 | WO |
Publishing Document | Publishing Date | Country | Kind |
---|---|---|---|
WO2021/098083 | 5/27/2021 | WO | A |
Number | Name | Date | Kind |
---|---|---|---|
10554950 | Curlander | Feb 2020 | B1 |
20180262748 | Shibata | Sep 2018 | A1 |
20200177866 | Myokan | Jun 2020 | A1 |
20220132092 | Shibata | Apr 2022 | A1 |
Number | Date | Country |
---|---|---|
103761732 | Apr 2014 | CN |
105205818 | Dec 2015 | CN |
109146930 | Jan 2019 | CN |
109300161 | Feb 2019 | CN |
Entry |
---|
Luo, Yan, et al. “Multi-camera saliency.” IEEE Transactions on Pattern Analysis and Machine Intelligence 37.10 (2015): 2057-2070. |
Wang, Xiaogang. “Intelligent multi-camera video surveillance: A review.” Pattern Recognition Letters 34 (2013): 3-19. |
Qi, Wang, Fu Li, and Liu Zhenzhong. “Review on camera calibration.” 2010 Chinese control and decision conference. IEEE, 2010. |
Number | Date | Country | |
---|---|---|---|
20220028043 A1 | Jan 2022 | US |