# Image Defogging Algorithm Based on Sparse Representation

Authors: Di Fan; Xinyun Guo; Xiao Lu; Xiaoxin Liu; Bo Sun
Journal: Complexity
 (2020)

---

## Abstract

Aiming at the problems of low contrast and low definition of fog degraded image, this paper proposes an image defogging algorithm based on sparse representation. Firstly, the algorithm transforms image from RGB space to HSI space and uses two-level wavelet transform extract features of image brightness components. Then, it uses the K-SVD algorithm training dictionary and learns the sparse features of the fog-free image to reconstructed I-components of the fog image. Using the nonlinear stretching approach for saturation component improves the brightness of the image. Finally, convert from HSI space to RGB color space to get the defog image. Experimental results show that the algorithm can effectively improve the contrast and visual effect of the image. Compared with several common defog algorithms, the percentage of image saturation pixels is better than the comparison algorithm.


---

## Body

## 1. Introduction

In fog and haze weather conditions, the image taken by using imaging equipment is prone to quality degradation. The degraded image brings difficulties to the application of image in military, traffic, driverless vehicles, and other fields [1]. Therefore, dehazing the foggy image has important practical application value.In recent years, many scholars at home and abroad have done a lot of research on image dehazing algorithms, among which the representative algorithms are mainly divided into three categories. The first is the method based on image enhancement, which achieves the purpose of dehazing by improving the contrast of the image, mainly including Retinex algorithm [2], wavelet transform algorithm [3], and histogram equalization algorithm [4]. In view of the problem of detail loss and uneven dehazing effect of the adaptive histogram equalization algorithm with limited contrast, Wang et al. [5] proposed a contrast adaptive clipping histogram equalization algorithm, which enhanced image contrast and enriched image detail information. This method does not consider the cause of image degradation; the image loses some information while enhancing the contrast. The second is the image restoration algorithm based on the imaging model, which constructs the physical model of image degradation, then estimates the unknown parameters in the imaging model through the prior knowledge, and finally recovers the fogless image, for example, dark channel prior algorithm [6], color attenuation prior algorithm [7], atmospheric dissipation function algorithm [8], and so on. He et al. [9] obtained the dark channel prior theory by analyzing statistically a large number of outdoor fogless images, which can be used to better recover fogless images. However, the image after the dehazing is easy to show halo effect, especially in the sky region which does not meet the dark channel prior theory which has serious color distortion. Many scholars put forward improvement measures. Han et al. [6] isolated the sky region of the image for processing by setting the threshold value. In order to improve the real-time performance of the algorithm, the image was reduced, which reduces the time required to figure out the transmittance map, and then interpolation method was used to restore the transmittance map to the size of the original image, and the resulting images achieved a better dehazing effect. Guo et al. [10] divided the image into three regions and adopted different dehazing algorithms for each region, which could well avoid false edges at the junction of sky and scenery. Ti et al. [11] proposed to divide the foggy image into sky region and non-sky region and introduced tolerance parameter correction transmittance to the sky region that does not meet the dark channel prior theory. Fan et al. [12] proposed a dehazing model combining atmospheric scattering model and color attenuation prior, which greatly improved the clarity and contrast of the recovered image. Peng et al. [13] eliminated color distortion while restoring contrast by adding color adaptive correction. Xu et al. [14] proposed an image dehazing algorithm based on the combination of sparse representation and dark channel prior based on K-SVD, which has a good dehazing effect. Liu et al. [15] refined the medium transfer map according to the sparse features of fog gray images and then reversely solved the fog degradation model. Finally, the processing advantage of the sky region in the fog image was obvious. Weijing [16] applied the sparse representation algorithm to the image dehazing. By comparing the dark channel prior model, the new algorithm has a better dehazing effect and a higher fidelity. The third is the neural network dehazing algorithm based on machine learning [17–20]. This method uses multi-scale convolution operation to extract the feature map of the image, then uses the fog image and its corresponding fogless image as the training set to train different network structures, and finally uses the trained model to image dehazing. However, this method does not consider the degradation of the image, so the phenomenon of incomplete dehazing occurs.Aiming at the above problems, this paper proposes an image dehazing algorithm based on sparse representation on the basis of analyzing and summarizing the characteristics of existing methods. Firstly, the image is converted from RGB space to HSI space, and the two-stage wavelet transform extract feature extraction of the I component is used. Then, the K-SVD algorithm for dictionary training of the extracted features is used, the sparse features of the fogless image are learned, and the I-component of the fogless image is reconstructed. Then the S-component is nonlinearly stretched to improve the image saturation. In this paper, the proposed algorithm is tested and a good dehazing effect is obtained.


