# A Probabilistic Hyperspectral Imagery Restoration Method
## 4 Probabilistic LRMA Model for HSI Restoration
### Initialization of the Rank Number  
Though the above introduced probabilistic low-rank method can represent the complex noise with the mixture of Gaussian strategy, one of the most important parameters, rank number \(R\), has to be assigned manually. Fortunately, as we analyzed in Section 3, the number of endmembers \(n_{e}\) can be used to determine \(R\). Thus, we use an affine hull based method (named as GENE-AH [38]) to estimate the number of endmembers in this study, which can be used to initialize the rank number.  
Suppose HSI \(\mathbf{X}\in\mathbf{R}^{n_{b}\times n_{p}}\) has \(n_{p}\) pixels. Each pixel is denoted as \(\mathbf{x}_{n}\in\mathbf{R}^{n_{b}}\), where \(1\leq n\leq n_{p}\). It is assumed that the spectral of all pixels lie in an affine hull for GENE-AH method. We denote the estimated noise covariance matrix as \(\hat{\mathbf{D}}_{\text{N}_{\text{C}}}\). The parameter of affine set fitting parameter \((\hat{\mathbf{d}}_{A_{\text{f}}},\hat{\mathbf{C}}_{A_{\text{f}}})\) can be represented by  
\[\hat{\mathbf{d}}_{A_{\text{f}}}=\frac{1}{n_{p}}\!\sum_{n=1}^{n_{p}}\mathbf{x}_{ n},\ \hat{\mathbf{C}}_{A_{\text{f}}}=\Big{[}q_{1}^{(A_{\text{f}})}(\mathbf{U}_{A_{\text{f}}} \mathbf{U}_{A_{\text{f}}}\mathbf{}^{\text{T}}-n_{p}\hat{\mathbf{D}}_{\text{N}_{ \text{C}}}),\ldots,q_{N_{\text{max}-1}}^{(A_{\text{f}})}(\mathbf{U}_{A_{\text{f}}} \mathbf{U}_{A_{\text{f}}}\mathbf{}^{\text{T}}-n_{p}\hat{\mathbf{D}}_{\text{N}_{ \text{C}}})\Big{]}. \tag{17}\]\(\mathbf{U}_{A_{t}}=[\mathbf{x}_{1}-\mathbf{\hat{d}}_{A_{t}},\ldots,\mathbf{x}_{n_{ p}}-\mathbf{\hat{d}}_{A_{t}}]\in\mathbf{R}^{n_{b}\times n_{p}}\) is the mean removed data matrix, \(q_{i}^{(A_{t})}(\mathbf{U}_{A_{t}}\mathbf{U}_{A_{t}}^{\mathrm{T}}-n_{p} \mathbf{\hat{D}}_{\mathbf{N}_{c}})\) represents the unit-norm eigenvector related with the \(i\)-th principal eigenvalue of the matrix \((\mathbf{U}_{A_{t}}\mathbf{U}_{A_{t}}^{\mathrm{T}}-n_{p}\mathbf{\hat{D}}_{ \mathbf{N}_{c}})\), \(N_{\mathrm{max}}\) denotes the maximum number of endmembers.  
With above defined (\(\mathbf{\hat{d}}_{A_{t}}\mathbf{\hat{C}}_{A_{t}}\)), the method determines the number of endmembers as follows.  
Step 1: Calculate \(\mathbf{\hat{d}}_{A_{t}}\) and \(\mathbf{\hat{C}}_{A_{t}}\) from all \(n_{p}\) pixels in \(\mathbf{X}\).  
Step 2: Obtain the first pixel index \(u[1]\) from all pixels in \(\mathbf{X}\) using p-norm based pure pixel identification (TRI-P) method [38]. Then, normalize the corresponding pixel using \(\mathbf{\hat{d}}_{A_{t}}\) and \(\mathbf{\hat{C}}_{A_{t}}\).  
Step 3: Obtain the second pixel index \(u[2]\) from the remaining pixels in \(\mathbf{X}\) using p-norm based pure pixel identification (TRI-P) method [38]. Then, normalize the corresponding pixel using \(\mathbf{\hat{d}}_{A_{t}}\) and \(\mathbf{\hat{C}}_{A_{t}}\), and assemble all obtained normalized pixels into a new matrix.  
Step 4: Fit all obtained normalized pixels into affine hull model with a constraint least squares strategy. If the fitting error is larger than a predefined false alarm probability \(\boldsymbol{P}_{\mathrm{FA}}\), we sequentially repeat the same operation as Step 3 and Step 4 do to select the next pixel.  
Once the fitting error is smaller than \(\boldsymbol{P}_{\mathrm{FA}}\), the pixel selection process is stopped. The number of chosen pixels is exactly the number of endmembers. We refer the readers to [38] for details.