A processing algorithm to classify hyperspectral images from an imaging spectroscopic sensor is investigated in this
paper. In this research two approaches are followed. First, the feasibility of an analysis scheme consisting of spectral
feature extraction and classification is demonstrated. Principal component analysis (PCA) is used to perform data
dimensionality reduction while the spectral interpretation algorithm for classification is the K nearest neighbour (KNN).
The performance of the KNN method, in terms of accuracy and classification time, is determined as a function of the
compression rate achieved in the PCA pre-processing stage. Potential applications of these hyperspectral sensors for
foreign object detection in industrial scenarios are enormous, for example in raw material quality control. KNN classifier
provides an enormous improvement in this particular case, since as no training is required, new products can be added in
any time. To reduce the high computational load of the KNN classifier, a generalization of the binary tree employed in
sorting and searching, kd-tree, has been implemented in a second approach. Finally, the performance of both strategies,
with or without the inclusion of the kd-tree, has been successfully tested and their properties compared in the raw
material quality control of the tobacco industry.