## 2. Defogging Algorithm Based on Sparse Representation

### 2.1. General Idea of the Algorithm

This paper proposes a single image defogging algorithm framework based on sparse representation as shown in Figure1, which is mainly divided into two processes. One is the dictionary training process, first using image pairs (foggy images and their corresponding non-foggy images) to build a training set, then extracting the characteristics of the image pair I-component through wavelet transform, and using the K-SVD algorithm to sparsely combine a large number of image pairs dictionary training to get a dictionary of foggy images and non-foggy images. The other is the reconstruction process, first inputting the I-component of the image to be reconstructed, then extracting the features in the wavelet domain, and obtaining the sparse coefficient α through the orthogonal matching pursuit (OMP) algorithm. The sparse representation coefficient α gets the I-component of the reconstructed image. Compared with fogless image, the pixel value of S-component of foggy image is lower. In order to improve the image saturation, the nonlinear stretching function is used to stretch the image saturation. Finally, the processed HSI space image is converted into RGB color space to obtain the defogged image.Figure 1
Defogging algorithm framework based on sparse representation.


### 2.2. Feature Extraction in Image Wavelet Domain

Wavelet transform is the development of Fourier transform. Because of its good time-frequency localization ability [21], it can extract the effective information of the image well, so it is widely used in the field of image processing. In this paper, Haar wavelet is used as an orthogonal function to perform two-layer decomposition of two-dimensional images. Figure 2 shows the decomposition diagram of two-level wavelet decomposition.Figure 2
Decomposition diagram of second-order wavelet.Among them, HL_1, LH_1, and HH_1 represent the horizontal, vertical, and diagonal high-frequency components after first-order wavelet decomposition; LL_2 represents the low-frequency component of second-order wavelet decomposition. HL_2, LH_2, and HH_2 represent the horizontal, vertical, and diagonal high-frequency components after the second-order wavelet decomposition, respectively.In this paper, two-level wavelet transform is used to extract the features of the I-component of the image in the training set. Firstly, the image is first-level decomposed to obtain the feature maps of horizontal, vertical, and diagonal directions and low-frequency components, and then the low-frequency components are decomposed to obtain high-frequency and low-frequency feature maps. The dictionary training is performed through the extracted feature map to recover the I component. Figure3 shows the extracted feature map after two-stage wavelet decomposition.Figure 3
Two-level wavelet feature extraction diagram, (a) brightness components of different images, (b) wavelet transform feature extraction.
(a)(b)


### 2.3. Sparse Representation

Signals generally have sparse characteristics. The sparse representation of a signal represents the original signal through a series of basic signals in the dictionary or a linear combination of some atoms, which makes it easier to perform subsequent processing on the signal, such as encoding, compression, and amplification.For image signalsx∈RN, a linear combination of sparse dictionary D=d1,d2,…,dL∈RN×LN<L can be used to express [22]. A column in the dictionary is called an atom. Sparse representation is to use a linear combination of a small number of atoms in the dictionary to represent the signal, and its mathematical expression is [23](1)x=Dα.Among them,α=α1,α2,…,αLT∈RL represents the coefficient matrix. If the coefficient matrix is sparse, most of the elements in the matrix are zero, and there are only a few non-zero elements. The linear combination representation is a sparse representation.


## 2.1. General Idea of the Algorithm

