A Method of Reordering Lossless Compression of Hyperspectral Images

: An improved lossless compression method with adaptive band reordering and minimum mean square error prediction was proposed to address the problems of huge data volume of remote sensing images, great pressure on transmission and storage and a low compression ratio. This method may determine the optimal band ordering adaptively, and make full use of the ordering correlation to eliminate the image redundancy according to the minimum mean square error criterion. First, it adaptively grouped hyperspectral image bands, and used the minimum spanning tree algorithm for band ordering within each group to enhance the inter-spectral correlation of adjacent bands. Later, it selected the contexts for inter-and intra-spectral prediction adaptively for the bands within the group to remove the redundancy of hyperspectral images. Finally, it conducted binary arithmetic coding of the predicted residuals to remove the statistical redundancy, and complete the lossless compression of hyperspectral images. The test results based on the hyperspectral images of ZY1-02D show that the method in this paper effectively utilizes the intra-and inter-spectral correlations, improves the prediction performance, and outperforms the commonly used compression methods.


INTRODUCTION
As remote sensing technology has made considerable strides in recent years, the hyperspectral resolution and high spatial resolution, as well as the data quantization bits have been increasing.Meanwhile, the temporal resolution of satellite remote sensing observation has also increased constantly, and all these factors have caused a surge in the volume of remote sensing images.The massive data of hyperspectral images bring a huge burden on the transmission and storage, which limits its application in the field of computer vision and remote sensing.Therefore, it is essential to study the compression of hyperspectral images.The reason for the huge amount of hyperspectral image data lies in the intral-spectral and inter-spectral redundancy of data.To address this problem, researchers have put forward several compression algorithms, which mainly consist of three types, including lossless compression, near-lossless compression, and lossy compression (Signoroni, 2019;Wang, 2019).It costs high to obtain hyperspectral remote sensing images.To guarantee the precision of image data application, lossless compression becomes particularly important.Prediction-based methods are adopted for the lossless compression of hyperspectral images, and the precision of prediction can be enhanced by building a predictive linear model based on the spectral version (Wu, 2000) of context-based adaptive lossless image codec (CALIC) and its variant (Magli, 2004).The Lookup Tables (LUT) based coding method makes use of the inter-spectral structural similarity and unique correction features of hyperspectral images, with low time complexity (MIELIKAINEN, 2006), but it is not ideal for images without correction features.In addition, the prediction method based on the idea of low complexity filter also has a good compression performance, such as fast lossless (FL) (Klimesh, 2006)and Spectral-oriented Least SQuares(SLSQ) (Rizzo, 2007), and it can remove image redundancy with updated weight and linear model.Consultative committee for space data systems (CCSDS) has already adopted the optimized FL method as the compression standard for multi-spectral and hyperspectral images.Song Jinwei applied the recursive least square (RLS)to calculate the 8-order spectral linear prediction coefficient (Song, 2013), which effectively reduced the computation complexity and improved the prediction precision.Currently, most compression methods directly encode the prediction, and re-ordering may enhance the hyperspectral correlation and increase the prediction precision (Gaucel, 2011).In (Tate, 1997;Afjal, 2019), the prediction precision was improved by reordering the bands.In (Toivanen, 2005), the compression performance was enhanced by 5% with the reordering method.According to the above literature analysis, the smaller the prediction residual is, the better the compression performance will be.As a result, an improved adaptative band ordering and minimum mean square error prediction algorithm was put forward in this paper.It can conduct adaptive ordering of bands to find the optimal reference band and coding order for each band, eliminate the inter-spectral redundancy of images according to the minimum mean square error criterion as well as intra-spectral redundancy with the improved median predictor, and finally conduct entropy encoding for the prediction residuals with a binary arithmetic encoder.ZY1-02D is an important satellite in China's spatial infrastructure planning, and the Ministry of Natural Resources of the People's Republic of China is responsible for the construction of the project.This method has been tested effective in the experiment on ZY1-02D hyperspectral images.

