Getting started
In this vignette, you will learn about the color space indexes provided by the package, with a focus on the RGB color space, the HSB color space, and the CIE-Lab color space.
Throughout the vignette, we will delve into the underlying formulas and methodologies used for converting colors between different color spaces, ensuring that you have a comprehensive understanding of how these transformations work.
RGB Color Space
The RGB (Red, Green, Blue) color space is a widely used color
representation in computer graphics and digital imaging. In the
pliman
package, we provide a range of indexes to analyze
and manipulate color data within the RGB color space:
Indexes in the RGB Color Space
Abbreviation | Name | Formula | Reference |
---|---|---|---|
R | Red (650 nm) | R |
|
G | Green (545 nm) | G |
|
B | Blue (445 nm) | B |
|
NR | Normalized Red | R / (R + G + B) |
Yang et al. (2015) |
NG | Normalized Green | G / (R + G + B) |
Yang et al. (2015) |
NB | Normalized Blue | B / (R + G + B) |
Yang et al. (2015) |
GB | Green-Blue Ratio | G / B |
|
RB | Red-Blue Ratio | R / B |
|
GR | Green-Red Ratio | G / R |
|
BI | Brightness Index | sqrt((R^2 + G^2 + B^2) / 3) |
Richardson and Wiegand (1977) |
BI2 | Brightness Index 2 | sqrt((R^2 + G^2 + B^2) / 3) |
|
SCI | Soil Colour Index | (R - G) / (R + G) |
Mathieu et al. (1998) |
GLI | Green Leaf Index | ((G-R)+(G-B))/(G+R+G+B) |
Louhaichi, Borman, and Johnson (2001) |
HI | Primary Colours Hue Index | (2*R-G-B)/(G-B) |
Escadafal, Belghit, and Ben-Moussa (1994) |
NGRDI | Normalized Green-Red Difference Index | (G-R)/(G+R) |
Tucker (1979) |
NGBDI | Normalized Green-Blue Difference Index | (G-B)/(G+B) |
Bannari et al. (1995) |
SI | Normalized Red-Blue Difference Index | (R-B)/(R+B) |
Escadafal, Belghit, and Ben-Moussa (1994) |
I | Total intensity | R + G + B |
|
S | Saturation | ((R + G + B) - 3 * B) / (R + G + B) |
|
L | Average Intensity | (R + G + B) / 3 |
|
VARI | Visible Atmospherically Resistant Index | (G-R)/(G+R-B) |
Anatoly A. Gitelson et al. (2002a) |
HUE | Overall Hue Index | atan(2*(B-G-R)/30.5*(G-R)) |
Escadafal, Belghit, and Ben-Moussa (1994) |
HUE2 | Overall Hue Index 2 | atan(2*(R-G-R)/30.5*(G-B)) |
Escadafal, Belghit, and Ben-Moussa (1994) |
BGI | Blue Green Pigment | B/G |
Zarco-Tejada et al. (2005) |
GRAY | 0.299 * R + 0.587 * G + 0.114 * B |
||
GRAY2 | ((R^2.2 + (1.5 * G)^2.2 + (0.6 * B)^2.2) / (1 + 1.5^2.2 + 0.6^2.2))^(1/2.2) |
||
GLAI | (25 * (G - R) / (G + R - B) + 1.25) |
||
CI | Coloration Index | ((R - B) / R) |
|
SAT | Overall Saturation Index | ((max(R, G, B) - min(R, G, B)) / max(R, G, B)) |
|
SHP | Shape Index | (2 * (R - G - B) / (G - B)) |
|
RI | Redness Index | (R^2 / (B * G^3)) |
|
SAVI | Soild Adjusted Vegetation Index | (1 + 0.5)*(G-R)/(G+R+0.5) |
Li et al. (2010) |
Multispectral indexes
{pliman} provides tools to analyze up to 5 bands , which are generally B, G, R, RE (red-edge) and NIR (near-infrared). The following build-in indexes are available.
Abbreviation | Name | Formula | Reference |
---|---|---|---|
NDVI | Normalized Diference Vegetation Index | (NIR - R) / (NIR + R) |
Kriegler (1969) |
PSRI | Plant Senescence Reflectance Index | (R-G)/RE |
Merzlyak et al. (1999) |
GNDVI | Normalized Difference NIR/G | (NIR - G) / (NIR + G) |
Anatoly A. Gitelson and Merzlyak (1996) |
RVI | Ratio Vegetation Index | R/NIR |
Pearson and Miller (1972) |
VIN | Vegetation Index Number | NIR/R |
Pearson and Miller (1972) |
NDRE | Normalized Difference NIR/Rededge | (NIR-RE)/(NIR+RE) |
A. Gitelson and Merzlyak (1994) |
SAVI | Soild Adjusted Vegetation Index | ((NIR-R) / (NIR + R + 0.5) * 1 + 0.5) |
A. R. Huete (1988) |
TSAVI | Transformed Soil Adjusted Vegetation Index | (2*((NIR-2)*(R-1)))/(R+2*(NIR-1)+0.5*(1+2*2)) |
Baret, Guyot, and Major (1989) |
TVI | Transformed Vegetation Index | sqrt((NIR - R) / (NIR + R) + 0.5) |
Broge and Leblanc (2001) |
CVI | Chlorophyll vegetation index | NIR*(R/G^2) |
Vincini, Frazzi, and D’Alessio (2008) |
EVI | Enhanced Vegetation Index | 2.5*(NIR-R)/(NIR+6*R-7.5*B+1) |
A. Huete et al. (2002) |
CIG | Chlorophyll Index Green | (NIR/G)-1 |
Anatoly A. Gitelson, Gritz †, and Merzlyak (2003) |
CIRE | Chlorophyll Index - Red-Edge | (NIR/RE)-1 |
Anatoly A. Gitelson, Gritz †, and Merzlyak (2003) |
RESR | Red-Edge Simple Ratio | NIR/RE |
Anatoly A. Gitelson et al. (2002b) |
GDVI | Green Difference Vegetation Index | NIR-G |
Index DataBase (2023) |
REDVI | Red-Edge Difference Vegetation Index | NIR-RE |
Jordan (1969) |
NDWI | Normalized Difference Water Index | (G-NIR)/(G+NIR) |
McFEETERS (1996) |
CVI | Chlorophyll vegetation index | NIR * (R/(G*G)) |
Index DataBase (2023) |
PNDVI | Pan NDVI | ((NIR-(G+R+B))/(NIR+(G+R+B))) |
Index DataBase (2023) |
CCCI | Canopy Chlorophyll Content Index | ((NIR-R)/(NIR+R))/((NIR-R)/(NIR+R)) |
Index DataBase (2023) |
OSAVI | Optimized Soil Adjusted Vegetation Index | (NIR-R)/(NIR+R+0.16) |
Rondeaux, Steven, and Baret (1996) |
GOSAVI | Green Optimized Soil Adjusted Vegetation Index | (NIR-G)/(NIR+G+0.16) |
Index DataBase (2023) |
GSAVI | Green Soil Adjusted Vegetation Index | ((NIR-G)/(NIR+G+0.5))*(1+0.5) |
Index DataBase (2023) |
BAI | Burn Area Index | 1/((0.1 - R)^2 + (0.06 - NIR)^2) |
Chuvieco, Martín, and Palacios (2002) |
GEMI | Global Environmental Monitoring Index | (2*(NIR*NIR-R*R)+1.5*NIR+0.5*R)/(NIR+R+0.5)*(1-0.25*(2*(NIR*NIR-R*R)+1.5*NIR+0.5*R)/(NIR+R+0.5))-((R-0.125)/(1-R)) |
Pinty and Verstraete (1992) |
MSAVI | Modified Soil Adjusted Vegetation Index | (1/2)*(2*(NIR+1)-sqrt((2*NIR+1)*2-8*(NIR-R))) |
Qi et al. (1994) |
MSAVI2 | Modified Soil Adjusted Vegetation Index 2 | (2 * NIR + 1 - sqrt((2 * NIR + 1)^2 - 8 * (NIR - R) )) / 2 |
Qi et al. (1994) |
VIG | Vegetation Index (green) | (G-R)/(G+R) |
Anatoly A. Gitelson et al. (2002c) |
VIRE | Vegetation Index (red-edge) | (RE-R)/(RE+R) |
Anatoly A. Gitelson et al. (2002c) |
VARIRE | Visible Atmospherically Resistant Index (red-edge) | (RE - 1.7 * R + 0.7 * B) / (RE + 2.3 * R - 1.3 * B) |
Anatoly A. Gitelson et al. (2002c) |
ARVI | Atmospherically resistant vegetation index | (NIR - (R - 0.1*(R-B))) / (NIR + (R - 0.1*(R-B))) |
Kaufman and Tanre (1992) |
GARI | Green Atmospherically Resistant Index | (NIR - (1.7 * (B-R))) / (NIR + (1.7 * (B-R))) |
Anatoly A. Gitelson, Kaufman, and Merzlyak (1996) |
GRVI | Green Ratio Vegetation Index | NIR / G |
Sripada et al. (2006) |
IPVI | Infrared Percentage Vegetation Index | NIR / (NIR + R) |
Crippen (1990) |
LAI | Leaf Area Index | 3.368 * (2.5*(NIR-R)/(NIR+6*R-7.5*B+1)) - 0.118 |
Boegh et al. (2002) |
MSR | Modified Simple Ratio | (NIR / R - 1) / (sqrt(NIR / R) + 1) |
Chen (1996) |
NLI | Non-Linear index | (NIR ^2 - R) / (NIR ^2 + R) |
Goel and Qin (1994) |
RDVI | Renormalized Difference Vegetation Index | (NIR - R) / (sqrt(NIR + R)) |
Roujean and Breon (1995) |
TDVI | Transformed Difference Vegetation Index | 1.5 * ((NIR - R) / (sqrt(NIR ^2 + R + 0.5))) |
Bannari, Asalhi, and Teillet (2002) |
WDRVI | Wide Dynamic Range Vegetation Index | (0.2 * NIR - R) / (0.2 * NIR + R) |
Anatoly A. Gitelson (2004) |
ARI | Anthocyanin Reflectance Index | (1 / G) - (1 / RE) |
A. A. Gitelson, Merzlyak, and Chivkunova (2001) |
Usefull references
HSB Color Space
The HSB (Hue, Saturation, Brightness) color space is an alternative color representation that emphasizes the perceptual aspects of color.
Conversion to CIE-Lab
The rgb_to_hsb()
function can be used to convert RGB to
HSB color space. The conversion is performed according to described by
Karcher and Richardson (2003).
-
Hue (H):
- If max (R,G,B) = R,
H = 60 * (G - B) / (max(R,G,B) - min(R,G,B))
- If max (R,G,B) = G,
H = 60 * (2 + (B - R) / (max(R,G,B) - min(R,G,B))
- If max (R,G,B) = B,
H = 60 * (4 + (R - G) / (max(R,G,B) - min(R,G,B))
- If max (R,G,B) = R,
-
Saturation (S):
S = (max(R,G,B) - min(R,G,B)) / max(R,G,B)
-
Brightness (B):
B = max(R,G,B)
CIE-Lab Color Space
The CIE-Lab (CIELAB) color space is a color model that approximates
human vision and is often used for color difference analysis and color
correction. In the pliman
package, we support the
conversion from RGB to Lab color space.
Conversion to CIE-Lab
The conversion from RGB to Lab is performed by the
rgb_to_lab()
function in the pliman
package.
This involves several steps, including the transformation from RGB to
sRGB, sRGB to XYZ, and then from XYZ to Lab.
To understand the specific formulas and steps involved in this conversion, please refer to the detailed formulas.