# Robust and Reconfigurable On-Board Processing for a Hyperspectral Imaging Small Satellite
## 3 On-Board Processing Unit Design
### On-Board Processing Pipeline
#### 3.4.1 Minimal On-Board Image Processing Pipeline  
The MOBIP pipeline consists of setup, HSI data capture (see Section 3.3.3), binning, compression, and post steps. The setup and post steps include the following low-level processing steps:  
* parsing capture command packet,
* allocating memory,
* starting and stopping the time-stamping module,
* opening the camera and setting parameters,
* starting and stopping recording,
* and creating log files and metadata files.  
Data binning is a pre-processing technique where the original samples in small intervals (bins) are replaced by a value representative of that interval. In the context of image processing, binning combines a cluster of pixel samples into a single pixel sample. In the context of hyperspectral imaging, both spatial and spectral binning can be applied. Although associated with loss of information, binning reduces the amount of data to be processed facilitating further analysis and decreasing challenges related to data storage. Binning may also reduce the impact of noise on the processed image (i.e., increased SNR) at the cost of a lower resolution. Among different binning methods, median- and mean-based binning methods have been considered. The current pipeline implementation employs mean binning in the spectral dimension, but without division by sample count. The data type in which the raw hyperspectral data sample values are stored is 16-bit unsigned integer, despite the sample depth of the sensor being 12-bit, and it is possible to add 12-bit values up to 16 times without risking overflow.  
Due to the theoretical spectral bandwidth of the optical system of around 3.33 nm, the high raw spectral sampling of 0.37 nm [32], and the limited available storage in DRAM, the default binning factor is set to 9\(\times\). Online binning during capture is required to fit enough lines for sufficient area coverage into main memory. This imposes a processing time constraint, requiring that binning on an image frame is done before the next frame is exposed and transferred to the SoC. Hence, mean binning is chosen as median binning requires more processing time. The binning factor can be configured on a per-capture basis to any value between 1\(\times\) and 18\(\times\). In [36], it is shown that a lower binning factor can give higher spectral resolution despite sampling below the theoretical bandwidth, which could potentially aid in spectral target detection. Increasing binning factor where spectral resolution is not a priority can be done to increase the SNR. This is important when imaging targets with little reflectance. Binning factors 4\(\times\) to 18\(\times\) are implemented using the ARM NEON SIMD instructions.  
After image capture and binning, with a full binned cube in main memory, a DMA Intellectual Property Core (IP Core) has been developed, cube DMA [70], specialized to efficiently stream hyperspectral data to the FPGA processing modules in the sample order required by the FPGA module irrespective of whether the HSI data are stored in BIP, BIL, BSQ in the main memory.  
A fraction of the on-board DRAM, typically 0.5 GB or 0.75 GB, is reserved for HSI data for transfer to and from the FPGA using cubeDMA. An API for interfacing with cubeDMA and transferring data is defined via a Linux kernel module writing to control and configuration registers on the FPGA.