CORRELATION ANALYSIS
The primary task of compression is to eliminate the correlation of images.Therefore, the effective use of image correlation is significant for the improvement of compression performance.Correlation coefficient can directly reflect the linear correlation, and can be used as an effective indicator of correlation.The expression of inter-spectral correlation coefficient ,  k k t r between the kth band and k+tth band is defined as: The expression of the intra-spectral coefficient Where, ( , , ) I k i j and ( , , )  I k t i j are the pixels of the image of the kth and k+tth band at the location ( ) , i j respectively; k I and  k t I are the mean pixel of the corresponding band; N and M are the row and column of image; l is the number of rows separated; In Fig. 1, inter-spectral and intral-spectral correlation analysis were conducted for ZY1-02D short wave infrared and visible near infrared hyperspectral images.It is clear that the intralspectral correlation of most bands in ZY1-02D hyperspectral images is weaker than the inter-spectral correlation.Therefore, the primary task of compression shall be the elimination of inter-spectral correlation.

METHODS
In this paper, the lossless compression scheme is divided into three parts: adaptive band ordering, prediction, and entropy coding, as shown in Fig. 2. While coding, in addition to predicting the residual code stream, the band reordering numbers shall also be added, but the numbers account for small bytes and can be ignored.While decoding, the code stream is first decoded into residual image and ordering number, and then the pixels of each band are recovered one by one with a predictor.Due to the symmetry of compression and decompression of algorithm, the bands of hyperspectral images can be reordered according to the ordering number to restore the original image.

Band reordering
Not all the correlation between two bands of the hyperspectral images is extremely high, and some bands of small interspectral correlation with other bands would not be included in band ordering.Meanwhile, for hyperspectral data with multiple bands, reasonable partitioning may reduce the computation of correlation coefficients.Good band reordering can improve the correlation between bands and indirectly improve the prediction performance, a segmented sorting method was proposed in this paper, which consists of two parts: ① adaptive band grouping (Fig. 3); ② band reordering within each group using the minimum spanning tree algorithm.

Figure 3. Adaptive grouping of hyperspectral image bands
Fig. 4 is an optimally ordered tree corresponding to Fig. 3, where the vertex bands are compressed with intra-spectral prediction and the remaining child nodes are predicted using the ordered reference bands.In this way, the best predicted coding order is transformed into a minimum spanning tree problem in graph theory.Table I shows the comparison of the inter-spectral correlation coefficients between the best-ordered and unordered bands in Fig. 4, from which it is clear that the best ordered band enhances the inter-spectral correlation coefficient, so the adaptive solution to the best ordering of different images may enhance the compression effects.

Intra-spectral prediction
Intra-spectral prediction applies the classical median predictor to eliminate the spatial redundancy of images.For the diagonal edges in bands, the prediction of diagonal edge of images was added on the basis of the median predictor in this paper, and an improved intra-spectral prediction method was proposed.The formula of median predictor is as follows: (3) Where, A , C and B are the three adjacent pixels of the pixel point to be predicted, and X is the predicted value of the current pixel.
The edge judgment conditions include Where, 1 T and 2 T are pre-defined positive thresholds, for testing the contrast of pixel gray values of diagonal edges, and theoretically, 2 1 T T  .

Inter-spectral prediction
SLSQ increases the indexes based on the current pixel of the reference band and local pixel distance from the current pixel.
Aiming at the possible local edge in inter-spectral prediction, ordering model was added on the basis of SLSQ, and improved inter-spectral prediction was put forward to choose the best number of contexts, as shown in Fig. 5.
{ | 0,1, ,11} means the set of pixel point x within the local candidate region, and the distance weighted Where, i  is the distance weighted value of i x , and the further i x is away from x , the smaller the weighted value will be.
N minimum distance weighted pixel values are selected from i d after calculation, denoted as   0,1, , and the corresponding i y is taken as the best prediction context of y , namely . With the candidate values of the reference band in the template and the corresponding current band, the predicted values can be calculated according to the minimum mean square criterion: Where, a is the prediction coefficient of the reference band,

Entropy coding
After prediction, all residuals were mapped to the non-negative values, and then binary arithmetic coding was used to remove statistical redundancy from the images.The mapping equation is as follows: 2 , 0 ( ) 2 1, 0 Where, n is the predicted residual value.

