## 3 Compression of Hyperspectral Data  
Compression algorithms that provide lossless or near-lossless quality are generally required to preserve the hyperspectral imagery often acquired at high costs and used in delicate tasks (for instance classification or target detection). Low complexity compression algorithms may allow on-board implementation with limited hardware capacities, therefore it is often desirable to use this typology of algorithms, for example when the compression process has to be carried out in an airplane or on board a satellite, before transmitting data to the base. Hyperspectral data presents two forms of correlation:  
* _spatial correlation_: very often adjacent locations are made of the same material;
* _spectral correlation_: one band can be fully or partially predicted from other bands. Figure 6: Yellowstone Calibrated Scene 18 on Google Android SDK Emulator in portrait mode and landscape mode with a HVGA screen resolution. Spectral correlation is much stronger than spatial correlation. For this reason standard image compression techniques, as for instance the spatial predictor of LOCO-I used in JPEG-LS [17], fail on this kind of data. Spectral-oriented Least Squares (SLSQ) [1; 2; 3; 4; 5; 6; 7] is a lossless hyperspectral image compressor that uses least squares to optimize the predictor for each pixel and each band. As far as we know, SLSQ is the current state-of-the-art in lossless hyperspectral image compression. Others approaches are, for example, EMPORDA [18] and a low-complexity and high-efficiency lossy-to-lossless coding scheme proposed in [19]. The SLSQ approach is based on an optimized linear predictor. SLSQ determines for each sample the coefficients of a linear predictor that is optimal with respect to a three dimensional subset of the past data. The intra-band distance is defined as:  
\[d_{2D}(x_{m,n,k},x_{p,q,k}) = \sqrt{\left(m-p\right)^{2}+\left(n-q\right)^{2}}\]  
The inter-band distance is defined as:  
\[d_{3D}(x_{m,n,i},x_{p,q,i}) = \begin{cases}d_{2D}(x_{m,n,i},x_{p,q,i})&\text{if}\;\;j=i\\ \sqrt{\frac{1}{4}+\left(m-p\right)^{2}+\left(n-q\right)^{2}}&\text{if}\;\;j=i- 1\end{cases} \]  
The enumerations obtained by using these distances allow the indexing of the pixels from the current pixel. Similar to the Euclidean distance, the intra-band distance defines the distance of the current pixel with respect to other pixels in the current bands. The inter-band distance defines the distance of the current pixel with respect to other pixels in the current band and in the previous one. When \(i=j\) the \(d_{3D}\) distance is the same of the \(d_{2D}\) distance. The pixels that have the same distance are considered in clockwise order for both types of distance. Figure 6(a) shows the resulting context for intra-band enumeration; Figure 6(b) shows the resulting context for inter-band enumeration. Figure 7: The resulting context for intra-band and inter-band enumerations. As we can see from Figure 7b, the indices of the pixels of the \((k-1)\)-th band are larger than the indices of these pixels of the \(k\)-th band. This happens because in definition (2) of the inter-band distance the term \(\
icefrac{{1}}{{4}}\) is present. In the following, \(x(i)\) denotes the \(i\)-th pixel of the intra-band context of the current pixel. \(x(i,j)\) denotes the \(j\)-th pixel in the inter-band context of \(x(i)\). The \(N\)-th order prediction of the current pixel (denoted by \(x(0,0)\)) is computed as:  
\[\hat{x}(0,0)=\sum_{j=1}^{N}\alpha_{j}\cdot x(0,j)\]  
The coefficients \(a_{0}=[\alpha_{1},\,\ldots,\,\alpha_{\mathrm{N}}]^{t}\) minimize the energy of the prediction error, defined as:  
\[P=\sum_{i=1}^{M}\left(x(i,0)-\hat{x}(i,0)\right)^{2}\]  
We can write \(P\), using matrix notation, as:  
\[P=(\mathbf{C}\alpha-\mathbf{X})^{t}\cdot(\mathbf{C}\alpha-\mathbf{X})\]  
where,  
\[\mathbf{C}= \begin{bmatrix}x(1,1)&\cdots&x(1,N)\\ \vdots&\ddots&\vdots\\ x(M,1)&\cdots&x(M,N)\end{bmatrix} \hskip 28.452756 pt\mathbf{X}= \begin{bmatrix}x(1,0) \\ \vdots\\ x(M,0)\end{bmatrix}