This paper proposes a single image defogging algorithm framework based on sparse representation as shown in Figure1, which is mainly divided into two processes. One is the dictionary training process, first using image pairs (foggy images and their corresponding non-foggy images) to build a training set, then extracting the characteristics of the image pair I-component through wavelet transform, and using the K-SVD algorithm to sparsely combine a large number of image pairs dictionary training to get a dictionary of foggy images and non-foggy images. The other is the reconstruction process, first inputting the I-component of the image to be reconstructed, then extracting the features in the wavelet domain, and obtaining the sparse coefficient α through the orthogonal matching pursuit (OMP) algorithm. The sparse representation coefficient α gets the I-component of the reconstructed image. Compared with fogless image, the pixel value of S-component of foggy image is lower. In order to improve the image saturation, the nonlinear stretching function is used to stretch the image saturation. Finally, the processed HSI space image is converted into RGB color space to obtain the defogged image.Figure 1
Defogging algorithm framework based on sparse representation.


## 2.2. Feature Extraction in Image Wavelet Domain

Wavelet transform is the development of Fourier transform. Because of its good time-frequency localization ability [21], it can extract the effective information of the image well, so it is widely used in the field of image processing. In this paper, Haar wavelet is used as an orthogonal function to perform two-layer decomposition of two-dimensional images. Figure 2 shows the decomposition diagram of two-level wavelet decomposition.Figure 2
Decomposition diagram of second-order wavelet.Among them, HL_1, LH_1, and HH_1 represent the horizontal, vertical, and diagonal high-frequency components after first-order wavelet decomposition; LL_2 represents the low-frequency component of second-order wavelet decomposition. HL_2, LH_2, and HH_2 represent the horizontal, vertical, and diagonal high-frequency components after the second-order wavelet decomposition, respectively.In this paper, two-level wavelet transform is used to extract the features of the I-component of the image in the training set. Firstly, the image is first-level decomposed to obtain the feature maps of horizontal, vertical, and diagonal directions and low-frequency components, and then the low-frequency components are decomposed to obtain high-frequency and low-frequency feature maps. The dictionary training is performed through the extracted feature map to recover the I component. Figure3 shows the extracted feature map after two-stage wavelet decomposition.Figure 3
Two-level wavelet feature extraction diagram, (a) brightness components of different images, (b) wavelet transform feature extraction.
(a)(b)


## 2.3. Sparse Representation

Signals generally have sparse characteristics. The sparse representation of a signal represents the original signal through a series of basic signals in the dictionary or a linear combination of some atoms, which makes it easier to perform subsequent processing on the signal, such as encoding, compression, and amplification.For image signalsx∈RN, a linear combination of sparse dictionary D=d1,d2,…,dL∈RN×LN<L can be used to express [22]. A column in the dictionary is called an atom. Sparse representation is to use a linear combination of a small number of atoms in the dictionary to represent the signal, and its mathematical expression is [23](1)x=Dα.Among them,α=α1,α2,…,αLT∈RL represents the coefficient matrix. If the coefficient matrix is sparse, most of the elements in the matrix are zero, and there are only a few non-zero elements. The linear combination representation is a sparse representation.


## 3. Dictionary Training and Reconstruction

### 3.1. Dictionary Training Based on K-SVD

