# Pansharpening by Complementing Compressed Sensing with Spectral Correction
## 2 Materials and Methods
### Dictionary Learning  
The high-resolution dictionary and the low-resolution dictionary were constructed via Equation (7) using the corresponding pair of training images. These are shown as Equation (8).  
\[X^{high}=D^{high}\beta, \tag{7}\]  
\[X=D\beta, \tag{8}\]  
where \(\beta\in\mathbb{R}^{N_{d}\times N_{t}}\) represents the sparse representation and \(X=\left[\begin{array}{c}X^{high}\\ X^{low}\end{array}\right]\), \(D=\left[\begin{array}{c}D^{high}\\ D^{low}\end{array}\right]\). The dictionary was obtained by solving the optimization problem of Equation (9), where the regularization conditions and constraints are added to Equation (8).  
\[\underset{D,\beta}{\text{argmin}}\frac{1}{2}\|X-D\beta\|_{2}^{2}+\lambda\| \beta\|_{1}\text{ s.t. }\|d_{i}\|_{2}\leq 1,\ i=1,2,\cdots,N_{t}, \tag{9}\]  
where \(\lambda\) is the normalization parameter.  
The training data used for dictionary learning were training PAN images for the high-resolution dictionary and the feature map obtained from its corresponding low-resolution training PAN image for the low-resolution dictionary as shown in Table 1. \(X^{high}\) and \(X^{low}\) were obtained from a high-resolution training PAN image and its corresponding low-resolution training PAN image. Given a high-resolution training PAN image, it was divided into regions of size \(p\times p\). The high-resolution patch \(x_{i}^{high}\) was then obtained for each region by \(x_{i}^{high}=x_{raw,j}^{high}-\overline{x}_{raw,j}^{high}\), where \(x_{raw,j}^{high}\) is the \(p\times p\) image and \(\overline{x}_{raw,j}^{high}\) is the mean intensity value of \(x_{raw,i}^{high}\), and \(X^{high}=\left\{x_{1}^{high},\ \cdots,\ x_{N_{t}}^{high}\right\}\) is obtained. Given the low-resolution training PAN image, the feature map was calculated with four filters of the first derivative and the second derivative defined by  
\[F_{1}=[-1,0,1],\ F_{2}=F_{1}^{T},\ F_{3}=[1,0,-2,0,1],\ F_{4}=F_{3}^{T},\]  
where \(T\) indicates transposition. The feature map was divided into patches of \(p\times p\), and each patch was normalized. Since the feature map was calculated from the entire image, each patch contained the information of its adjacent patch. By arranging the normalized feature map in the raster scan order for each patch, \(X^{low}=\left\{x_{1}^{low},\ \cdots,\ x_{N_{t}}^{low}\right\}\), \(x_{i}^{low}=\left[\begin{array}{c}F_{1}(i)\\ F_{2}(i)\\ F_{3}(i)\\ F_{4}(i)\end{array}\right]\)\(i=1,2,\cdots,N_{t}\) was obtained.  
The algorithm of the dictionary learning is described as follows.  
1. [label=(0)]
2. Obtain \(X^{high}\) and \(X^{low}\) from the training data. Each column of \(X=\left[\begin{array}{c}X^{high}\\ X^{low}\end{array}\right]\) is then normalized.
3. Set the initial value of the dictionary \(D\). Random numbers that follow the Gaussian distribution with mean 0 and variance 1 are normalized for each patch region.  
3. Estimate the sparse representation \(\beta\) by solving the optimization problem of Equation (10) by fixing the dictionary \(D\). \[\beta=\underset{\beta}{\operatorname{argmin}}\frac{1}{2}\|X-D\beta\|_{2}^{2}+ \lambda\|\beta\|_{1}\] (10)
4. Estimate the dictionary \(D\) by solving the optimization problem of Equation (11) by fixing the sparse representation \(\beta\). \[D=\underset{D}{\operatorname{argmin}}\|X-D\beta\|_{2}^{2}\;s.t.\;\|d_{i}\|_{2} \leq 1,\;i=1,2,\cdots,N_{t}\] (11)
5. Steps (3) and (4) are repeated. (In the experiment, we repeated 40 times.)
6. The obtained dictionary \(D\) is normalized for each patch and used as the final trained dictionary \(D\).