*2.7. IR Image Processing by k-Means Algorithm*

Spectral image analysis was performed using the *k*-means clustering algorithm, which is one of the most popular unsupervised classification methods [33]. It aims at separating a set of N unlabeled points of d dimensions into k clusters. Thus, it allows grouping pixel spectra into distinct classes (k clusters) and usually the choice of k is driven by a priori knowledge of the structure of the studied dataset. A trial-and-error procedure can also be used by iteratively increasing the number of clusters until obtaining a coherent partition of the studied phenomenon. Each cluster is represented by its barycenter, also called centroid, and the algorithm starts by randomly choosing k initial points as centroids at the beginning of the process. Each pixel spectrum is assigned to the cluster whose centroid is the nearest in terms of spectral similarity, based on a chosen distance metric, which is often the Euclidean distance. These steps are repeated until point assignment is stabilized. The *k*-means algorithm thus converges to a local minimum. Finally, each class is represented by a color and the cluster image is reconstituted as a false-color map. In order to compare different HF section images, a common *k*-means was applied using 10 classes in the 1800–800 cm−<sup>1</sup> spectral range.
