Hyperspectral Imaging

This “Spectral Viewer” application has three different operational modes for computing SAM, K-Means and PPI. The SAM algorithm performs a dot product between the intensity vector of a reference pixel selected via the mouse and every other pixel in the image. If the angle is below a predefined threshold, then the pixel is considered to be of the same class as the reference, indicating that the underlying geographic features are similar. The K-Means clustering algorithm is an iterative process that classifies pixels according to their distance to the center of K random clusters. At the beginning of every iteration, the centers are readjusted according the spectral vectors contained within a cluster. After a few iterations the algorithm stabilizes as the pixels tend to remain in the same clusters. The pixels of the image are then assigned colors according to the cluster they belong to. The Pixel Purity Index algorithms projects each pixel onto 12000 random spectral vectors, also called skewer. For each skewer the pixels with longest projection vector are recorded. All the pixels with a non-zero counter are then marked accordingly.




The “Spectral Viewer” uses several OpenCL programs to compute the various processing steps on the graphics card (GPU) in the host computer. The entire image is loaded into GPU memory ensuring that virtually all of the computation is performed by the parallel processing architecture of the GPU. For a 320x600 image containing 360 spectral bands, the runtime performance is in the order of a 30ms for the SAM or a single iteration of the K-Means algorithm. Applying 32 skewers of the PPI requires about 150 ms. The K-Means clustering and PPI algorithms are distributed over several frames, effectively underutilizing the graphics card in order to ensure a responsive user interface.

The spectral viewer and a sample dataset are available for download. You will require a HD series NVIDIA GPU to run the application. At this point the demo does not run on AMD hardware. The application will load ENVI data files of type “unsigned short” or “short”. If you already have images in this format available, then there is no need to download the sample data. Keep in mind that you will achieve the highest performance if the dimensions of the image are powers of 2 and the number of spectral bands is less than 360.


Please let us know how the spectral viewer performed on your systems, or what type of improvements you would find useful. You can send comments to This e-mail address is being protected from spambots. You need JavaScript enabled to view it .