# Satellite Image Compression Guided by Regions of Interest
## 2 Materials and Methods
### Evaluation  
The image compressor recommended by the Consultative Committee for Space Data Systems (CCSDS) was used to evaluate the proposed method. The CCSDS 122.0-B-2 [4] recommends a gray-scale image compressor for aerospace applications composed of a discrete wavelet transform (DWT) followed by a bit plane encoder (BPE). The implementation made available by the University of Nebraska was used to compress the tiles classified with the proposed method [24].  
The CCSDS image compressor allows operating with two arithmetics: (a) integer DWT for lossless compression; (b) float DWT for lossy compression. In this study, the image compressor was set to perform the lossless compression with the coding rate (\(r\)) of \(\alpha\) bits per pixel (bpp). Thus, the tiles containing the ROI can be decoded in the ground station free of distortions (regarding the source coding), but their final amount of bits is variable. In other words, compressing a tile with \(r=\alpha\) means that \(\alpha\) will be equal to the lowest possible value achieved by the image compressor to perform the lossless compression of the tile, which varies depending on the image pixels. This means that the \(\alpha\) value is a variable not defined by the user.  
Figure 4: Illustration of the CFAR filter window (modified from [12]).  
Figure 5: ForSyDe model for the vessel detection algorithm using the synchronous model of computation (modified from [12]). In (**1**), a padding operation is performed in the tile borders. CFAR normalization is applied in (2), followed by a threshold operation (with value \(\tau_{4}\)) in (**3**). Then, morphological operations are applied in (**4**).  
The compressor was set to compress the tiles with losses for \(r=\beta\). In this configuration, the compression rate is fixed but the distortion varies slightly depending on the image pixels. Thus, the cost in terms of amount of information is fixed for the tiles without useful content. In that sense, \(\beta=0\) means that the tiles without useful content are just discarded.  
Another option would be to configure the compressor to fix the distortion instead of fixing the coding rate. Then, the amount of information related to the non-relevant tiles will be variable. Both options will result in the same rate-distortion curve, since this function is intrinsic to the compressor. In this study, it was chosen to operate with a fixed coding rate to have the costs of transmitting the non-relevant content well defined.  
The distortions resulting from the lossy compression were measured in terms of mean squared error (MSE), where  
\[\text{MSE}=\frac{1}{\delta^{2}}\sum_{i=0}^{\delta-1}\sum_{j=0}^{\delta-1}(p(i, j)-\hat{p}(i,j))^{2}\;. \tag{2}\]  
\(p(i,j)\) and \(\hat{p}(i,j)\) represent the pixel values of indexes \(i=0,\cdots,\delta-1\) and \(j=0,\cdots,\delta-1\) for the tiles, respectively, before and after the compression. In addition, values in terms of peak signal-to-noise ratio (PSNR) were calculated from the MSE values by  
\[\text{PSNR (dB)}=10\times log_{10}\bigg{(}\frac{\mathcal{M}^{2}}{\text{MSE}} \bigg{)}\;, \tag{3}\]  
where \(\mathcal{M}\) denotes the maximum possible pixel value. For instance, \(\mathcal{M}=2^{16}-1=65535\) for input images of 16 bpp.  
Finally, gain in terms of information saved (\(G\)) was calculated as a ratio: the number of bits resulting from the application of the proposed method divided by the number of bits required for lossless compression of the whole image (usual case). Thus, the lower the gains values, the better.