# Rain Removal of Single Image Based on Directional Gradient Priors
## 3 Proposed Deraining Method
### Proposed Model  
Single image layer separation is an ill-posed problem. To solve this problem, [PERSON] et al. [12] proposed a rain removal method to obtain rainless images by maximizing the joint probability of the background layer and the rain layer using the maximum a posteriori probability (MAP). In other words, it maximizes \(P(B,\ R|Y)\propto p(Y|B,\ R)\bullet p(B)\bullet p(R)\) under the assumption that the two layers, \(B\) and \(R\), are independent. The energy minimization function of the separation of the rain layer and the background layer is defined as follows:  
\[\min_{B,\ R}||Y-B-R||_{F}^{2}+\Phi(B)+\Psi(R)\ \ s.t.\ \forall i0\leq B_{i},R_{i} \leq Y_{i} \tag{3}\]  
where \(||\bullet||_{F}\) represents the Frobenius-norm, and \(i\) is the pixel index. \(\Phi(B)\) and \(\Psi(R)\) are designated as the prior terms imposed on \(B\) and \(R\), respectively. The inequality constraints ensure that the gray values of the desired \(B\) and \(R\) are positive and are less than those of the rain image. For the solution to the rain removal, only when accurate prior information is considered can an accurate closed solution be obtained.  
However, most existing models ignore the influence of light, wind, and other environmental factors on the rain information in an image. As a result of these effects, the shape of the rain streaks, such as the direction, width, and length, will vary between the close and far distances. Therefore, if the influence of the environment in real rain images is ignored,  
the falling direction of rain usually deviates from its main direction (i.e., the \(y\)-direction). By comparing the enlarged area of Figure 1f with that of Figure 1d, it is obvious that the gradient values in the \(y\)-direction are also affected by the rain information, but the influence is small. Therefore, it can be inferred that the gradient information along the \(y\)-direction of the rain layer should be sparse.  
On the basis of the above analysis, aiming at the sparsity of gradient information in the \(y\)-direction, we directly construct a prior constraint to constrain the rain layer by using the \(y\)-direction gradient of the rain layer as the third regularization term in Equation (4). Considering the influence of the scene depth, the width of the rain streaks is different. Therefore, to better detect the rain streaks, we propose sparse coding based on multi-scale dictionaries to reconstruct the rain layer, which is employed to constrain the rain layer obtained in each iteration. If the rain layer obtained by each iteration is close to the sparse reconstructed rain layer, then the \(x\)-direction gradient of the difference between these two rain layers is sparse. In other words, the rain streaks detected in the main direction of rain falling is more accurate. Therefore, we construct an \(x\)-direction gradient sparse prior regulation term to constrain the rain layer by using a sparse reconstruction rain layer in each iteration as the fourth regularization term in Equation (4).  
At the same time, the coefficients of the convolution sparse coding are constrained to ensure their sparsity as the fifth term in Equation (4). To solve the model more accurately, the singular value decomposition (SVD) is used to initialize multi-scale dictionaries for  
Figure 1: **(a,b)** are the rainy image and rainless image, respectively. **(c,d)** are the gradient maps of the rainless image along the \(x\) and \(y\) directions, respectively. **(e,f)** are the gradient maps of corresponding rainy image along the \(x\) and \(y\) directions, respectively.  
the sparse coding. The initialization of multi-scale dictionaries is described in detail below. During the process of solving the rain layer and the background layer, the multi-scale dictionaries will be updated concurrently.