A kind of image defogging method capable and system
Technical field
The present invention relates to image defogging method capable and system.
Background technology
In real life, often can run into and have greasy weather gas, and have the mist picture that has taken under greasy weather gas can not normally to use because visibility is low, therefore, occur a lot of mist elimination algorithms.
At present, have a lot to the algorithm having mist image to carry out mist elimination process in prior art, although this defogging method capable has advantage, also have shortcoming, some real-times are good, but mist elimination effect bad, some mist eliminations are effective, but real-time can not meet requirement again.
Summary of the invention
Technical matters to be solved by this invention is to provide a kind of image defogging method capable and system, can the requirement of real time mist elimination effect that can reach again.
The technical scheme that the present invention solves the problems of the technologies described above is as follows: a kind of image defogging method capable, comprises the following steps:
Step 1, inputs former figure, and namely a width colour has mist image;
Step 2, extracts basic image and levels of detail that described colour has mist image respectively;
Step 3, obtains the view data of R, G, B tri-passages of described basic image;
Step 4, asks for overall atmosphere light and the transmissivity of described each passage of basic image respectively;
Step 5, according to the overall atmosphere light of described each passage of basic image and transmissivity recover each passage without mist image, thus to obtain without mist basic image;
Step 6, adds levels of detail information to without mist basic image;
Step 7, strengthens process to what with the addition of levels of detail information without the smoothing process of mist basic image and brightness and contrast, obtains without mist original image.
On the basis of technique scheme, the present invention can also do following improvement:
Further, the overall atmosphere light obtaining each passage in described step 4 calculates in accordance with the following methods: the dark data asking for each passage, and the dark data of each passage and threshold value t are compared, when described dark data are greater than described threshold value t, then described dark data are compared with the pixel value on described former figure correspondence position, when described dark data are greater than the data on former figure correspondence position, then using the overall air light value of the pixel value on described former figure correspondence position as this passage described; Otherwise using described threshold value t as overall air light value, ask for the overall air light value of mean value as this passage of the overall air light value of all dark in each passage respectively.
Further, transmissivity is calculated in accordance with the following methods in described step 4:
Wherein,
t (x) is transmissivity; Ω (x) represents the template window centered by pixel x; A is overall air light value, and c represents R, G, B tri-passages, and I (y) is the desired value after mist elimination; G (x) is Gaussian convolution template, and template size is 13 × 13.
Further, obtain without mist basic image J (x) according to following methods in described step 5:
Wherein, I (x) is the former figure of input; t
0=0.3.
The invention has the beneficial effects as follows: by being optimized overall atmosphere light and transmissivity, not only requirement of real time but also the mist elimination effect that can reach.
The another kind of technical scheme that the present invention solves the problems of the technologies described above is as follows: a kind of image mist elimination system, comprising:
Load module, for inputting former figure, namely a width colour has mist image;
Extraction module, has basic image and the levels of detail of mist image for extracting described colour respectively;
Acquisition module, for obtaining the view data of R, G, B tri-passages of described basic image;
Computing module, for asking for overall atmosphere light and the transmissivity of described each passage of basic image respectively;
Recover module, for recover according to the overall atmosphere light of described each passage of basic image and transmissivity each passage without mist image, thus acquisition is without mist basic image;
Add module, for adding levels of detail information to without mist basic image;
Strengthening processing module, for strengthening process to what with the addition of levels of detail information without the smoothing process of mist basic image and brightness and contrast, obtaining without mist original image.
On the basis of technique scheme, the present invention can also do following improvement:
The overall atmosphere light obtaining each passage in described acquisition module calculates in accordance with the following methods: the dark data asking for each passage, and the dark data of each passage and threshold value t are compared, when described dark data are greater than described threshold value t, then described dark data are compared with the pixel value on described former figure correspondence position, when described dark data are greater than the data on former figure correspondence position, then using the overall air light value of the pixel value on described former figure correspondence position as this passage described; Otherwise using described threshold value t as overall air light value, ask for the overall air light value of mean value as this passage of the overall air light value of all dark in each passage respectively.
Further, transmissivity is calculated in accordance with the following methods in described acquisition module:
Wherein,
t (x) is transmissivity; Ω (x) represents the template window centered by pixel x; A is overall air light value, and c represents R, G, B tri-passages, and I (y) is the desired value after mist elimination; G (x) is Gaussian convolution template, and template size is 13 × 13.
Further, described recovery module obtains without mist basic image J (x) according to following methods:
Wherein, I (x) is the former figure of input; t
0=0.3.
The invention has the beneficial effects as follows: by being optimized overall atmosphere light and transmissivity, not only requirement of real time but also the mist elimination effect that can reach.
Accompanying drawing explanation
Fig. 1 is the schematic flow sheet of a kind of image defogging method capable of the present invention;
Fig. 2 is the structural representation of a kind of image mist elimination of the present invention system.
Embodiment
Be described principle of the present invention and feature below in conjunction with accompanying drawing, example, only for explaining the present invention, is not intended to limit scope of the present invention.
As shown in Figure 1, a kind of image defogging method capable, is characterized in that, comprise the following steps:
Step 1, inputs former figure, and namely a width colour has mist image;
Step 2, extracts basic image and levels of detail that described colour has mist image respectively;
Step 3, obtains the view data of R, G, B tri-passages of described basic image;
Step 4, asks for overall atmosphere light and the transmissivity of described each passage of basic image respectively;
The overall atmosphere light obtaining each passage in described step 4 calculates in accordance with the following methods: the dark data asking for each passage, and the dark data of each passage and threshold value t are compared, when described dark data are greater than described threshold value t, then described dark data are compared with the pixel value on described former figure correspondence position, when described dark data are greater than the data on former figure correspondence position, then using the overall air light value of the pixel value on described former figure correspondence position as this passage described; Otherwise using described threshold value t as overall air light value, ask for the overall air light value of mean value as this passage of the overall air light value of all dark in each passage respectively.
Transmissivity is calculated in accordance with the following methods in described step 4:
Wherein,
t (x) is transmissivity; Ω (x) represents with pixel x
Centered by template window; A is overall air light value, and c represents R, G, B tri-passages, I (y)
For the desired value after mist elimination; G (x) is Gaussian convolution template, and template size is 13 × 13.
Step 5, according to the overall atmosphere light of described each passage of basic image and transmissivity recover each passage without mist image, thus to obtain without mist basic image; Obtain without mist basic image J (x) according to following methods in described step 5:
Wherein, I (x) is the former figure of input; t
0=0.3.
Step 6, adds levels of detail information to without mist basic image;
Step 7, strengthens process to what with the addition of levels of detail information without the smoothing process of mist basic image and brightness and contrast, obtains without mist original image.
As shown in Figure 2, a kind of image mist elimination system, comprising:
Load module, for inputting former figure, namely a width colour has mist image;
Extraction module, has basic image and the levels of detail of mist image for extracting described colour respectively;
Acquisition module, for obtaining the view data of R, G, B tri-passages of described basic image;
The overall atmosphere light obtaining each passage in described acquisition module calculates in accordance with the following methods: the dark data asking for each passage, and the dark data of each passage and threshold value t are compared, when described dark data are greater than described threshold value t, then described dark data are compared with the pixel value on described former figure correspondence position, when described dark data are greater than the data on former figure correspondence position, then using the overall air light value of the pixel value on described former figure correspondence position as this passage described; Otherwise using described threshold value t as overall air light value, ask for the overall air light value of mean value as this passage of the overall air light value of all dark in each passage respectively.Computing module, for asking for overall atmosphere light and the transmissivity of described each passage of basic image respectively;
Transmissivity is calculated in accordance with the following methods in described acquisition module:
Wherein,
t (x) is transmissivity; Ω (x) represents the template window centered by pixel x; A is overall air light value, and c represents R, G, B tri-passages, and I (y) is the desired value after mist elimination; G (x) is Gaussian convolution template, and template size is 13 × 13.
Recover module, for recover according to the overall atmosphere light of described each passage of basic image and transmissivity each passage without mist image, thus acquisition is without mist basic image; Described recovery module obtains without mist basic image J (x) according to following methods:
Wherein, I (x) is the former figure of input; t
0=0.3.
Add module, for adding levels of detail information to without mist basic image;
Strengthening processing module, for strengthening process to what with the addition of levels of detail information without the smoothing process of mist basic image and brightness and contrast, obtaining without mist original image.
The foregoing is only preferred embodiment of the present invention, not in order to limit the present invention, within the spirit and principles in the present invention all, any amendment done, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.