# Developing a New Method of Transformation for Obtaining XYZ Color Values from RGB Images for Agricultural Applications

Vahid Mohammadi, Keivan Ansari, Pierre Gouton, Houda Attig

► To cite this version:

Vahid Mohammadi, Keivan Ansari, Pierre Gouton, Houda Attig. Developing a New Method of Transformation for Obtaining XYZ Color Values from RGB Images for Agricultural Applications. Sensors, 2024, 24 (23), pp.7728. 10.3390/s24237728. [https://hal.science/hal-05460485]

HAL Id: hal-05460485

https://hal.science/hal-05460485v1

Submitted on 15 Jan 2026

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons CC0 1.0 - Universal - International License
<figure><img src="image_2.png" /></figure>

Article

# Developing a New Method of Transformation for Obtaining XYZ Color Values from RGB Images for Agricultural Applications

Vahid Mohammadi<fnref n="1" />, Keivan Ansari<fnref n="2" />,* ID, Pierre Gouton<fnref n="1" /> and Houda Attig<fnref n="3" />

**Abstract:** The extraction of device-independent color values from affordable and accessible digital images based on a standard color space system is crucially necessary for agricultural applications, where color information for plant monitoring or diagnostics is required. This study aimed to develop a transformation matrix for obtaining XYZ color coordinates from the RGB values of digital images for agricultural applications. The calibration procedure was based on Munsell and Macbeth color charts. The color coordinates of eight color charts were measured, and the transformation matrices were built. Leaf samples of six different plants were used and compared based on the proposed transformation technique. The actual XYZ values of plant leaves were measured, and the RGB values were derived from the digital images. The results indicate that the Macbeth color chart with 24 colors had the best performance, with an average ΔELAB and CIEDE2000 of less than 1.77 and 1.97, respectively. The findings demonstrate that the proposed transformation matrix was successful in converting RGB values to XYZ values and can be employed as a quick, easy, and inexpensive technique for obtaining standard color information.

**Keywords:** color space; Munsell; Macbeth chart; transformation matrix; XYZ values

## 1. Introduction

The color information of plant leaves plays a significant role for agricultural producers [1]. This color information is used for a variety of purposes, such as monitoring plant health, disease detection, adjusting nutritional values, and estimating chlorophyll levels [2–5]. Therefore, correlating color information to physical or chemical properties is of great interest [6]. Consequently, extensive research has been conducted using the color information of plant leaves obtained from digital images, including color index estimation [7], disease detection [8–11], leaf water content estimation [12], nitrogen content estimation [13], phenotyping and identification [14–16], chlorophyll content estimation [17–19], and nutrient deficiency detection [20–22].

Unfortunately, in agricultural applications, precise spectrophotometers and spectrophotoradiometers are often unavailable due to the nature of farms and greenhouses, their high cost, and the lack of a stable light source. Conversely, RGB values are easily accessible, but they are device-dependent, meaning that the observed color can change when transferred between different devices (i.e., monitors, printers, etc.). To address this issue, it is necessary to find a model that expresses color independently of the device while also providing sufficient accuracy to identify the color. Research into the conversion of inexpensive color data from photographic cameras into valuable device-independent data is of great importance, particularly in the agricultural industry, where the use of expensive measuring devices is almost impossible [23,24]. In this regard, converting RGB values to

<figure><img src="image_3.png" /></figure>

check for
updates

**Citation:** Mohammadi, V.; Ansari, K.; Gouton, P.; Attig, H. Developing a New Method of Transformation for Obtaining XYZ Color Values from RGB Images for Agricultural Applications. *Sensors* **2024**, *24*, 7728. https://doi.org/10.3390/s24237728

Academic Editor: Yongwha Chung

Received: 18 October 2024

Revised: 30 November 2024

Accepted: 1 December 2024

Published: 3 December 2024

<figure><img src="image_4.png" /></figure>

**Copyright:** © 2024 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

<footnote n="1">¹ ImViA, UFR Sciences et Techniques, Université de Bourgogne, Franche-Comté, 21078 Dijon, France; v.mohamadi1@gmail.com (V.M.); pgouton@u-bourgogne.fr (P.G.)</footnote>

<footnote n="2">² Department of Color Imaging and Color Image Processing, Color Physics Faculty, Institute for Color Science and Technology, Tehran 1668836471, Iran</footnote>

<footnote n="3">³ Research Federation of Visual and Cultural Sciences-SCV, FR CNRS 2052, 59100 Lille, France; houda.attig@univ-lille.fr</footnote>

<footnote>* Correspondence: kansari@icrc.ac.ir; Tel.: +98-912-147-3393</footnote>
a more reliable and device-independent color system, such as CIE XYZ, would facilitate accurate color measurement and its use in color discrimination.

Previous studies have introduced various techniques for extracting color and spectral information from digital color images [25]. These encompass both close-range and remote-sensing imaging techniques [26–29]. Yam and Papadakis [30] proposed a digital imaging method for measuring and analyzing the color of food surfaces. Three color models, including RGB, CMYK, and CIELAB, were employed for color information extraction, and Photoshop software (Adobe Systems, 2002) was utilized for the analyses. The advantage of their technique was that the system was quite affordable. Carney and Johnston [31] used a regression model to convert RGB image data to spectroradiometric values in CIE XYZ space for tooth-colored shades. They obtained RGB data using Image J software. The regression models yielded R² values over 0.99 for RGB-to-XYZ transformation. Funt et al. [32] proposed optimal linear RGB-to-XYZ mapping for color display calibration with two methods, one using weighted least squares with weights based on the rate of change of CIELAB coordinates and the second using Nedler–Mead nonlinear optimization. They evaluated the techniques for calibrating two CRT monitors, three LCD monitors, and two LCD projectors, and the results were remarkably better than the general transformation matrix. Xiong and Funt [33] presented a nonlinear method for RGB-to-XYZ color calibration based on the technique of thin-plate splines. Their proposed technique demonstrated acceptable performance based on the analysis of a SONY camera and nine display monitors. Griesbach and Austin [34] compared Munsell and Royal Horticultural Society’s color charts in describing flower colors. It was observed that the Royal Horticultural Society’s color chart did not provide sufficient discrimination between cultivars that were distinguishable by eye, while the Munsell charts allowed for a more precise description of colors that fell within the color chart chips. Leon et al. [35] used L*a*b* measurements derived from RGB values for food science. They employed several methods to map RGB values to L*a*b* units, of which the neural network model performed best, with an error rate of 0.93%. Kumah et al. [36] used L*a*b* color coordinates from RGB images to provide color information for Fabric Patterns based on a perceptually uniform color system with respect to human color vision. Color images of printed fabrics were captured using Nikon Cameras (Tokyo, Japan), and an unsupervised segmentation method based on the mean shift algorithm was employed. The results established a consistent and reliable color measurement. Bianco et al. [37] proposed a Pattern Search Optimization (PSO) method for the conversion of RGB to XYZ values. Among the methods evaluated in their study, NonMaxIg (Non-Maximum Ignorance method) had the lowest ΔELAB of 2.78. Pegalajar et al. [38] recently used neural networks and fuzzy logic to determine the closest values for soil samples to Munsell chips. In their study, RGB images were captured using two cell phones and a professional camera. Pegalajar et al. [39] used Munsell color charts for soil colors for the classification and detection of the colors of soils. They took advantage of two machine learning techniques (i.e., ANN and fuzzy logic) for the identification of colors. The images were taken using mobile phones and one Canon camera. The proposed technique was successful, and the Canon led to higher accuracy than the mobile phone devices.

To the best of our knowledge, no reports have been presented on the extraction of the XYZ coordinates of plants derived from RGB values. Therefore, this research aims to provide a simple and accurate method for the extraction of the XYZ color coordinates of plant leaves from RGB images. This study introduces a transformation matrix based on the precise measurements of the spectral information of standard color charts.

## 2. Materials and Methods

### 2.1. *Measurement Set-Up*

Samples of six different plants, including cucumber, eggplant, onion, pepper, sugar beet, and tomato, were collected from a farm and quickly transferred to the laboratory—including their roots and soil—in order to ensure their freshness. A total of one hundred thirty leaves from different plants were collected intact. The leaves were
then placed on a grey background to capture color images and spectral data. Two D65 lights, equipped with light diffusers, were positioned at a 45° angle (Figure 1). An 18 MP Canon camera (EOS Kiss X5, Taichung, Taiwan) was utilized to take color images. A spectrophotoradiometer (Minolta, CS-2000, Tokyo, Japan) with a working range of 400 to 720 was employed to measure the spectral responses. The standard observer was set to 2°, and the spectroradiometer was positioned at 90° to the sample's surface. Additionally, the spectral power distribution of the lights was measured using the spectrophotoradiometer, which was then used for the actual color determination.

<figure><img src="image_5.png" /><figcaption>Figure 1. The set-up used for the measurements.</figcaption></figure>

## 2.2. RGB Values of Color Charts

This study employed seven different color charts, namely, the Munsell color charts for agriculture in the range of 2.5G to 7.5GY and the Macbeth color chart (Table 1). The color images of all color checkers were captured (Figure 2). A code was written in MATLAB version 2019b to read the images and extract the RGB values by taking the average of one hundred pixels in the middle of each color patch. It is necessary to ensure that the response of the image sensor is linear with the XYZ tristimulus values. Hence, the RGB values were linearized by measuring the RGB and spectral reflectance responses of six neutral samples. These samples were the six samples on the last row of the Macbeth color checker, starting from white to black (Figure 3). The spectral reflectance of these neutral samples was measured. The average value was obtained for each of the patches. Then, the polynomial fits were obtained for the average values and the red, green, and blue channels separately (Equation (1)).

$$p(x) = p_1x^n + p_2x^{n-1} + \dots + p_nx + p_{n+1} \quad (1)$$

where a third-degree polynomial was employed in this study (n = 3). Using the obtained polynomial transforms, the RGB values were then linearized, which ensured that the RGB values were linearly related to the XYZ tristimulus values.

<table><caption>Table 1. List of color charts used for extraction of transformation matrix.</caption><thead><tr><th></th><th>Name/Number</th><th>Number of Colors</th></tr></thead><tbody><tr><td rowspan="7">Munsell color chart for plant tissues</td><td>2.5G</td><td>20</td></tr><tr><td>2.5GY</td><td>20</td></tr><tr><td>5BG</td><td>14</td></tr><tr><td>5G</td><td>17</td></tr><tr><td>5GY</td><td>16</td></tr><tr><td>7.5G</td><td>16</td></tr><tr><td>7.5GY</td><td>23</td></tr><tr><td>Macbeth color chart</td><td>Color rendition chart</td><td>24</td></tr></tbody></table>
<figure><img src="image_6.png" /><figcaption>Figure 2. Installed color chart (e.g., Munsell 2.5G) used for capturing RGB images and measuring spectral reflectance.</figcaption></figure>

<figure><img src="image_7.png" /><figcaption>Figure 3. Macbeth color chart. The neutral colors are highlighted by dotted red line.</figcaption></figure>

## 2.3. Extraction of XYZ Coordinates of the Charts

The spectral reflectance of each color on the color charts was measured, and the XYZ and L*a*b* values were obtained for each color. The actual XYZ values were determined using the CIE formula (Equation (2)), where E(λ) represents the relative spectral power distribution of the illuminant; x̄(λ), ȳ(λ), and z̄(λ) are the color-matching functions for the CIE 1931 or 1964 standard observers; P(λ) stands for the spectral reflectance of the leaf surface; and k is a normalizing factor defined as $k = 100 / \int E(\lambda) ȳ(\lambda) d\lambda$ [40].

$$X = k \sum_{\lambda=360}^{\lambda=830} E(\lambda) \bar{x}(\lambda) P(\lambda)$$

$$Y = k \sum_{\lambda=360}^{\lambda=830} E(\lambda) \bar{y}(\lambda) P(\lambda)$$

(2)

$$Z = k \sum_{\lambda=360}^{\lambda=830} E(\lambda) \bar{z}(\lambda) P(\lambda)$$

## 2.4. Extraction of Transformation Matrices

With the XYZ and RGB values of each color on the standard charts, the transformation matrix for mapping the RGB values to XYZ values was derived for each chart. This was accomplished by calculating matrix A, which is a 3 by 7 matrix, using the equation $A = T/C$,
where T represents the matrix of XYZ values, and C denotes the extension matrix of RGB values, which is provided as:

$$C = \begin{bmatrix} R \\ G \\ B \\ R^2 \\ G^2 \\ B^2 \\ 1 \end{bmatrix} \qquad (3)$$

The second-degree polynomial relation between XYZ and RGB values is then given by Equation (3).

$$ \begin{aligned} X &= a_{11}R + a_{12}G + a_{13}B + a_{14}R^2 + a_{15}G^2 + a_{16}B^2 + a_{17} \\ Y &= a_{21}R + a_{22}G + a_{23}B + a_{24}R^2 + a_{25}G^2 + a_{26}B^2 + a_{27} \\ Z &= a_{31}R + a_{32}G + a_{33}B + a_{34}R^2 + a_{35}G^2 + a_{36}B^2 + a_{37} \end{aligned} \qquad (4) $$

Finally, using T = AC, the XYZ values could be obtained for leaf samples from the linearized RGB values and the transformation matrices extracted for each color chart in this section. These XYZ values are the estimated values, which are based on the RGB images. The procedure for the measurement of the actual XYZ values of leaf samples is explained in the next section. The actual XYZ values were obtained for the calculation of the precision of the RGB-to-XYZ transformation matrices.

## 2.5. Color Coordinates of Plant Leaves

For the plant leaves, the actual XYZ values were determined by spectral reflectance using the same method as the color charts. For the extraction of RGB values, an area in the middle of the leaves containing over 100 pixels was chosen, and the average values of the pixels were obtained for each layer of the image to be selected as RGB values. Subsequently, linearization was performed on the RGB values, and the XYZ values were calculated from the linearized RGB values using the CIE XYZ color-matching functions. Figure 4 illustrates the installation of leaves for the acquisition of an RGB image and the measurement of spectral reflectance.

<figure><img src="image_8.png" /><figcaption>Figure 4. Installed leaves for taking the RGB image and measurement of spectral reflectance.</figcaption></figure>

For comparison of the extracted XYZ values with the classical method, the XYZ coordinates of the leaves were extracted using a general conversion matrix as follows [41]:

$$ \begin{bmatrix} X \\ Y \\ Z \end{bmatrix} = \begin{bmatrix} 0.4124 & 0.3576 & 0.1805 \\ 0.2126 & 0.7152 & 0.0722 \\ 0.0193 & 0.1192 & 0.9505 \end{bmatrix} \begin{bmatrix} R \\ G \\ B \end{bmatrix} $$
## 2.6. Color Difference Calculation

The XYZ values were then converted into CIELCH values, a color space based on CIE L*a*b*. CIELCH uses the polar coordinates C* (i.e., chroma and relative saturation) and h° (i.e., the angle of the hue in the CIELAB color space) instead of the Cartesian coordinates of a* (red-green) and b* (yellow-blue). The conversion is performed in two steps: first, XYZ to L*a*b* and then L*a*b* to L*c*h° values.

$$ 
\begin{aligned}
C^* &= \sqrt{(a^*)^2 + (b^*)^2} \\
h &= atan2(a^*, b^*) \\
h^\circ &= \left( \frac{h \times 180}{\pi} \right) \mod 360
\end{aligned} 
\qquad (5) $$

The color difference, ΔE, between the actual and calculated L*c*h° color values was then obtained using the CIEDE2000 (ΔE₀₀) formula. This formula provides more perceptual uniformity than ΔELAB1976 and is expressed as follows:

$$ \Delta E_{00} = \sqrt{\left(\frac{\Delta L'}{k_L S_L}\right)^2 + \left(\frac{\Delta C'}{k_C S_C}\right)^2 + \left(\frac{\Delta H'}{k_H S_H}\right)^2 + R_T \frac{\Delta C'}{k_C S_C} \frac{\Delta H'}{k_H S_H}} \qquad (6) $$

where the differences in lightness, chroma, and hue, are denoted as ΔL', ΔC', and ΔH'. To compensate for the lightness, chroma, and hue components of CIELCH, S_L, S_C, and S_H are employed as compensation functions, respectively. Parametric weighting factors, k_L, k_C, and k_H, are also used to adjust the importance of each component. Additionally, a hue rotation term, (R_T), is included to address the problematic blue region.

## 3. Results and Discussion

In this study, Munsell color charts for agricultural applications, the Macbeth color chart, and a traditional conversion method were compared to identify the most suitable chart for determining the color of plants for agricultural applications. This provides the utility of a color chart for the online extraction of colorimetric properties of leaves using common RGB cameras, as well as the application of this information for the estimation of other biological and chemical properties of plants.

Spectral reflectance was measured in steps of one nanometer to obtain all the reflected energy, providing the precise color information of the leaves. Figure 5 represents the spectral reflectance of different plant leaves. As expected, most of the reflection occurs in the green area; however, in the red area of the spectra, there exists much information that is crucial for the extraction of precise color values.

<figure><img src="image_9.png" /><figcaption>Figure 5. Average spectral reflectance of different plants in the visible range.</figcaption></figure>
### 3.1. Estimation of XYZ Coordinates

Table 2 presents the CIELab and CIEDE2000 color differences of the actual and estimated XYZ values based on the transformation matrices obtained from the color charts. The results indicate that for almost all plants, the Macbeth color chart yielded the least amount of ΔE. Only for eggplant, Munsell 7.5GY has the smallest ΔE. The best estimation was achieved for the pepper plant, having a CIELab of 1.07 and CIEDE2000 of 0.86. In all cases, the Macbeth color chart led to an acceptable ΔE, especially using the CIEDE2000 technique, which presented smaller values than CIELab. Munsell 5GY and Munsell 7.5GY led to color differences between 1 and 3, which represent small color differences, noticeable by eye but still in the range of acceptable color differences. On the other side, the general conversion matrix led to color differences bigger than 3, representing large color differences.

<table><caption>**Table 2.** Average values of ΔE CIELAB and CIEDE2000 for the original and predicted XYZ values based on different color charts.</caption><thead><tr><th rowspan="2">Color Chart</th><th colspan="2">Cucumber</th><th colspan="2">Eggplant</th><th colspan="2">Onion</th><th colspan="2">Pepper</th><th colspan="2">Sugar beet</th><th colspan="2">Tomato</th></tr><tr><th>ΔELab</th><th>CIEDE2000</th><th>ΔELab</th><th>CIEDE2000</th><th>ΔELab</th><th>CIEDE2000</th><th>ΔELab</th><th>CIEDE2000</th><th>ΔELab</th><th>CIEDE2000</th><th>ΔELab</th><th>CIEDE2000</th></tr></thead><tbody><tr><td>Munsell 5BG</td><td>3.03</td><td>3.06</td><td>3.00</td><td>3.22</td><td>2.86</td><td>2.63</td><td>3.73</td><td>3.46</td><td>3.73</td><td>3.48</td><td>2.98</td><td>3.15</td></tr><tr><td>Munsell 2.5G</td><td>5.19</td><td>6.32</td><td>4.73</td><td>5.85</td><td>3.87</td><td>4.19</td><td>5.47</td><td>5.95</td><td>4.65</td><td>4.78</td><td>5.69</td><td>7.17</td></tr><tr><td>Munsell 5G</td><td>5.13</td><td>5.50</td><td>4.79</td><td>5.15</td><td>4.24</td><td>4.09</td><td>5.43</td><td>5.61</td><td>4.54</td><td>4.68</td><td>5.56</td><td>6.13</td></tr><tr><td>Munsell 7.5G</td><td>4.68</td><td>4.39</td><td>4.54</td><td>4.52</td><td>3.16</td><td>2.99</td><td>3.63</td><td>3.61</td><td>3.89</td><td>3.80</td><td>5.05</td><td>4.79</td></tr><tr><td>Munsell 2.5GY</td><td>73.48</td><td>65.00</td><td>56.70</td><td>44.26</td><td>40.63</td><td>23.53</td><td>33.66</td><td>19.94</td><td>37.85</td><td>23.02</td><td>73.67</td><td>64.18</td></tr><tr><td>Munsell 5GY</td><td>2.91</td><td>2.57</td><td>2.21</td><td>1.74</td><td>2.40</td><td>1.69</td><td>2.00</td><td>1.45</td><td>3.01</td><td>2.26</td><td>2.62</td><td>2.17</td></tr><tr><td>Munsell 7.5GY</td><td>3.57</td><td>2.97</td><td>1.73</td><td>1.43</td><td>2.28</td><td>1.69</td><td>2.45</td><td>1.90</td><td>3.89</td><td>2.79</td><td>2.55</td><td>2.20</td></tr><tr><td>Macbeth chart</td><td>1.86</td><td>1.77</td><td>1.74</td><td>1.64</td><td>1.43</td><td>1.10</td><td>1.07</td><td>0.86</td><td>1.97</td><td>1.58</td><td>1.86</td><td>1.69</td></tr><tr><td>General matrix</td><td>5.48</td><td>4.56</td><td>5.59</td><td>4.70</td><td>5.65</td><td>4.72</td><td>6.13</td><td>5.16</td><td>5.53</td><td>4.57</td><td>6.32</td><td>6.24</td></tr></tbody></table>

As mentioned, among Munsell color charts, 5GY and 7.5GY present small errors for estimation purposes. On the other side, Munsell 2.5 shows the worst estimations with very large ΔEs. Also, it is observed that the obtained specific transformation matrices based on Munsell charts (such as 5GY and 7.5GY) have errors far smaller than the general conversion matrix that traditionally is used for RGB-to-XYZ transformation. Fan et al. [42] evaluated smartphone cameras to compare them with Munsell color charts. They transformed the RGB values to CIELAB coordinates for comparison. The ΔE color differences for both the camera and Munsell charts were in a range of 4 to 15. In a recent work, Berndt and Gaussoin [43] linked the color of turfgrass leaves to colorimetric coordinates (i.e., hue, value, and chroma) of the Munsell Plant Tissue Color Book. They used different equations for each coordinate and obtained acceptable error values (less than 0.1%). Their study also showed that the colorimetric coordinates of plants can be specified and communicated.

Table 3 provides the average values of XYZ coordinates for the actual values and the estimated values based on the Macbeth chart. The standard deviation values of the repetitions and the color differences have also been provided. It is observed that the proposed specific transformation matrix leads to quite precise estimations. As the table shows, the obtained XYZ values are remarkably near the actual values. It is noted that the standard deviation of the estimated XYZ values is quite similar or even less than the ones for the actual XYZ values. The best estimation is observed for the pepper plant, amounting to ΔE of 0.86, which is considered not noticeable by eye. It is observed that the average ΔE for all plants is 1.44, which indicates a relatively good color transformation.
<table><caption>**Table 3.** Average values of color coordinates obtained using the general and proposed conversion matrices.</caption><thead><tr><th rowspan="2">Plant</th><th colspan="3">Actual Values</th><th colspan="3">Estimated Values</th><th rowspan="2">ΔE2000</th></tr><tr><th>X</th><th>Y</th><th>Z</th><th>X</th><th>Y</th><th>Z</th></tr></thead><tbody><tr><td>Cucumber</td><td>8.17 ± 2.14</td><td>9.01 ± 2.40</td><td>2.67 ± 0.58</td><td>8.29 ± 2.15</td><td>9.64 ± 2.47</td><td>2.61 ± 0.32</td><td>1.77</td></tr><tr><td>Eggplant</td><td>8.99 ± 1.83</td><td>10.21 ± 2.02</td><td>2.85 ± 0.50</td><td>9.41 ± 1.18</td><td>11.16 ± 1.17</td><td>2.76 ± 0.43</td><td>1.64</td></tr><tr><td>Onion</td><td>15.74 ± 2.85</td><td>17.68 ± 3.11</td><td>4.81 ± 1.10</td><td>11.77 ± 3.23</td><td>14.24 ± 3.55</td><td>3.13 ± 0.84</td><td>1.10</td></tr><tr><td>Pepper</td><td>15.04 ± 4.19</td><td>17.51 ± 4.47</td><td>3.00 ± 1.04</td><td>14.70 ± 3.54</td><td>17.40 ± 3.70</td><td>3.09 ± 0.84</td><td>0.86</td></tr><tr><td>Sugar beet</td><td>14.03 ± 3.20</td><td>16.19 ± 3.26</td><td>3.03 ± 0.94</td><td>16.47 ± 5.23</td><td>19.23 ± 5.37</td><td>3.88 ± 1.60</td><td>1.58</td></tr><tr><td>Tomato</td><td>7.54 ± 1.57</td><td>8.55 ± 1.46</td><td>2.46 ± 0.57</td><td>8.12 ± 0.85</td><td>9.56 ± 0.85</td><td>2.48 ± 0.26</td><td>1.69</td></tr></tbody></table>

## 3.2. XYZ Visualization on CIE Chromaticity Diagram

To visually compare the XYZ values of the leaves and charts, the distribution of the XYZ values of plant leaves, the 5GY Munsell chart, and the McBeth color chart were developed on a chromaticity diagram of CIE (Figure 6). As the figure represents, the XYZ values of the Munsell chart are quite close to the ones of plants; however, it does not lead to the best estimation. This normally happens as the covered zone of the chart does not cover all of the zones enclosing the colors of leaves. On the other side, the Macbeth chart, which covers a remarkable zone of the CIE diagram, leads to the best RGB-to-XYZ transformation. In other words, it covers a larger zone of the chromaticity diagram, and this might have led to a better model of the RGB-to-XYZ transformation.

<figure><img src="image_10.png" /><figcaption>**Figure 6.** The distribution of the obtained XYZ values on the CIE chromaticity diagram; (a) for plant leaves, (b) for Munsell 5GY, and (c) for MacBeth color chart. The figure represents the area of the chromaticity diagram covered by XYZ values.</figcaption></figure>

## 3.3. Color Values of the Macbeth Chart

Table 4 displays the measured RGB and XYZ values for the Macbeth color chart. This result shows that the specific transformation obtained in this work can provide a proper estimation of the XYZ values. Table 5 illustrates the transformation matrix obtained based on the Macbeth color chart.

The results of this study provide a good estimation of the XYZ values as the main colorimetric information based on RGB images is accessible and available to everybody. This will make it possible to easily identify colorimetric information. The extraction of XYZ values directly, which includes the use of colorimetric systems or spectrophotometers, has been reported [44–48]. Moreover, this study shows that this technique is quick, inexpensive, accessible, and adaptable to greenhouses and farms. The adaptation of colorimeters or spectrophotometers for the measurement of colorimetric coordinates can be achieved as
well. Sanmartín et al. [49] studied the measurement of the colorimetric coordinates of small plant samples by proposing a method based on cardboard adaptors on two aperture masks of a portable spectrophotometer.

<table><caption>**Table 4.** Measured RGB and XYZ values of the Macbeth chart patches.</caption><thead><tr><th>No.</th><th>Color Name</th><th>R</th><th>G</th><th>B</th><th>X</th><th>Y</th><th>Z</th></tr></thead><tbody><tr><td>1</td><td>Dark skin</td><td>40.715</td><td>19.932</td><td>7.843</td><td>14.015</td><td>11.452</td><td>3.304</td></tr><tr><td>2</td><td>Light skin</td><td>142.105</td><td>80.072</td><td>72.139</td><td>47.207</td><td>37.287</td><td>11.082</td></tr><tr><td>3</td><td>Blue sky</td><td>44.456</td><td>56.353</td><td>85.221</td><td>17.697</td><td>17.789</td><td>15.487</td></tr><tr><td>4</td><td>Foliage</td><td>30.563</td><td>43.947</td><td>6.83</td><td>12.703</td><td>14.737</td><td>3.267</td></tr><tr><td>5</td><td>Blue flower</td><td>68.302</td><td>64.338</td><td>108.169</td><td>25.675</td><td>22.793</td><td>19.663</td></tr><tr><td>6</td><td>Bluish green</td><td>71.314</td><td>138.944</td><td>112.542</td><td>31.415</td><td>39.694</td><td>19.058</td></tr><tr><td>7</td><td>Orange</td><td>168.558</td><td>60.976</td><td>11.362</td><td>50.874</td><td>36.332</td><td>3.088</td></tr><tr><td>8</td><td>Purplish blue</td><td>28.79</td><td>35.618</td><td>96.506</td><td>12.318</td><td>10.721</td><td>17.728</td></tr><tr><td>9</td><td>Moderate red</td><td>127.06</td><td>29.738</td><td>40.296</td><td>38.35</td><td>23.759</td><td>6.0848</td></tr><tr><td>10</td><td>Purple</td><td>24.963</td><td>10.327</td><td>35.465</td><td>8.915</td><td>6.902</td><td>6.67</td></tr><tr><td>11</td><td>Yellow green</td><td>106.278</td><td>132.158</td><td>29.337</td><td>39.913</td><td>45.917</td><td>4.892</td></tr><tr><td>12</td><td>Orange green</td><td>172.172</td><td>102.714</td><td>14.722</td><td>57.653</td><td>49.495</td><td>3.46</td></tr><tr><td>13</td><td>Blue</td><td>9.58</td><td>15.383</td><td>70.005</td><td>6.309</td><td>5.133</td><td>12.388</td></tr><tr><td>14</td><td>Green</td><td>40.627</td><td>81.672</td><td>23.241</td><td>16.956</td><td>23.333</td><td>4.363</td></tr><tr><td>15</td><td>Red</td><td>83.234</td><td>7.314</td><td>7.453</td><td>26.225</td><td>15.421</td><td>2.473</td></tr><tr><td>16</td><td>Yellow</td><td>193.399</td><td>149.229</td><td>30.532</td><td>72.057</td><td>67.502</td><td>4.203</td></tr><tr><td>17</td><td>Magenta</td><td>110.476</td><td>30.323</td><td>84.634</td><td>34.178</td><td>21.391</td><td>14.285</td></tr><tr><td>18</td><td>Cyan</td><td>22.154</td><td>69.766</td><td>106.333</td><td>13.169</td><td>16.50</td><td>17.114</td></tr><tr><td>19</td><td>White</td><td>206.599</td><td>204.274</td><td>201.111</td><td>93.589</td><td>89.349</td><td>40.112</td></tr><tr><td>20</td><td>Neutral 8</td><td>152.000</td><td>148.728</td><td>149.521</td><td>62.115</td><td>59.369</td><td>28.256</td></tr><tr><td>21</td><td>Neutral 6.5</td><td>99.383</td><td>96.282</td><td>96.719</td><td>37.446</td><td>35.63</td><td>17.299</td></tr><tr><td>22</td><td>Neutral 5</td><td>53.804</td><td>52.27</td><td>49.446</td><td>20.095</td><td>19.184</td><td>9.107</td></tr><tr><td>23</td><td>Neutral 3.5</td><td>22.153</td><td>20.886</td><td>18.706</td><td>9.20</td><td>8.821</td><td>4.416</td></tr><tr><td>24</td><td>Black</td><td>6.421</td><td>6.295</td><td>7.497</td><td>3.598</td><td>3.428</td><td>1.719</td></tr></tbody></table>

<table><caption>**Table 5.** Transformation matrix obtained for Macbeth color chart.</caption><tr><td>0.2446</td><td>0.0060</td><td>-0.0100</td><td>0.0002</td><td>0.0005</td><td>0.0003</td><td>3.0619</td></tr><tr><td>0.1175</td><td>0.1465</td><td>-0.0313</td><td>0.0002</td><td>0.0006</td><td>0.0002</td><td>2.9859</td></tr><tr><td>0.0045</td><td>0.0101</td><td>0.1058</td><td>-3.9546</td><td>-0.0001</td><td>0.0005</td><td>1.7726</td></tr></table>

## 4. Conclusions

This work aimed at the estimation of the XYZ coordinates of leaf color for six different plants based on inexpensive and accessible digital images. Several transformation matrices based on eight different color charts were obtained and compared. This study demonstrates that the transformation matrix obtained from the Macbeth color chart provided the best transformation of RGB to XYZ values for plant samples. The results obtained from the Macbeth color chart show a very precise transformation, with standard color differences of less than 1.97 based on ΔE2000, while the conventional general matrix resulted in color differences over 4.5 for different plants. Also, Munsell color charts 5GY and 7.5GY led to acceptable color differences. Among the Munsell color charts, 5GY provided the best transformation of RGB to XYZ values. It was observed that the proposed transformation matrices based on Macbeth and Munsell charts lead to more accurate estimations compared to the general transformation matrix. Therefore, the proposed transformation matrix is a proper solution for the extraction of color information in agricultural applications to provide an inexpensive, quick, and reliable technique for the estimation of XYZ coordinates of plant leaf color.
**Supplementary Materials:** The following supporting information can be downloaded at: https://www.mdpi.com/article/10.3390/s24237728/s1.

**Author Contributions:** Conceptualization, K.A.; Investigation, V.M.; Methodology, V.M. and H.A.; Project administration, K.A.; Software, V.M. and H.A.; Supervision, K.A.; Validation, P.G.; Writing—original draft, V.M.; Writing—review and editing, K.A. and P.G. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research received no external funding.

**Institutional Review Board Statement:** Plant samples, including cucumber, eggplant, onion, pepper, sugar beet, and tomato, were kindly provided by Dr. Ansari from Parvaneh farm (Tehran, Iran).

**Informed Consent Statement:** Not applicable.

**Data Availability Statement:** Data is contained within the article and Supplementary Materials.

**Acknowledgments:** The authors appreciate the Department of Color Imaging and Color Image Processing of the Institute for Color Science and Technology, Tehran, Iran for the support and facilities provided for this research.

**Conflicts of Interest:** The authors declare no conflict of interest.

## References

1. Kasajima, I. Measuring plant colors. *Plant Biotechnol. 2019*, *36*, 63–75. [CrossRef] [PubMed]

2. Neupane, K.; Baysal-Gurel, F. Automatic identification and monitoring of plant diseases using unmanned aerial vehicles: A review. *Remote Sens. 2021*, *13*, 3841. [CrossRef]

3. Panneton, B.; Brouillard, M. Colour representation methods for segmentation of vegetation in photographs. *Biosyst. Eng.* **2009**, *102*, 365–378. [CrossRef]

4. Mohammadi, V.; Kheiralipour, K.; Ghasemi-Varnamkhasti, M. Detecting maturity of persimmon fruit based on image processing technique. *Sci. Hortic.* **2015**, *184*, 123–128. [CrossRef]

5. Khojastehnazhand, M.; Mohammadi, V.; Minaei, S. Maturity detection and volume estimation of apricot using image processing technique. *Sci. Hortic.* **2019**, *251*, 247–251. [CrossRef]

6. Bahrami, M.E.; Ansari, K. Correlation between colorimetric parameters and physicochemical properties of Iranian raw cane sugars. *Color. Technol.* **2015**, *10*, 12.

7. Cubero, S.; Albert, F.; Prats-Moltalbán, J.M.; Fernandez-Pacheco, D.G.; Blasco, J.; Aleixos, N. Application for the estimation of the standard citrus colour index (CCI) using image processing in mobile devices. *Biosyst. Eng.* **2018**, *167*, 63–74. [CrossRef]

8. Ramesh, S.; Hebbar, R.; Niveditha, M.; Pooja, R.; Shashank, N.; Vinod, P.V. Plant disease detection using machine learning. In Proceedings of the 2018 International Conference on Design Innovations for 3Cs Compute Communicate Control (ICDI3C) 2018, Bangalore, India, 25–26 April 2018; pp. 41–45.

9. Kaya, Y.; GÜRsoy, E. A novel multi-head CNN design to identify plant diseases using the fusion of RGB images. *Ecol. Inform.* **2023**, *75*, 101998. [CrossRef]

10. Halder, M.; Sarkar, A.; Bahar, H. Plant disease detection by image processing: A literature review. *Image 2019*, *1*, 3. [CrossRef]

11. Kulkarni, P.; Shastri, S. Rice leaf diseases detection using machine learning. *J. Sci. Res. Technol.* **2024**, *1*, 17–22.

12. Ge, Y.; Bai, G.; Stoerger, V.; Schnable, J.C. Temporal dynamics of maize plant growth, water use, and leaf water content using automated high throughput RGB and hyperspectral imaging. *Comput. Electron. Agric.* **2016**, *127*, 625–632. [CrossRef]

13. Tao, M.; Ma, X.; Huang, X.; Liu, C.; Deng, R.; Liang, K.; Qi, L. Smartphone-based detection of leaf color levels in rice plants. *Comput. Electron. Agric.* **2020**, *173*, 105431. [CrossRef]

14. Bodner, G.; Alsalem, M.; Nakhforoosh, A.; Arnold, T.; Leitner, D. RGB and spectral root imaging for plant phenotyping and physiological research: Experimental setup and imaging protocols. *JOVE 2017*, *126*, e56251. [CrossRef]

15. Castillo-Martínez, M.Á.; Gallegos-Funes, F.J.; Carvajal-Gámez, B.E.; Urriolagoitia-Sosa, G.; Rosales-Silva, A.J. Color index based thresholding method for background and foreground segmentation of plant images. *Comput. Electron. Agric.* **2020**, *178*, 105783. [CrossRef]

16. Sweet, D.D.; Tirado, S.B.; Springer, N.M.; Hirsch, C.N.; Hirsch, C.D. Opportunities and challenges in phenotyping row crops using drone-based RGB imaging. *Plant Phenom. J.* **2022**, *5*, e20044. [CrossRef]

17. Rigon, J.P.G.; Capuani, S.; Fernandes, D.M.; Guimarães, T.M. A novel method for the estimation of soybean chlorophyll content using a smartphone and image analysis. *Photosynthetica* **2016**, *54*, 559–566. [CrossRef]

18. Zhang, H.; Ge, Y.; Xie, X.; Atefi, A.; Wijewardane, N.K.; Thapa, S. High throughput analysis of leaf chlorophyll content in sorghum using RGB, hyperspectral, and fluorescence imaging and sensor fusion. *Plant Methods* **2022**, *18*, 60. [CrossRef]

19. Guo, Y.; Yin, G.; Sun, H.; Wang, H.; Chen, S.; Senthilnath, J.; Wang, J.; Fu, Y. Scaling effects on chlorophyll content estimations with RGB camera mounted on a UAV platform using machine-learning methods. *Sensors* **2020**, *20*, 5130. [CrossRef]
20. Jeyalakshmi, S.; Radha, R. A review on diagnosis of nutrient deficiency symptoms in plant leaf image using digital image processing. *ICTACT J. Image Video Process.* **2017**, *7*, 1515–1524. [CrossRef]

21. Yi, J.; Krusenbaum, L.; Unger, P.; Hüging, H.; Seidel, S.J.; Schaaf, G.; Gall, J. Deep learning for non-invasive diagnosis of nutrient deficiencies in sugar beet using RGB images. *Sensors* **2020**, *20*, 5893. [CrossRef]

22. Janani, M.; Jebakumar, R. Detection and classification of groundnut leaf nutrient level extraction in RGB images. *Adv. Eng. Softw.* **2023**, *175*, 103320. [CrossRef]

23. Patel, A.; Kadam, P.; Naik, S. Color, size and shape feature extraction techniques for fruits: A technical review. *Int. J. Comput. Appl.* **2015**, *130*, 6–10. [CrossRef]

24. Magnusson, M.; Sigurdsson, J.; Armansson, S.E.; Ulfarsson, M.O.; Deborah, H.; Sveinsson, J.R. Creating RGB images from hyperspectral images using a color matching function. In *Proceedings of the IGARSS 2020–2020 IEEE International Geoscience and Remote Sensing Symposium, Gujarat, India*, 2–4 December 2020; pp. 2045–2048.

25. Montazeri, M.; Nateri, A.S.; Ansari, K. Recovering spectral data of metallic paints at various observation angles by digital camera. *Sensor Rev.* **2014**, *34*, 89–97. [CrossRef]

26. Zhang, Y.; Liu, T.; Yu, P.; Wang, S.; Tao, R. SFSANet: Multiscale Object Detection in Remote Sensing Image Based on Semantic Fusion and Scale Adaptability. *IEEE Trans. Geosci. Remote Sens.* **2024**, *62*, 5611215. [CrossRef]

27. Ahmad, N.; Asif, H.M.S.; Saleem, G.; Younus, M.U.; Anwar, S.; Anjum, M.R. Leaf image-based plant disease identification using color and texture features. *Wirel. Pers. Commun.* **2021**, *121*, 1139–1168. [CrossRef]

28. Shrivastava, V.K.; Pradhan, M.K. Rice plant disease classification using color features: A machine learning paradigm. *J. Plant Pathol.* **2021**, *103*, 17–26. [CrossRef]

29. Abd El-Ghany, N.M.; Abd El-Aziz, S.E.; Marei, S.S. A review: Application of remote sensing as a promising strategy for insect pests and diseases management. *Environ. Sci. Pollut. Res.* **2020**, *27*, 33503–33515. [CrossRef]

30. Yam, K.L.; Papadakis, S.E. A simple digital imaging method for measuring and analyzing color of food surfaces. *J. Food Eng.* **2004**, *61*, 137–142. [CrossRef]

31. Carney, M.N.; Johnston, W.M. A novel regression model from RGB image data to spectroradiometric correlates optimized for tooth colored shades. *J. Dent.* **2016**, *51*, 45–48. [CrossRef]

32. Funt, B.; Ghaffari, R.; Bastani, B. Optimal linear RGB-to-XYZ mapping for color display calibration. In *Color and Imaging Conference; Society for Imaging Science and Technology: Springfield, VA, USA, 2004; Volume 12*, pp. 223–227.

33. Xiong, W.; Funt, B. Nonlinear RGB-to-XYZ mapping for device calibration. In *Color and Imaging Conference; Society for Imaging Science and Technology: Springfield, VA, USA, 2005; Volume 2005*, pp. 200–204.

34. Griesbach, R.J.; Austin, S. Comparison of the Munsell and Royal Horticultural Society’s color charts in describing flower color. *Taxon* **2005**, *54*, 771–773. [CrossRef]

35. Leon, K.; Mery, D.; Pedreschi, F.; Leon, J. Color measurement in L*a*b* units from RGB digital images. *Food Res. Int.* **2006**, *39*, 1084–1091. [CrossRef]

36. Kumah, C.; Zhang, N.; Raji, R.K.; Pan, R. Color Measurement of Segmented Printed Fabric Patterns in Lab Color Space from RGB Digital Images. *J. Textile Sci. Technol.* **2019**, *5*, 1–18. [CrossRef]

37. Bianco, S.; Gasparini, F.; Russo, A.; Schettini, R. A new method for RGB to XYZ transformation based on pattern search optimization. *IEEE Trans. Consum. Electron.* **2007**, *53*, 1020–1028. [CrossRef]

38. Pegalajar, M.C.; Sánchez-Marañón, M.; Baca Ruíz, L.G.; Mansilla, L.; Delgado, M. Artificial neural networks and fuzzy logic for specifying the color of an image using munsell soil-color charts. In *International Conference on Information Processing and Management of Uncertainty in Knowledge-Based Systems*; Springer International Publishing: Cham, Switzerland, 2018; pp. 699–709.

39. Pegalajar, M.C.; Ruiz, L.G.B.; Sánchez-Marañón, M.; Mansilla, L. A Munsell colour-based approach for soil classification using Fuzzy Logic and Artificial Neural Networks. *Fuzzy Sets Syst.* **2020**, *401*, 38–54. [CrossRef]

40. CIE. Colorimetry. CIE 15 Technical Report, 3rd ed.; International Commission on Illumination: Washington, DC, USA, 2004.

41. Westland, S.; Ripamonti, C.; Cheung, V. *Computational Colour Science Using MATLAB*; John Wiley & Sons: Hoboken, NJ, USA, 2012.

42. Fan, Z.; Herrick, J.E.; Saltzman, R.; Matteis, C.; Yudina, A.; Nocella, N.; Crawford, E.; Parker, R.; Van Zee, J. Measurement of soil color: A comparison between smartphone camera and the Munsell color charts. *Soil Sci. Soc. Am. J.* **2017**, *81*, 1139–1146. [CrossRef]

43. Berndt, W.L.; Gaussoin, R.E. Predicting Munsell color for turfgrass leaves. *Crop Sci.* **2023**, *63*, 1566–1580. [CrossRef]

44. Tang, Y.; Fang, Z.; Liu, M.; Zhao, D.; Tao, J. Color characteristics, pigment accumulation and biosynthetic analyses of leaf color variation in herbaceous peony (*Paeonia lactiflora* Pall.). *3 Biotech* **2020**, *10*, 76. [CrossRef]

45. Liu, B.; Zhuang, J.; Wei, G. Recent advances in the design of colorimetric sensors for environmental monitoring. *Environ. Sci. Nano* **2020**, *7*, 2195–2213. [CrossRef]

46. Bej, G.; Dey, T.; Majumdar, S.; Pal, A.; Akuli, A.; Sutradhar, T.; Banerjee, R.; Bhattacharyya, N.; Kotwaliwale, N. Comparison of different color models for priority based color matching of plant parts used in DUS testing 2021. In *Proceedings of the International Conference on Computational Intelligence, Data Science and Cloud Computing: IEM-ICDC 2020*; Springer: Singapore, 2021; pp. 471–486.

47. Hastuti, D.; Manessa, M.D.M.; Tambunan, M.P. Tea Plant Health Research Using Spectrometer. *Int. J. Remote Sens. Earth Sci.* **IJReSES** **2023**, *19*, 177–184. [CrossRef]
48. Falcioni, R.; Antunes, W.C.; Demattê, J.A.M.; Nanni, M.R. A novel method for estimating chlorophyll and carotenoid concentrations in leaves: A two hyperspectral sensor approach. *Sensors* **2023**, *23*, 3843. [CrossRef]

49. Sanmartín, P.; Gambino, M.; Fuentes, E.; Serrano, M. A simple, reliable, and inexpensive solution for contact color measurement in small plant samples. *Sensors* **2020**, *20*, 2348. [CrossRef]

**Disclaimer/Publisher's Note:** The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.