Dictionary training is the core of the sparse representation of the image. The quality of the dictionary after training will directly affect the effect of the sparse representation. The smaller the residual between the atoms and the signals in the dictionary, the more the structural features match, and the higher the quality of the reconstructed image. Since the images to be reconstructed are very different and the texture details of the images are quite different, the dictionaries obtained by different training methods will have different effects on the reconstruction of the images. Common training dictionary algorithms include MOD algorithm (Method of Optimal Directions, MOD), K-SVD algorithm (K-Singular Value Decomposition, K-SVD), and ODL algorithm (Online Directions Learning, ODL). The K-SVD algorithm uses alternate iteration to update the dictionary, which is more efficient than other algorithms. Therefore, this papers uses the K-SVD algorithm for dictionary training. The training process is shown in Figure4.Figure 4
Dictionary training process.The K-SVD algorithm was proposed by Aharon. This algorithm improves the decomposition efficiency by reducing the number of atoms in the dictionary; the atoms retained in the dictionary can also represent the original information. The specific implementation process is as follows [24]:D means complete dictionary, and A means sparse coefficient moment:(2)A=α1,α2,…,αL∈RL×K,1≤i≤K,D=d1,d2,…,dK∈RK×N,K<N.Assign initial values to the complete dictionary and sparse matrix, and then update a column of atomdj in D; the cost function is (3)X−DA22=X−∑j=1Kdjαj22=X−∑j≠kdjαj−dkαk22,(4)Ek=X−∑j≠kdjαj,where Ek is the error matrix, which represents the errors that other atoms than the k column have on the image. Then, equation (3) can be expressed as(5)X−DA22=Ek−∑j=1Kdkαk22.For the above formula, if the singular value decomposition value ofEk is directly used to update dj and αj, the updated αj value will not be sparse, so transform Ej and αj, and only retain the non-zero values in αj:(6)ωj=p1≤p≤P,αj≠0,j=1,2,…,K.Select all columns in the error matrixEk that satisfy the set ωj to form EjR, and then perform singular value decomposition:(7)EjR=UΔVT.The updated value is(8)dj=μ1j,αjR=σ1jν1j.Among them,σ1j is the largest singular value of EjR, and μ1j and ν1j are the first column vectors of Uj and Vj, respectively. After traversing each column in the dictionary, the optimized dictionary is obtained. The process of K-SVD algorithm is shown in Table 1.Table 1
K-SVD algorithm steps.
Input: pending signalX, initialize dictionary D0 to DCT dictionaryProcess: step (1): normalize the initialization dictionary D0; set the number of iterations: k=1step (2): whilek<K dostep (2.1): fix the dictionary and findωj, Ωj and EjRstep (2.2): dictionary update using formula (8)step (2.3): get the dictionary afterk iterations Dkstep (3): end whileOutput: updated dictionaryDk+1


### 3.2. Image Defog Reconstruction

Signal sparse representation also involves another key issue, namely, sparse coding. The so-called sparse coding refers to the process of solving the sparse coefficientα when the overcomplete dictionary D is known. The solution of this coefficient is an NP-hard problem. The common methods to solve the sparse coefficient include MP algorithm (Matching Pursuit algorithm, MP), OMP algorithm (Orthogonal Matching Pursuit algorithm, OMP), and SOMP algorithm (Simultaneous Orthogonal Matching Pursuit algorithm, SOMP). Atoms selected the OMP algorithm are orthogonal, which ensure that the signal and the selected atoms meet the orthogonal condition at each step of the iteration. Meanwhile, selected atoms cannot be selected again in the next iteration, which greatly reduces algorithm processing time and the number of atoms to decompose the original signal. In view of the above advantages, this paper uses the orthogonal matching pursuit algorithm [24] to solve the sparse coefficients.For an image with fog, in the HSI color space, the fog is mainly distributed in theI-component. This paper reconstructed the I-component to improve the image brightness to achieve the purpose of fog removal. After dictionary training, a dictionary of the I-component of the foggy image and the I-component of the nonfoggy image is obtained, and the trained dictionary is used to reconstruct the foggy image I-component. The process is shown in Figure 5. First, feature extraction is performed on the I-component of the foggy image to obtain image feature blocks, and then OMP algorithm is used to obtain the sparse representation coefficient α in combination with the trained dictionary of the foggy image. The dictionary of the I-component of the fog-free image is brought into equation (1) to obtain the wavelet domain features of the reconstructed image I-component, and finally the inverse wavelet transform is used to obtain the reconstructed image I-component.Figure 5
I-component defog reconstruction process of foggy image.In order to improve the image saturation and make the image color more vivid, it is necessary to stretch the saturation. Due to uneven illumination at different locations of the same image, different regions have different saturations. In order to achieve different stretching effects under different lighting conditions, this paper uses a piecewise function to perform nonlinear stretch. Assuming that the minimum brightness value of the saturation component of the foggy image isL and the maximum brightness value is H, the interval L,H is evenly divided into three segments, and the length of each segment is c=H−L/3, using the following formula for saturation stretching:(9)Sx=2×S′xL≤x<L+c,2.5×S′xL+c≤x<L+2c,3.5×S′xL+2c≤x<H.In the formula,S′x represents the value of the S-component of the original image and Sxrepresents the value of the S-component after stretching.In the HSI color space, theH-component determines the essence of the color of an object. It is determined by the wavelength reflected by the object, and different wavelengths reflect different colors. For a color, the hue of the image before and after defogging is approximately invariant. Therefore, this article does not process the H-component to keep the original hue. Combine the processed S-component, I-component, and original H-component and convert to RGB space to get the final defogging image.


