# Rain Removal of Single Image Based on Directional Gradient Priors
## 3 Proposed Deraining Method
### Proposed Model
#### 3.2.3 Solution for the Proposed Model  
In the process of solving the rain removal model, it is necessary to provide a priori supplementary information for the model, such as \(\Phi(B)\) and \(\Psi(R)\) in Equation (3), which are used to regularize the two separation layers: the background layer and the rain layer, respectively. The rain removal model defined in this paper is shown in Equation (4), which is solved by the alternating iteration method to obtain the accurate rain layer and the background layer. To solve the model (4), we need to decompose the rain image into the initial rain layer and background layer (no rain layer). The process is described as follows. First, by considering that the main direction of rain streaks is mainly vertical and reflected in the horizontal gradient, two horizontal gradient filters are selected as second-order gradient operators to filter the rain image to obtain the background layer (i.e., the rainless image). Then, the initial rain layer is obtained by subtracting the background layer from the rain image and then employed to initialize the multi-scale dictionaries. Next, ADMM method is utilized to update the dictionaries and coefficients of convolutional sparse coding as well as the background layer. The detailed procedure of the proposed method is described in Algorithm 1. For the objective function in Equation (4), we rewrite the convolution in a multiplication form, and the new function has the following form:  
\[\min_{\{b,\,r\}}\left\{ \begin{array}{l}||y-b-r||_{2}^{2}+\alpha\sum\limits_{ i=1}^{M}||F_{B,\,i}b||_{1}\\ +\beta_{1}||\
abla_{y}r||_{1}+\beta_{2}||\
abla_{x}(\sum\limits_{j=1}^{N}F_{R, \,j}m_{j}-r)||_{1}+\beta_{3}\sum\limits_{j=1}^{N}||m_{j}||_{1}\end{array} \right\} \tag{5}\]  
where \(y\), \(b\), \(r\), and \(m_{j}\) are the vectorization of rain image \(Y\), background layer \(B\), rainy layer \(R\), and feature map \(M_{j}\), respectively. We define \(F_{B,\,i}\) and \(F_{R,\,j}\) as the corresponding block circulants with circulant block matrices of filters \(f_{B,\ i}\) and \(f_{R,\ i}\), and the solution details of the two variable sub-problems are as follows. \begin{tabular}{l} \hline \hline Initialization: Rain image \(Y\) and regularization parameter. \\ Output: Background image \(B\) and rain layer \(R\). \\ Initialize multi-scale dictionaries \(\left\{f_{R,i}\right\}_{j=1,\ldots,N}\) by filtering the input rain image; \\ Outer loop: iteration \(t=1\) to \(T\) \\
1. Update the background image \(b_{k}\) by convolutional coding of the two horizontal filters by \\ Equation (9); \\
2. Inner loop (update the rain layer \(R\)): \\ for each iteration \(j=1\) to \(J\) do \\ (a) Update the sparse coding \(m_{j}^{k}\) by Equation (15) using ADMM operation; \\ (b) The obtained \(m_{j}^{k}\) and learned multiple dictionaries are used to solve the sparse \\ reconstruction of \(r^{\prime}=\sum\limits_{j=1}^{N}F_{R,j}m_{j}\); \\ (c) Update the constrained rain layer \(r\) using Equation (18); \\
3. Update the multi-scale dictionary \(\left\{f_{R,j}\right\}_{j=1,\ldots,N}\) through a sparse coefficient and rain \\ layer image using Equation (12). \\ \hline \hline \end{tabular}   
\(b-\)**Subproblem**  
Two horizontal gradient filters are used as a sparse dictionary during the convolution sparse coding for the background layer, which can be solved by adding a prior term [14]. The initialization of the rain layer \(R_{0}=0\) is a fixed \(r\) to solve the algorithm as follows:  
\[\min_{b}||y-b-r||_{2}^{2}+\alpha\sum\limits_{i=1}^{M}||F_{B,i}b||_{1} \tag{6}\]  
During the background layer optimization, we set \(x=y-r\) as a fixed value and introduce the group of auxiliary variables \(\left\{s_{i}=F_{B,i}b\right\}_{i=1,\ldots,M}\).