# A Machine Vision-Based Algorithm for Color Classification of Recycled Wool Fabrics
## 2 Materials and Methods
### Color Data Collection and Parameter Extraction  
Once collected, the fabrics were processed by means of an appositely devised MV system, which was conceived to store high-resolution images. Once such data were retrieved, a number of image processing algorithms were used to define a set of color-related parameters. Finally, such parameters were used to train the neural network. The MV system consisted of a sealed cabin hosting a Canon EOS 40D camera provided with a 22.2 \(\times\) 14.8 mm\({}^{2}\) CMOS sensor, with a resolution set to 1936 \(\times\) 1288 pixels\({}^{2}\)) and a CIE Standard Illuminant D55 lamp (with a temperature of 5503 K, roughly corresponding to mid-morning/mid-afternoon daylight). The camera's white level was adjusted to 5500 K based on the selected illuminant. The \"evaluative 35 zone\" camera program was used to evaluate the exposure, and a sample from the white family's brighter subclass was submitted. All subsequent acquisitions used the recorded exposure settings, and images were captured at a distance of approximately 50 cm. With this system, the acquired area was roughly 150 \(\times\) 100 mm\({}^{2}\) and the image resolution was 13 pixel/mm. A label is automatically assigned to each acquired image from the training set, according to the coding a/b/c where:  
* a is an integer in the range 1-800 representing cloth sample number;
* b is an integer in the range 1-10 representing the color family;
* c is an integer in the range 1-40 representing the assigned color class. For example, the image labeled with the code 20/6/21 identified the acquired image for sample number 20, classified by the picker in family 6 (i.e., red) and class 21 (see Figure 2). Each acquired image could be represented in the RGB three-dimensional color space where the triplet of its RGB values mapped each pixel. Since the fabric color was not uniform, even in the case of the recycled wool samples being plain fabrics, straightforward use of the RGB values to classify the fabric was not a trivial task. This can be seen in Figure 3, where the brightness surface of the R channel for the aforementioned fabric is depicted, demonstrating the non-negligible variability of the luminance level. On the other hand, the use of the entire range of RGB values to describe the color of the acquired image was not feasible since it introduced an excessive, and unnecessary, number of parameters for training the PNN. For these reasons, it was necessary to perform a preliminary image-processing task to simplify the acquired images while maintaining the color information. The pre-processing started from mapping the RGB values to indexed images for a given color map. Many standard color-matching systems are available to this purpose; among them, the most commonly adopted are RAL\({}^{\circledR}\) and PANTONE\({}^{\circledR}\). In  
Figure 2: Sample with label 20/6/21. the present work, the RAL color chart was used, which consisted of an overall number of 313 colors. As a result, an indexing algorithm was used to locate the RAL color that was closest to each pixel in the original image in terms of Euclidean distance. As widely recognized [19], the Euclidean distance refers to the distance between two points in the K-dimensional space. The three elements R, G, and B are equivalent to the x, y, and z-axes of the three-bit space in the RGB color model space. The RGB color space must be uniform in order to use the Euclidean distance to determine the similarity between two colors; unfortunately, this condition was not satisfied since the RGB color space is not spherical. Therefore, prior to indexing, a color conversion from RGB to HSV color spaces was required. This was carried out according to ref. [20]. Once the image was converted, the algorithm mapped each HSV triplet of the original image to the HSV values of RAL(r) images. Finally, the algorithm assigned the RAL triplet to the corresponding pixel in the indexed image, which was eventually converted again from HSV space to RGB.