## 3.1. Dictionary Training Based on K-SVD

Dictionary training is the core of the sparse representation of the image. The quality of the dictionary after training will directly affect the effect of the sparse representation. The smaller the residual between the atoms and the signals in the dictionary, the more the structural features match, and the higher the quality of the reconstructed image. Since the images to be reconstructed are very different and the texture details of the images are quite different, the dictionaries obtained by different training methods will have different effects on the reconstruction of the images. Common training dictionary algorithms include MOD algorithm (Method of Optimal Directions, MOD), K-SVD algorithm (K-Singular Value Decomposition, K-SVD), and ODL algorithm (Online Directions Learning, ODL). The K-SVD algorithm uses alternate iteration to update the dictionary, which is more efficient than other algorithms. Therefore, this papers uses the K-SVD algorithm for dictionary training. The training process is shown in Figure4.Figure 4
Dictionary training process.The K-SVD algorithm was proposed by Aharon. This algorithm improves the decomposition efficiency by reducing the number of atoms in the dictionary; the atoms retained in the dictionary can also represent the original information. The specific implementation process is as follows [24]:D means complete dictionary, and A means sparse coefficient moment:(2)A=α1,α2,…,αL∈RL×K,1≤i≤K,D=d1,d2,…,dK∈RK×N,K<N.Assign initial values to the complete dictionary and sparse matrix, and then update a column of atomdj in D; the cost function is (3)X−DA22=X−∑j=1Kdjαj22=X−∑j≠kdjαj−dkαk22,(4)Ek=X−∑j≠kdjαj,where Ek is the error matrix, which represents the errors that other atoms than the k column have on the image. Then, equation (3) can be expressed as(5)X−DA22=Ek−∑j=1Kdkαk22.For the above formula, if the singular value decomposition value ofEk is directly used to update dj and αj, the updated αj value will not be sparse, so transform Ej and αj, and only retain the non-zero values in αj:(6)ωj=p1≤p≤P,αj≠0,j=1,2,…,K.Select all columns in the error matrixEk that satisfy the set ωj to form EjR, and then perform singular value decomposition:(7)EjR=UΔVT.The updated value is(8)dj=μ1j,αjR=σ1jν1j.Among them,σ1j is the largest singular value of EjR, and μ1j and ν1j are the first column vectors of Uj and Vj, respectively. After traversing each column in the dictionary, the optimized dictionary is obtained. The process of K-SVD algorithm is shown in Table 1.Table 1
K-SVD algorithm steps.
Input: pending signalX, initialize dictionary D0 to DCT dictionaryProcess: step (1): normalize the initialization dictionary D0; set the number of iterations: k=1step (2): whilek<K dostep (2.1): fix the dictionary and findωj, Ωj and EjRstep (2.2): dictionary update using formula (8)step (2.3): get the dictionary afterk iterations Dkstep (3): end whileOutput: updated dictionaryDk+1


## 3.2. Image Defog Reconstruction

