*2.3. HyperLCA Transform*

The HyperLCA transform sequentially selects the most different pixels of the hyperspectral data set. The set of selected pixels is then used for projecting the hyperspectral image, obtaining a

spectral decorrelated and compressed version of the data. The compression achieved within this process directly depends on the number of selected pixels. Selecting more pixels provides better decompressed images but lower compression ratios, understanding the compression ratio as the relation between the size of the real image and the compressed one (the higher, the better). Since the pixels are sequentially selected, the sooner the algorithm stops, the higher the compression ratio will be. The proposed method takes advantage of this fact for allowing the user to determine a minimum desired compression ratio, which is used for calculating the maximum number of pixels to be extracted. By doing so, the proposed method ensures the achievement of a compression ratio that will always be higher than the compression ratio specified by the user.

Moreover, each time that a pixel is selected, the information of the image that can be represented using the selected pixel is subtracted from the image. Accordingly, the remaining information directly corresponds with the information that would be lost if no more pixels were selected. This can be used for stopping the sequential extraction of pixels once a specific accuracy level is achieved in the spectral transform step, according to any desired evaluation measurement, without reaching the maximum number of pixels to be extracted, as described in Section 2.8. This way, the proposed method guarantees that if an accurate enough compression of the hyperspectral image is obtained before extracting all the required pixels according to the minimum compression ratio specified by the user, the algorithm will stop, providing a higher compression ratio at a lower computational burden.

Finally, both the extracted pixels as well as information of the image compressed as a linear combination of these pixels are set as the outputs of the HyperLCA transform. This is due to the fact that both are needed for recovering the original hyperspectral image.

The pseudocode that describes the HyperLCA transform for spectrally decorrelating and reducing the hyperspectral data set is presented in Algorithm 1, where matrix *M* contains *Np* real hyperspectral pixels [*<sup>r</sup>*1,*r*2, ...,*rNp* ], placed in columns. Each of these pixels is a vector of *Nb* components, *Nb* being the number of bands of the hyperspectral image. The input parameter *p*max, defined in Section 2.1, determines the maximum number of pixels to be extracted. The input vector *c* corresponds with the average pixel of the image, also called centroid, in integer values, as described in Section 2.2. Additionally, the set of vectors *P* = [*p*1, *p*2, ..., *pp*max ] and *V* = [*<sup>v</sup>*1, *v*2, ..., *vp*max ] contain the vectors that are extracted by the HyperLCA transform as the compressed information. Specifically, *P* will store the *p*max real hyperspectral pixels selected by the HyperLCA transform as the most different pixels of the data set (*Pixels*), and vectors contained in *V* will store the information of the image that can be represented by the extracted pixels (*V vectors*). Each of these vectors has *Np* components, one per pixel. These vectors are used by the inverse transform for recovering the real image.

First of all, the hyperspectral data, *M*, is centered and stored in *Mc*, in line 3. This is done by subtracting the centroid pixel to all the pixels of the image. The amount of information present in matrix *Mc*decreasesasmorepixelsareextracted. However,therealimagematrix *M* isnotmodified.

Secondly, the pixels are sequentially extracted in lines 4–15. In this process, the brightness of each pixel within the *Mc* image is first calculated in lines 5–7. The extracted pixels are selected as those pixels from *M* that correspond with the highest brightness in matrix *Mc*, as shown in line 9. Then, the orthogonal projection vectors *q* and *u* are accordingly obtained as shown in lines 10 and 11.

After that, the information that can be spanned by the defined orthogonal vectors *u* and *q* is stored in the projected image vector *vp* and subtracted from the *Mc* image in lines 12–13. The process finishes when the *p*max pixels *pj* have been selected and the information of the image that they can span has been stored in the *p*max *vj* vectors, or if an additional stopping condition is previously accomplished, as described in Section 2.8.

This methodology provides one important advantage for compressing and decompressing images for hyperspectral imaging applications. As described in lines 8 and 9 of Algorithm 1, the pixels to be transferred are selected as those with the largest amount of remaining information. By doing this, it is guaranteed that the most different pixels within the data set are perfectly preserved through the spectral decorrelation and compression steps of the compression–decompression process. This fact makes this compression approach especially suitable for applications in which some pixels may be very different from the rest of the pixels, such as anomaly detection, target detection, tracking or classification.

#### **Algorithm 1:** HyperLCA transform.

**Inputs:** *M* = [*<sup>r</sup>*1,*r*2, ...,*rNp* ], *p*max, *c* **1** *P* = [*p*1, *p*2, ..., *pp*max ]; {Extracted pixels.} **2** *V* = [*<sup>v</sup>*1, *v*2, ..., *vp*max ]; {Projected image vectors.} **3** *Mc* = [*<sup>x</sup>*1, *x*2, ..., *xNp* ] {Centralized version of *M*} **4 for** *i* = 1 **to** *p*max **do 5 for** *j* = 1 **to** *Np* **do 6** *bj* = *xjt* · *xj*; **7 end 8** *j*max = arg max(*bj*); **9** *pi* = *rj*max ; **10** *q* = *xj*max ; **11** *u* = *xj*max/((*xj*max )*t* · *xj*max ); **12** *vi* = *ut* · *Mc*; **13** *Mc* = *Mc* − *vi* · *q*; **14** {Additional stopping condition.} **15 end Outputs:** *P* = [*c*, *p*1, *p*2, ..., *pp*max ], *V* = [*<sup>v</sup>*1, *v*2, ..., *vp*max

#### *2.4. HyperLCA Inverse Transform*

The inverse HyperLCA transform linearly combines the centroid pixel, *c*, the *P* = [*p*1, *p*2, ..., *pp*max ] extracted pixels and *V* = [*<sup>v</sup>*1, *v*2, ..., *vp*max ] extracted vectors for reconstructing the hyperspectral image, obtaining the decompressed hyperspectral image, *M* . The pseudocode that describes the inverse HyperLCA transform is presented in Algorithm 2. As shown in lines 2–4 of this pseudocode, all the pixels of *M* are firstly initialized as the centroid pixel, *c*. After doing so, the centroid pixel, *c*, is subtracted to the pixels selected by the HyperLCA transform, as shown in lines 5–7. Finally, the decompressed image, *M* , is obtained by sequentially adding the result of each of the *vi* vectors projected using the corresponding orthogonal vector *q*, as shown in lines 9–11. Lines 12–14 of the pseudocode show how the information that can be represented by the pixels that have been already used (*pi*) is subtracted from the pixels that will be used in the next iterations (*pj*=*i*+<sup>1</sup> to *pj*=*<sup>p</sup>*max) of the inverse HyperLCA transform.

]
