# A Novel Spectral-Spatial Classification Method for Hyperspectral Image at Superpixel Level
## 2 The Proposed HSI Classification Method at Superpixel Level  
### SLIC Algorithm and Its Improvement  
Superpixel segmentation is a powerful and important technique in computer vision and image processing. Some typical segmentation algorithms are SLIC [42], ERS [43], watersheds [44], MeanShift [45], Turbopixels [46], and so on. Among them, SLIC, proposed by [PERSON] et al. in 2010 [42], is easy to use and understand, and; therefore, is one of the most popular segmentation algorithms. This algorithm adopts the strategy of local k-means clustering to generate the compact superpixels of color images.  
For a given color image in the CIELAB color space, each pixel in this color image can be represented as \((l_{i},a_{i},b_{i},p_{i},q_{i})\) (\(I=1,2,\ldots,N\)), which is composed of color value \((l_{i},a_{i},b_{i})\) and coordinate \((p_{i},q_{i})\). The image will be approximately segmented into N/s\({}^{2}\) regions with a roughly equal size by a predetermined segmentation scale \(s\). To ensure the segmentation quality, the gradient descent technique was used to select the initial N/s\({}^{2}\) centers to avoid them on edges or noisy pixels. Aiming at improving the calculation speed, the k-means clustering was carried out locally in an area of \(2s\times 2s\) centered on the tested pixel, rather than the whole image. The following metric was adopted to measure the similarity of a pair of pixels in SLIC algorithm [42],  
\[d_{lab}=\sqrt{\left(l_{i}-l_{j}\right)^{2}+\left(a_{i}-a_{j}\right)^{2}+\left( b_{i}-b_{j}\right)^{2}}, \tag{1}\]  
\[d_{pq}=\sqrt{\left(p_{i}-p_{j}\right)^{2}+\left(q_{i}-q_{j}\right)^{2}}, \tag{2}\]  
\[d=\sqrt{d_{lab}^{2}+m^{2}\left(\frac{d_{pq}}{s}\right)^{2}}, \tag{3}\]  
where \(d_{lab}\) and \(d_{pq}\) denote the color difference and spatial distance of a pair of pixels, respectively; the balance parameter \(m\) in Equation (3) is to weigh the importance between \(d_{lab}\) and \(d_{pq}\).  
It is clear that the classical SLIC algorithm cannot be applied directly to superpixel segmentation of HSI. This is because different magnitudes between bands risk to make the distance depending only on high magnitude wavelengths discarding the low magnitude ones. In addition, if the color distance \(d_{lab}\) in Equation (1) is replaced directly by spectral distance, huge spectral difference among hundredsof bands will cause enormous difficulty to the balance of two terms in Equation (3). Experimental results show that this method cannot get a satisfactory segmentation result. Although we can use classic SLIC to split HSI into superpixels by pre-executing PCA, this means that the more knowledge and the optimal parameter values are required.  
To address the aforementioned problem, in what follows, we will put forward an improved SLIC algorithm by introducing a novel technique and a new measurement. The improved SLIC, especially designed for segmenting HSI, can be straightforward used to superpixel segmentation of HSI with any dimensionality.  
The improved SLIC algorithm is described as follows:  
Let \(\text{HSI}=(\mathbf{x}_{1},\ \mathbf{x}_{2},\cdots,\mathbf{x}_{N})\subset\mathbf{R}^{ \text{B}}\) be a hyperspectral dataset with \(N\) pixels; the  
spectral similarity and spatial distance, respectively, allows us to use different metrics when calculating them. This, to some extent, expands effectively the space of application of the proposed method. Compared with our previous work of the improvement of SLIC [28], the improved SLIC algorithm suggested in this study has good computability and is easy to understand. Obviously, the improved SLIC method can be used straightforwardly for superpixel segmentation of hyperspectral data with arbitrary dimensionality.