Signal sparse representation also involves another key issue, namely, sparse coding. The so-called sparse coding refers to the process of solving the sparse coefficientα when the overcomplete dictionary D is known. The solution of this coefficient is an NP-hard problem. The common methods to solve the sparse coefficient include MP algorithm (Matching Pursuit algorithm, MP), OMP algorithm (Orthogonal Matching Pursuit algorithm, OMP), and SOMP algorithm (Simultaneous Orthogonal Matching Pursuit algorithm, SOMP). Atoms selected the OMP algorithm are orthogonal, which ensure that the signal and the selected atoms meet the orthogonal condition at each step of the iteration. Meanwhile, selected atoms cannot be selected again in the next iteration, which greatly reduces algorithm processing time and the number of atoms to decompose the original signal. In view of the above advantages, this paper uses the orthogonal matching pursuit algorithm [24] to solve the sparse coefficients.For an image with fog, in the HSI color space, the fog is mainly distributed in theI-component. This paper reconstructed the I-component to improve the image brightness to achieve the purpose of fog removal. After dictionary training, a dictionary of the I-component of the foggy image and the I-component of the nonfoggy image is obtained, and the trained dictionary is used to reconstruct the foggy image I-component. The process is shown in Figure 5. First, feature extraction is performed on the I-component of the foggy image to obtain image feature blocks, and then OMP algorithm is used to obtain the sparse representation coefficient α in combination with the trained dictionary of the foggy image. The dictionary of the I-component of the fog-free image is brought into equation (1) to obtain the wavelet domain features of the reconstructed image I-component, and finally the inverse wavelet transform is used to obtain the reconstructed image I-component.Figure 5
I-component defog reconstruction process of foggy image.In order to improve the image saturation and make the image color more vivid, it is necessary to stretch the saturation. Due to uneven illumination at different locations of the same image, different regions have different saturations. In order to achieve different stretching effects under different lighting conditions, this paper uses a piecewise function to perform nonlinear stretch. Assuming that the minimum brightness value of the saturation component of the foggy image isL and the maximum brightness value is H, the interval L,H is evenly divided into three segments, and the length of each segment is c=H−L/3, using the following formula for saturation stretching:(9)Sx=2×S′xL≤x<L+c,2.5×S′xL+c≤x<L+2c,3.5×S′xL+2c≤x<H.In the formula,S′x represents the value of the S-component of the original image and Sxrepresents the value of the S-component after stretching.In the HSI color space, theH-component determines the essence of the color of an object. It is determined by the wavelength reflected by the object, and different wavelengths reflect different colors. For a color, the hue of the image before and after defogging is approximately invariant. Therefore, this article does not process the H-component to keep the original hue. Combine the processed S-component, I-component, and original H-component and convert to RGB space to get the final defogging image.


## 4. Experiment and Result Analysis

### 4.1. Experimental Platform and Data Set

The experiment in this paper is carried out on Windows 7 operating system and MATLAB 2017a development platform, using the D-HAZY data set as the training set. The data set includes 80 RGB foggy and non-foggy images in indoor and outdoor scenes, some of which are shown in Figure6. In order to improve the speed of the algorithm, the size of the image is standardized to 512 ∗ 512.Figure 6
Some images in the training set: (a) foggy images and (b) fog-free images.
(a)(b)


### 4.2. Experiment and Result Analysis

