Unmanned aerial vehicle aerial image haze sky and white area self-adaptive processing method
Technical Field
The invention belongs to the technical field of image processing, and particularly relates to a self-adaptive processing method for haze sky and white areas of aerial images of unmanned aerial vehicles.
Background
At present, the hotspot in the research field of unmanned aerial vehicles is to apply unmanned aerial vehicles in the fields of mapping, target recognition, geological disaster prevention and control and the like, and the executive task of the unmanned aerial vehicle depends on the unmanned aerial vehicle image with higher imaging quality to a great extent. Along with the deterioration of weather conditions, the image that obtains under the haze weather of taking photo by plane is fuzzy, and the definition is not high, and the image basic information characteristic that obtains of taking photo by plane is seriously distorted impaired, can't catch useful information, therefore people are more and more high to the defogging demand of unmanned aerial vehicle image of taking photo by plane.
In recent years, the defogging method of a single image has greatly improved, and the image defogging classification method can be divided into two types: fog image enhancement based on image processing and fog image restoration based on a physical model. The image enhancement method ignores the factor of image degradation, highlights the detail information of the image by enhancing the definition of the foggy day image, and restores the original image to a certain effect, but the method does not consider an image degradation model and has poor effect. The image restoration method aims at the foggy day image degradation process, establishes a degradation physical model, and inverts the degradation process, so that a fogless image is obtained. Compared to image-enhanced defogging algorithms. The image defogging effect based on the physical model is more natural, and the information loss is less. The fog-free outdoor image is utilized to construct a constraint condition, parameters in an atmospheric scattering model are estimated from a single image to achieve the aim of defogging, and the concept of 'dark channel' is put forward by the Gacamen et al, namely, the minimum value in RGB channels of all pixel points is close to 0 in any local window of a non-sky area of the fog-free outdoor image. The defogging effect of the method is ideal, but the sky area or the white bright area does not meet the dark primary color prior rule, so that the image color distortion problem generally exists in the areas after defogging, and therefore, the problem of the color distortion of the sky area or the white bright area becomes an important task in the conventional image restoration.
Aiming at the defects of the existing algorithm, key parameters in an atmospheric scattering model are researched, a bilateral filter or a guide filter with a good edge protection effect is used for accurately estimating an atmospheric dissipation function, image edge detail information is reserved, excessive naturalness can be realized between an edge and a slow area, a halo effect or fog residue is prevented from occurring after an image is restored, and the problem of distortion of bright areas such as sky or white is still not solved; some people adopt a fixed threshold value to repair the transmittance, so that the recovery effect of the sky fog image is protected to a certain extent, but the defogging deficiency of the sky-free image is easily caused; some people also adopt a sky area to be segmented to avoid the color distortion problem of the defogged image, but the maximum connected area is used as the identified sky area, so that missing detection of certain blocks at the sky part is easily caused, and the color distortion of the missed detection part of the sky area is caused. The algorithms do not fundamentally solve the problem of defogging color distortion, so the defogging effect algorithm for improving the haze sky or white region is still to be improved.
Disclosure of Invention
The invention aims to provide a self-adaptive processing method for haze sky and white areas of aerial images of unmanned aerial vehicles, which overcomes the defects in the prior art.
In order to achieve the purpose, the invention adopts the following technical scheme:
an unmanned aerial vehicle aerial image haze sky and white area self-adaptive processing method comprises the following steps:
step 1: acquiring an aerial image I (x) of the unmanned aerial vehicle;
step 2: dark channel image I for acquiring unmanned aerial vehicle aerial image I (x)dark(x) And a gray scale image Igray(x);
And step 3: dark channel image I obtained according to step 2dark(x) Combining the bright spot with the aerial image I (x) of the unmanned aerial vehicle to obtain an atmospheric light value A of the aerial image of the unmanned aerial vehicle;
and 4, step 4: defining an atmospheric dissipation function: v (x) ═ a (1-t (x)), where V (x) represents an atmospheric dissipation function, a represents an atmospheric light value, and t (x) represents an image transmittance; and taking the dark channel image obtained in the step 2 as a rough estimation V (x) of the atmospheric dissipation function;
and 5: obtaining a gray level image I according to the step 2gray(x) Obtaining a gray histogram of the gray image and obtaining an adaptive threshold value ThrB to segment a close view and a sky or white area;
step 6: utilizing the adaptive threshold ThrB obtained in the step 5 to process the roughly estimated atmospheric dissipation function in regions, defining a new correction formula, calculating a correction coefficient, defining an improved atmospheric dissipation function formula, and substituting the correction coefficient into the improvement formula to obtain an improved atmospheric dissipation function V' (x);
and 7: refining the improved atmospheric dissipation function obtained in the step 6 by using a bilateral filter to obtain a refined atmospheric dissipation function V' (x);
and 8: using the transmittance estimation formula, based on the fine atmospheric dissipation function V "(x) obtained in step 7Obtaining the transmittance t (x) of the whole image;
and step 9: and (3) establishing an image degradation process model, and recovering to obtain a defogged image J (x) by using the original image I (x) obtained in the step (1) and the parameters A, t (x) obtained in the steps (3) and (8).
Further, dark channel image I in step 2dark(x) Is represented as follows:
where c is the value of one of the three color channels R, G, B.
Further, when the atmospheric light value a is obtained in step 3, the first 0.1% pixel point with the maximum brightness value of the dark channel image is selected to correspond to the first 0.1% pixel point with the maximum brightness in the original foggy image, the corresponding R, G, B three channel values are respectively obtained as an average value, and finally the atmospheric light value a is obtained as an average value of the three atmospheric light values corresponding to the three channels.
Further, the atmospheric dissipation function in step 4 satisfies two constraints: (1) at each pixel point, V (x)>0, namely, the atmospheric dissipation function takes a positive value; (2)i.e., V (x) is not greater than the minimum color component of the fog-containing image I (x), the dark channel image is taken as a rough estimate of the atmospheric dissipation function.
Further, the step 5 is implemented as follows:
step 5.1: calculating a grayscale image Igray(x) And calculating the cumulative distribution function L (x) of the image, and extracting the distribution at [0.05,0.95 ]]Using a distribution function to calculate L (x)1) 0.05 and L (x)2) Gray scale value x of 0.951、x2Finally, the central point of the gray level histogram is calculated
Step 5.2: carrying out self-adaptive segmentation on the gray level histogram by using a maximum inter-class variance method to obtain a threshold value sh for distinguishing a target from a background;
step 5.3: the method comprises the following steps of accurately finding a pixel point ThrB corresponding to an initial point of a peak area of a gray histogram by reducing a gray histogram interval, wherein the method specifically comprises the following steps: finding out the minimum extreme point of the histogram in the [ max (Mid, sh), A ] interval, calculating the corresponding gray-scale value, namely the corresponding pixel point ThrB, reducing the interval by a dichotomy, finally setting the interval as [ b, ThrM ], finding out the minimum extreme point of the histogram in the interval, and setting the corresponding pixel value as ThrB;
wherein,ThrM is [ max (Mid, sh), A]And the pixel value corresponding to the maximum value point of the histogram in the interval.
Further, the new correction formula in step 6 is defined as:
wherein M is a correction coefficient, Igray(x) For gray-scale images, a is a parameter which influences the trend of the function, IdarkIs a dark channel image.
Further, defining the modified atmospheric dissipation function as:
V'(x)=M*V(x)
where V (x) is a rough estimate of the atmospheric dissipation function.
Further, the improved atmospheric dissipation function is refined by using a bilateral filter in step 7, i.e. V "(x) ═ Bil (V' (x));
wherein Bil (x) is a bilateral filter, and its mathematical expression is defined as
w(i,j)=ws(i,j)wr(i,j)
S is a neighborhood with (x, y) as a center, (x, y) is the coordinate of a central pixel point in a filtering window, (i, j) is the coordinate of an adjacent pixel point, w (i, j) is a weighting coefficient, ws(i, j) is a spatial similarity kernel, wr(i, j) is a brightness similarity kernel function, g (x, y) is the brightness value of the central pixel point in the filtering window, g (i, j) is the brightness value of the adjacent pixel points, and sigma iss、σrRespectively, a spatial similarity kernel function and a brightness similarity kernel function standard deviation.
Further, in step 9, the original image I (x), the atmospheric light a, and the obtained transmittance t (x) are substituted into the image degradation process model I (x) ═ J (x) t (x) + a (1-t (x)), and the restored image obtained by deformation is expressed by the formulaNamely, the defogged image J (x) is recovered.
Compared with the prior art, the invention has the following beneficial technical effects:
the invention provides a self-adaptive processing method for a bright area such as a haze sky or white, which can self-adaptively solve a threshold value when defogging processing is carried out on a fog-containing image containing the bright area such as the sky or the white, self-adaptively partition the bright area such as the sky or the white and a close-range area through threshold value judgment, and provide a new correction formula for different areas so as to improve an atmospheric dissipation function. The novel self-adaptive processing method can accurately detect bright areas such as haze sky or white and the like, improve and process the atmospheric dissipation function in the areas, recover the bright areas such as sky or white and the like which are more in line with human eyes, and can keep the defogging effect of the close-range areas. Compared with the traditional bilateral filtering algorithm, the new algorithm effectively segments bright areas such as sky or white, the problem of color distortion of the bright areas is solved after self-adaptive processing, and the signal-to-noise ratio, the contrast and the color saturation of the defogged image are improved to a great extent.
Drawings
FIG. 1 is a schematic flow diagram of the present invention;
fig. 2 is a comparison of the defogging effect of the present invention on the unmanned aerial vehicle aerial image containing bright areas such as haze sky or white, etc., with other filtering methods, where (a) (b) (c) (d) is the original unmanned aerial vehicle aerial image, (e) (f) (g) (h) is the image after bilateral filtering defogging of (a) (b) (c) (d), and (i) (j) (k) (l) is the image after defogging of (a) (b) (c) (d) by using the algorithm of the present invention.
Detailed Description
The invention is described in further detail below with reference to the accompanying drawings:
referring to fig. 1 and fig. 2, the invention provides a method for adaptively processing haze sky and white areas of aerial images of unmanned aerial vehicles.
Step 1, acquiring an aerial image of an unmanned aerial vehicle: and acquiring an aerial image I (x) to be subjected to defogging treatment by using unmanned aerial vehicle image acquisition equipment.
Step 2, solving a dark channel image I from the unmanned aerial vehicle aerial image obtained in the step 1 based on a dark channel prior theorydark(x) And a gray scale image Igray(x);
The obtained dark channel image is based on dark channel prior theory proposed by the Cacamme, and in most non-sky areas, at least one color channel of some pixels has a very low value and almost approaches zero. In other words, the minimum value of the light intensity in this region is a small number close to zero. Taking an RGB image as an example, for an arbitrary input image I, the dark channel can be expressed by the following formula:
where c is the value of one of the 3 color channels R, G, B;
step 3, obtaining the dark channel image I according to the step 2dark(x) And selecting the first 0.1% pixel points with the largest brightness value from the bright points, finding out the brightness values at the corresponding positions in the original unmanned aerial vehicle aerial color image I (x), summing and calculating the average value to respectively obtain the atmospheric light values of the three channels, and averaging the atmospheric light values of the three channels to obtain the final atmospheric light value A.
Step 4, defining an atmospheric dissipation function: v (x) ═ a (1-t (x)), where V (x) represents an atmospheric dissipation function, a represents an atmospheric light value, t (x) represents an image transmittance, and the atmospheric dissipation function satisfies two constraints: (1) at each pixel point, V (x)>0, namely the value of the atmospheric dissipation function is a positive value; (2)that is, V (x) is not greater than the minimum color component of the fog-containing image I (x), so the dark channel image is used as a rough estimate of the atmospheric dissipation function in the present invention;
step 5, obtaining the gray level image I according to the step 2gray(x) Obtaining a gray level histogram of the image, and obtaining an adaptive threshold value ThrB to segment a near view and a bright area such as sky or white;
the sky or white area in the image is usually brighter, and exhibits high peak characteristics on a gray histogram, so an adaptive threshold value ThrB can be obtained to segment a close scene from the sky or white area, and the specific implementation steps are as follows:
(1) in order to judge the distribution of the histogram, firstly, a gray image I is calculatedgray(x) And calculating the cumulative distribution function L (x) of the image, and extracting the distribution at [0.05,0.95 ]]Using a distribution function to calculate L (x)1) 0.05 and L (x)2) Gray scale value x of 0.951、x2Finally, the center point of the main histogram is calculated
(2) And (5) dividing the histogram by using a maximum inter-class variance method to obtain sh. A threshold value sh is obtained through self-adaption to distinguish a target from a background;
(3) and accurately finding a pixel point ThrB corresponding to the starting point of the peak histogram by reducing the interval of the histogram. Finding out the minimum extreme point of the histogram in the [ max (Mid, sh), A ] interval, and calculating the corresponding gray-scale value, namely the corresponding pixel point, namely the ThrB to be found. And (3) reducing the interval by a dichotomy, finally setting the interval as [ b, ThrM ], finding the minimum value point in the histogram in the interval, and setting the corresponding pixel value as ThrB.
Wherein,ThrM is [ max (Mid, sh), A]And the pixel value corresponding to the maximum value point in the histogram in the interval.
Step 6, according to the adaptive threshold value ThrB obtained in step 5, defining a new correction formula, calculating a correction coefficient M, defining an improved atmospheric dissipation function V ' (x) ═ M × V (x), and substituting the improved atmospheric dissipation function V ' (x) into the improvement formula to obtain an improved atmospheric dissipation function V ' (x);
the new correction formula is defined as:
Igrayis a gray image, a is a parameter influencing the trend change of the function, the value of a is 10, IdarkIs a dark channel image.
Step 7, refining the improved atmospheric dissipation function obtained in the step 6 by using a bilateral filter, namely V "(x) is Bil (V' (x)), so as to obtain a refined atmospheric dissipation function V" (x);
the mathematical expression of the bilateral filter is defined as
w(i,j)=ws(i,j)wr(i,j)
S is a neighborhood which takes (x, y) as a center and has the size of 5 multiplied by 5, (x, y) is the coordinate of a central pixel point in a filtering window, and (i, j) is the coordinate of an adjacent pixel point. W (i, j) is a weighting coefficient, Ws(i, j) is a spatial similarity kernel, wrAnd (i, j) is a brightness similarity kernel function, g (x, y) is the brightness value of the central pixel point in the filtering window, and g (i, j) is the brightness value of the adjacent pixel points. Standard deviation sigma of spatial similarity kernel functionsLuminance similarity kernel standard deviation σ ═ 3r=0.1。
And 8: according to the fine atmospheric dissipation function V' (x) obtained in the step 7, the atmospheric dissipation function formula is deformed to obtain a transmissivity estimation formulaSubstituting the A and V' (x) obtained in the step 3 and the step 6 into a transmissivity estimation formula to obtain the transmissivity t (x) of the whole image;
and step 9: establishing an image degradation process model I (x) ═ J (x) t (x) + A (1-t (x)), and deforming to obtain an image restoration formulaAnd recovering the defogged image J (x) by using the original image I (x) obtained in the step 1 and the parameters A, t (x) obtained in the steps 3 and 8.
Fig. 1 is a flow chart of the algorithm. Fig. 2 is a diagram of processing effects of different algorithms. In fig. 2, four different sets of unmanned aerial vehicle aerial images are used, and a bilateral filter is used as a comparison group to compare with the effect of the haze sky or white area adaptive processing algorithm for improving the atmospheric dissipation function provided by the invention. The analysis of the experimental result in fig. 2 shows that compared with the original image and the image after bilateral filtering, the new algorithm can solve the problem of color distortion after defogging of bright areas such as a haze sky or white and the like, better maintains the defogging effect of the image in a close-range area, and improves the color saturation and contrast of the restored image.
Table 1 is a comparison table of objective evaluation parameters after defogging of an image aerial by an unmanned aerial vehicle by applying different defogging algorithms.
TABLE 1 evaluation table of defogging effect parameters of different algorithms
As can be seen from table 1, the adaptive processing algorithm for haze sky or white regions provided by the present invention has a relatively high peak signal-to-noise ratio and color saturation after defogging of an image, and the larger the parameters such as the peak signal-to-noise ratio are, the better the image restoration effect is. From table 1, it can be seen that each parameter of the image after defogging is greater than the bilateral filtering defogging algorithm. For the image contrast, the image contrast after defogging is superior to the original image and the bilateral filtering algorithm to a certain extent. It can be seen that the adaptive processing algorithm for the sky or white bright area provided by the invention can eliminate the color distortion problem of the defogged bright area.
Therefore, aiming at the aerial fog-containing image of the unmanned aerial vehicle containing the sky or the white area, the self-adaptive processing algorithm of the aerial image of the unmanned aerial vehicle based on the haze sky or the white area of the improved atmosphere dissipation function is superior to the existing algorithm, and has obvious technical advantages. The method has extremely high application value for further processing and accurately extracting the information in the aerial image.
The invention relates to an algorithm for carrying out self-adaptive processing on a sky or white bright area of a fog-containing image, which can accurately segment the sky or white bright area, better eliminate the color distortion problem after defogging of the sky or white bright area and keep the defogging effect only. Compared with a bilateral filtering defogging algorithm, the image color saturation and contrast after defogging by the algorithm are obviously improved, the algorithm is more in line with human eye vision, the practicability of the algorithm is stronger, and the algorithm has high academic value and application value for improving the aerial fog-containing image quality of the unmanned aerial vehicle and extracting useful information.