In hyperspectral image analysis, estimating the number of endmembers
is a crucial step that affects the accuracy and efficiency of subsequent
processing. This post introduces an eigenvalue thresholding approach for
estimating the number of endmembers in hyperspectral data through noise
whitening and eigenvalue analysis.
Noise Whitening of Hyperspectral Images
Let’s consider a hyperspectral image \(\mathbf{X} \in \mathbb{R}^{M \times B}\),
where \(M\) is the number of spatial
pixels and \(B\) is the number of
spectral bands. Each band can be represented as a column vector \(\mathbf{x}_i\) of \(\mathbf{X}\).
Noise whitening is the first step in preprocessing hyperspectral
data, aiming to reduce noise and facilitate endmember identification. To
achieve this, we first calculate the covariance matrix \(\mathbf{C}_x\) of the hyperspectral data,
defined as:
\[ \mathbf{C}_x = \operatorname{Cov}(\mathbf{X}) = \left[\begin{array}{ccc} \sigma\left(\mathbf{x}_{1}, \mathbf{x}_{1}\right) & \cdots & \sigma\left(\mathbf{x}_{1}, \mathbf{x}_{B}\right) \\ \vdots & \ddots & \vdots \\ \sigma\left(\mathbf{x}_{B}, \mathbf{x}_{1}\right) & \cdots & \sigma\left(\mathbf{x}_{B}, \mathbf{x}_{B}\right) \end{array}\right] \in \mathbb{R}^{B \times B} \]where \(\sigma\left(\mathbf{x}_{m}, \mathbf{x}_{k}\right)\) is the covariance between vectors \(\mathbf{x}_m\) and \(\mathbf{x}_k\), calculated as:
\[ \sigma\left(\mathbf{x}_{m}, \mathbf{x}_{k}\right) = \frac{1}{n-1} \sum_{i=1}^{n}\left(\mathbf{x}_{m i} - \bar{\mathbf{x}}_{m}\right)\left(\mathbf{x}_{k i} - \bar{\mathbf{x}}_{k}\right) \]Next, we compute the noise covariance matrix \(\mathbf{N}\) from \(\mathbf{C}_x\):
\[ \mathbf{N} = \operatorname{diag}\left(\frac{1}{\operatorname{Getdiag}(\mathbf{C}_x^{-1})}\right) \in \mathbb{R}^{B \times B} \]where \(\operatorname{Getdiag}(\cdot)\) extracts
the diagonal elements of a matrix, and \(\operatorname{diag}(\cdot)\) converts a
vector into a diagonal matrix.
With the noise covariance matrix \(\mathbf{N}\), we can calculate the whitened
noise matrix \(\mathbf{Y}\):
\[ \mathbf{Y} = \mathbf{X}\left(\left(\sqrt{\mathbf{N}}\right)^{-1}\right)^\top \]Eigenvalue Soft-Thresholding Algorithm
The whitened noise matrix \(\mathbf{Y}\) is used for endmember number
estimation. We first compute the auto-covariance matrix \(\mathbf{C}_y\) and the auto-correlation
matrix \(\mathbf{R}_y\) of \(\mathbf{Y}\):
\[ \mathbf{C}_y = \operatorname{Cov}(\mathbf{Y}) \in \mathbb{R}^{B \times B} \]\[ \mathbf{R}_y = E\left(\mathbf{Y} \mathbf{Y}^{T}\right) \in \mathbb{R}^{B \times B} \]where the elements \(\sigma\left(\mathbf{y}_{i}, \mathbf{y}_{j}\right)\) of \(\mathbf{C}_y\) and \(\rho(\mathbf{y}_i, \mathbf{y}_j)\) of \(\mathbf{R}_y\) are defined as:
\[ \rho(\mathbf{y}_i, \mathbf{y}_j) = \operatorname{corr}(\mathbf{y}_i, \mathbf{y}_j) = \frac{\operatorname{cov}(\mathbf{y}_i, \mathbf{y}_j)}{\sigma_Y \sigma_Y} \]Next, we compute the eigenvalues of these two matrices:
\[ \mathbf{\Sigma}_C = \operatorname{eig}(\mathbf{C}_y) \]\[ \mathbf{\Sigma}_R = \operatorname{eig}(\mathbf{R}_y) \]The eigenvalue matrices \(\mathbf{\Sigma}_C\) and \(\mathbf{\Sigma}_R\) contain the eigenvalues
of the auto-covariance and auto-correlation matrices, respectively. We
then calculate the variance \(\mathbf{D}\) between these eigenvalues:
\[ \mathbf{D} = \mathbf{\Sigma}_R - \mathbf{\Sigma}_C \]Subsequently, we estimate the noise variance \(\mathbf{V}\):
\[ \mathbf{V} = \frac{2}{M}\left(\mathbf{\Sigma}_R^2 + \mathbf{\Sigma}_C^2\right) \]Finally, we compute the eigenvalue threshold \(\operatorname{gate}\) based on the noise
variance \(\mathbf{V}\):
\[ \operatorname{gate} = \sqrt{2 \times \mathbf{V}} \]Using the eigenvalue soft-thresholding algorithm, we can obtain the
estimated number of endmembers \(I\):
\[ I = \sum_{i = 1}^B (\mathbf{D}_{ii} > \operatorname{gate}) \]