The maximum distance (MaxD) algorithm is an unsupervised endmember extraction method used to identify pure endmember spectra in a hyperspectral image. This post presents the mathematical principle of the MaxD algorithm and a MATLAB implementation.
Algorithm Principle
The MaxD algorithm is based on the following key ideas:
Maximum-distance criterion: Endmember spectra correspond to the sample points that lie farthest apart in feature space. This is because an endmember spectrum represents the spectrum of a pure surface material, whereas a mixed spectrum lies between endmember spectra.
Sequential extraction: The algorithm extracts all endmember spectra one by one, in descending order of the distance between each endmember spectrum and the other spectra.
Vector projection: When a new endmember spectrum is extracted, linear combinations of the known endmember spectra are used to construct a vector space. The new endmember spectrum is the one with the largest projection length in the complementary subspace of that space.
Given hyperspectral data with \(N\) bands, \(\mathbf{X} = \{\mathbf{x}_1, \mathbf{x}_2, \ldots, \mathbf{x}_n\}\), where \(\mathbf{x}_i \in \mathbb{R}^N\) is the \(i\)-th sample spectrum, the goal is to find \(p\) endmember spectra \(\mathbf{E} = \{\mathbf{e}_1, \mathbf{e}_2, \ldots, \mathbf{e}_p\}\). The steps are as follows:
- Initialization: Compute the norm \(\|\mathbf{x}_i\|_2\) of every sample spectrum, and select the spectrum with the largest norm as the first endmember spectrum \(\mathbf{e}_1\):
- Extract the second endmember spectrum: For each remaining spectrum \(\mathbf{x}_j (j \neq i_1)\), compute its distance to the first endmember spectrum \(\mathbf{e}_1\), \(d_j = \|\mathbf{x}_j - \mathbf{e}_1\|_2\), and select the spectrum with the largest distance as the second endmember spectrum \(\mathbf{e}_2\):
- Extract the third endmember spectrum: For each remaining spectrum \(\mathbf{x}_k (k \neq i_1, i_2)\), compute its projection length \(d_k^{(3)}\) in the complementary subspace of the plane spanned by \(\mathbf{e}_1\) and \(\mathbf{e}_2\), and select the spectrum with the largest projection length as the third endmember spectrum \(\mathbf{e}_3\):
- Extract the fourth endmember spectrum: For each remaining spectrum \(\mathbf{x}_l (l \neq i_1, i_2, i_3)\), compute its projection length \(d_l^{(4)}\) in the complementary subspace of the space spanned by \(\mathbf{e}_1\), \(\mathbf{e}_2\), and \(\mathbf{e}_3\), and select the spectrum with the largest projection length as the fourth endmember spectrum \(\mathbf{e}_4\):
- Extract the remaining endmember spectra: For the \(m\)-th endmember spectrum \((m > 4)\), repeat the previous step, but use the first \(m-1\) endmember spectra to compute the complementary subspace and the projection length. The algorithm continues until no new endmember spectrum can be extracted.
Through the steps above, the MaxD algorithm extracts every endmember spectrum from the hyperspectral data one by one. Note that the algorithm is insensitive to the order of the initial spectra, but the number of endmembers \(p\) must be specified in advance.
MATLAB Implementation
The following MATLAB code implements the MaxD algorithm:
| |
The inputs of this function are:
X: the hyperspectral data matrix, with one spectral sample per rownum_End: the number of endmembers to extract
The output is a matrix Endmember, with one extracted endmember spectrum per column.
The code follows the algorithm steps described above. Notably, when extracting the fourth and subsequent endmembers, the code computes the null space of a matrix in order to obtain a basis vector of the complementary subspace.
With this MATLAB function, the MaxD algorithm can be applied directly to real hyperspectral image analysis to recover the endmember components of the samples.
Overall, maximum distance (MaxD) endmember extraction is an important unsupervised method. Its mathematics is straightforward and it is easy to implement. It is widely used in hyperspectral remote sensing, mineral analysis, and related fields.