The five images in the data set were compared with literature [5], literature [6], literature [10], and the algorithm of this paper. The results are shown in Table 2.Table 2
Comparison of defogging results with other algorithms.
Foggy imagesReference [5] algorithmReference [6] algorithmReference [10] algorithmOur algorithmIt can be seen from Table2 that, after [5] algorithm processing, the image contrast is improved, the color is brighter, and the fog removal is more thorough, but the fourth image is overenhanced, resulting in white light on the wall area. After the algorithm [6] processed the image, the whole image appeared blue, the contrast was reduced, the color was dark, and there was a color disorder. For example, the first and second images were severely distorted due to excessive enhancement. The image processed by the algorithm in [10] can achieve good results. The overall color of the image is natural, but part of the image is not completely dehazed. For example, in the first image, there is a layer of fog in the distant trees. After the algorithm is processed in this paper, the effect of defogging is better for different images, the brightness of the image is moderate, and it is full of layering. For images that are not well-processed by other algorithms, such as the second and third images, the algorithm does not appear dark or distorted.In order to objectively compare several algorithms, this paper uses the blind contrast enhancement evaluation method, using three indicatorse, r¯, σ, SSIM (structural similarity, SSIM), and PSNR (peak signal-to-noise ratio, PSNR) to compare the image defogging effect, where e is the ratio of the newly added visible edges of the restored image, r¯ is the ratio of the average gradient, and σ is the percentage of saturated pixels (pure black or pure white) in the restored image, and their calculation method is as follows [25]:(10)e=nr−n0n0,r¯=exp1nr∑Pi∈ϕrlogri,σ=nsdimx×dimy,where n0 represents the number of visible edges in the original image Ix, nr represents the number of visible edges in the defog image Jx, ϕr is the set of visible edges in the fog-free image Jx, and Pi is the i pixel of the visible edges in the fog-free image. ri is the ratio of the gradient of the non-foggy image Jx and the foggy image Ix at Pi, ns is the number of pure black or pure white pixels, and dimx and dimy represent the width and height of the image, respectively.In general, whene, r¯, SSIM, and PSNR are relatively large and the σ value is relatively small, it means that the image has good dehazing effect. The objective evaluation results of the defog quality of the five images in Table 2 are shown in Table 3. It can be seen that the percentage of saturated pixels of the image processed by the algorithm in this paper is significantly lower than that of the other three algorithms, which is not much different from the algorithm in [10]; the newly added visible edge ratio is slightly lower than the other three algorithms, and SSIM and PSNR values are higher than the other three algorithms. From the average point of view, the e and r¯ values of the algorithm in this paper are slightly lower than those of the other three algorithms, but the σ values are significantly better than other algorithms. The PSNR value is significantly higher than the other three algorithms.Table 3
Objective evaluation of image quality.
Defog imageDehazing algorithmer¯σSSIMPSNRFirst imageReference [5]0.00581.72311.57320.876520.3072Reference [6]0.21041.31370.50240.721414.4050Reference [10]0.03541.54050.34060.845218.0232Our algorithm0.01371.47380.02970.968532.0796Second imageReference [5]0.62652.00121.56580.704316.1828Reference [6]0.75271.64740.12830.636711.7532Reference [10]0.59802.07040.13860.778916.8623Our algorithm0.69362.25980.00040.890620.1899Third imageReference [5]2.59112.22081.51000.548513.8240Reference [6]2.72392.17150.05160.638913.9329Reference [10]1.99472.66080.01500.857820.6405Our algorithm1.73332.52350.00030.524818.7909Fourth imageReference [5]1.76112.42181.75460.626913.8187Reference [6]1.94081.66570.46370.552210.9472Reference [10]1.91611.27141.70760.417311.2976Our algorithm0.91781.50660.00050.866919.5566Fifth imageReference [5]0.97542.09111.57230.690715.3297Reference [6]1.14651.80620.26790.614111.7734Reference [10]0.92762.32400.19360.802717.2055Our algorithm1.57581.53870.00050.729819.5380Mean of five imagesReference [5]1.19202.09161.59510.689415.8925Reference [6]1.35481.72090.28280.632712.5623Reference [10]1.09441.97340.479110.740416.8058Our algorithm0.98681.86050.00630.796122.0310


## 4.1. Experimental Platform and Data Set

The experiment in this paper is carried out on Windows 7 operating system and MATLAB 2017a development platform, using the D-HAZY data set as the training set. The data set includes 80 RGB foggy and non-foggy images in indoor and outdoor scenes, some of which are shown in Figure6. In order to improve the speed of the algorithm, the size of the image is standardized to 512 ∗ 512.Figure 6
Some images in the training set: (a) foggy images and (b) fog-free images.
(a)(b)


## 4.2. Experiment and Result Analysis