RESULTS AND ANALYSIS
To verify the effectiveness of the algorithm in this paper, compression test was conducted for ZY1-02D satellite hyperspectral images with VS2013.The ZY1-02D satellite is equipped with visible near infrared camera and hyperspectral camera.The wave length of data achieved by hyperspectral camera ranges between 0.4 μm and 2.5 μm, with 76 bands of visible near infrared (VN) and 90 bands of shortwave infrared (SW), and each pixel is 16 bits.Eight AHSI images were taken at different time and locations, as shown in Table II.The compression effect is evaluated using bit per pixel (bpp) and compression ratio.

Parameter setting
Since there is no change in the result of the value of 2 T , Fig. 6 shows the variation curve of the bpp of image ZY1E-AHSI-E106.90-N42.36-VN with 1 T when the fixed threshold 2 10  T .It is clear that when there are diagonal edges in the image, bpp decreases after the addition of edge detection, while the compression performance is a little higher than that of the previous method.When 1 T ranges between 400 and 600, it tends to be stable, and at this moment, the average bit rate of the intra-spectral prediction is the smallest.

Compression results and comparison
Fig. 8 shows the absolute average of the prediction residuals for each band obtained after the prediction of image ZY1E-AHSIby the algorithm in this paper.The interspectral and intral-spectral prediction after band ordering makes full use of the correlation and the optimal number of contexts to eliminate the image redundancy effectively, and achieve a small prediction residual.

Figure 8. Predicted band
Compression tests were conducted with several lossless compression algorithms, and the compression ratio was used as the evaluation index of compression performance in lossless compression.Compression algorithms include WinRAR, JPEG-LS, FL, JPEG2000 and the algorithm in this paper, as shown in Table III, among which, WinRAR is now the most commonly used software for lossless compression; JPEG-LS and JPEG2000 are internationally acknowledged lossless and nearlossless compression standards; FL is a hyperspectral image compression algorithm recommended by CCSDS.According to table III, WinRAR fails to take the correlation of hyperspectral images into account, and just removes the statistical redundancy of data, featuring a poor compression performance; although JPEG-LS and JPEG2000 remove the spatial redundancy of hyperspectral images, they fail to consider the inter-spectral correlation, thus with a poor compression performance; JPEG2000 is more suitable for near-lossless or lossy compression, and it is a little bit weaker than JPEG-LS in lossless compression.FL predicts the current band using several reference bands, and removes the inter-spectral redundancy of hyperspectral images, with better compression performance than that of the other three methods.But its precision decreases in case of bands of low prediction correlation and a large number of reference bands.The algorithm in this paper combined the adaptive band ordering algorithm and the prediction algorithm to effectively remove the intral-spectral and inter-spectral redundancy of hyperspectral images, showing the best performance in compression when compared with the previous four methods.

CONCLUSION
To utilize the correlation of hyperspectral images effectively and enhance the performance of lossless compression, an improved adaptive band reordering and minimum mean square error prediction algorithm was put forward in this paper.It firstly improved the correlation between the band to be predicted and the reference band through the adaptive band ordering, and then removed the intra-and inter-spectral correlation of hyperspectral images with the improved intraspectral median predictor and inter-spectral optimal context predictor, and finally eliminated the statistical redundancy and completed the compression process by binary arithmetic coding of the prediction residuals and the band ordering number.The images were consistent with the original image after the decompression, achieving the lossless compression of hyperspectral images.The test results of ZY1-02D hyperspectral images show that this algorithm achieves an average compression ratio of 3.58 and 3.36 times for the 16-bit uncorrected images, which is better than WinRAR, JPEG-LS, FL and JPEG2000.In terms of time, the time consumption of the method in this paper is greatly increased compared with the previous methods, because the increase in algorithm will inevitably lead to an increase in computing time, but for production applications, multi-threaded or CUDA programming methods, which can significantly reduce the calculation time.
The algorithm proposed in this paper is simple and easy to implement, with enhanced performance, and can provide references for lossless compression of hyperspectral images.

Figure 4 .
Figure 4. Minimum spanning tree value of the pixel y of the current band.

Figure 6 .
Figure 6.Intral-spectral prediction of bpp trends Fig.7shows the variation trend of the average bit with N when different numbers of context are selected in the prediction template.According to the image analysis in table 2, with the constant increase of N, bpp increases.When N=2, bpp is the smallest.So N=2 in this paper.

Table 1 .
.Table of inter-spectral prediction order

Table 3 .
Compression results of hyperspectral images of the ZY1-02D satellite (compression ratio)