The five images in the data set were compared with literature [5], literature [6], literature [10], and the algorithm of this paper. The results are shown in Table 2.Table 2
Comparison of defogging results with other algorithms.
Foggy imagesReference [5] algorithmReference [6] algorithmReference [10] algorithmOur algorithmIt can be seen from Table2 that, after [5] algorithm processing, the image contrast is improved, the color is brighter, and the fog removal is more thorough, but the fourth image is overenhanced, resulting in white light on the wall area. After the algorithm [6] processed the image, the whole image appeared blue, the contrast was reduced, the color was dark, and there was a color disorder. For example, the first and second images were severely distorted due to excessive enhancement. The image processed by the algorithm in [10] can achieve good results. The overall color of the image is natural, but part of the image is not completely dehazed. For example, in the first image, there is a layer of fog in the distant trees. After the algorithm is processed in this paper, the effect of defogging is better for different images, the brightness of the image is moderate, and it is full of layering. For images that are not well-processed by other algorithms, such as the second and third images, the algorithm does not appear dark or distorted.In order to objectively compare several algorithms, this paper uses the blind contrast enhancement evaluation method, using three indicatorse, r¯, σ, SSIM (structural similarity, SSIM), and PSNR (peak signal-to-noise ratio, PSNR) to compare the image defogging effect, where e is the ratio of the newly added visible edges of the restored image, r¯ is the ratio of the average gradient, and σ is the percentage of saturated pixels (pure black or pure white) in the restored image, and their calculation method is as follows [25]:(10)e=nr−n0n0,r¯=exp1nr∑Pi∈ϕrlogri,σ=nsdimx×dimy,where n0 represents the number of visible edges in the original image Ix, nr represents the number of visible edges in the defog image Jx, ϕr is the set of visible edges in the fog-free image Jx, and Pi is the i pixel of the visible edges in the fog-free image. ri is the ratio of the gradient of the non-foggy image Jx and the foggy image Ix at Pi, ns is the number of pure black or pure white pixels, and dimx and dimy represent the width and height of the image, respectively.In general, whene, r¯, SSIM, and PSNR are relatively large and the σ value is relatively small, it means that the image has good dehazing effect. The objective evaluation results of the defog quality of the five images in Table 2 are shown in Table 3. It can be seen that the percentage of saturated pixels of the image processed by the algorithm in this paper is significantly lower than that of the other three algorithms, which is not much different from the algorithm in [10]; the newly added visible edge ratio is slightly lower than the other three algorithms, and SSIM and PSNR values are higher than the other three algorithms. From the average point of view, the e and r¯ values of the algorithm in this paper are slightly lower than those of the other three algorithms, but the σ values are significantly better than other algorithms. The PSNR value is significantly higher than the other three algorithms.Table 3
Objective evaluation of image quality.
Defog imageDehazing algorithmer¯σSSIMPSNRFirst imageReference [5]0.00581.72311.57320.876520.3072Reference [6]0.21041.31370.50240.721414.4050Reference [10]0.03541.54050.34060.845218.0232Our algorithm0.01371.47380.02970.968532.0796Second imageReference [5]0.62652.00121.56580.704316.1828Reference [6]0.75271.64740.12830.636711.7532Reference [10]0.59802.07040.13860.778916.8623Our algorithm0.69362.25980.00040.890620.1899Third imageReference [5]2.59112.22081.51000.548513.8240Reference [6]2.72392.17150.05160.638913.9329Reference [10]1.99472.66080.01500.857820.6405Our algorithm1.73332.52350.00030.524818.7909Fourth imageReference [5]1.76112.42181.75460.626913.8187Reference [6]1.94081.66570.46370.552210.9472Reference [10]1.91611.27141.70760.417311.2976Our algorithm0.91781.50660.00050.866919.5566Fifth imageReference [5]0.97542.09111.57230.690715.3297Reference [6]1.14651.80620.26790.614111.7734Reference [10]0.92762.32400.19360.802717.2055Our algorithm1.57581.53870.00050.729819.5380Mean of five imagesReference [5]1.19202.09161.59510.689415.8925Reference [6]1.35481.72090.28280.632712.5623Reference [10]1.09441.97340.479110.740416.8058Our algorithm0.98681.86050.00630.796122.0310


## 5. Conclusions

Based on the image sparse representation theory, this paper proposes a new image defogging algorithm. The algorithm uses two-stage wavelet transform to extract image features for the I-component of the image, uses the extracted features for dictionary training in the sparse domain, learns the sparse features of the fog-free image, reconstructs the I-component of the fog image, andapplies the nonlinear stretching method to increase image brightness. Experimental results show that the algorithm can effectively improve the contrast of the image and improve the visual effect of the image. Compared with the common defogging algorithm, the percentage of saturated pixels, SSIM, and PSNR in the image is better than the comparison algorithm. Although the algorithm in this paper has achieved good results, it is relatively simple in feature extraction, resulting in partial image dehazing and color cast problems. The next step will be to study how to extract more useful features for dictionary training and improve the algorithm effect.



---

*Source: 6835367-2020-07-11.xml*