# rgbIndices

An R package for computing RGB-based vegetation and color indices from digital images.

## Installation

```r
devtools::install_local("rgbIndices")
```

## Example

```r
library(rgbIndices)
library(raster)

# ---------------------------
# Fast example (CRAN-safe)
# ---------------------------
r <- raster(matrix(runif(30*30), 30, 30))
g <- raster(matrix(runif(30*30), 30, 30))
b <- raster(matrix(runif(30*30), 30, 30))
img <- stack(r, g, b)

# Compute indices
idx  <- rgb_basic(img)
idx1 <- rgb_diff(img)
idx2 <- rgb_ratio(img)
idx3 <- rgb_normdiff(img)
idx4 <- rgb_veg(img)
idx5 <- rgb_color(img)

# Summary statistics
rgb_indices_to_mean(idx)

# Convert to table
tbl <- rgb_indices_to_tbl(idx)
head(tbl)

# ---------------------------
# Real image example
# ---------------------------
img_real <- stack(rgb_example())
plotRGB(img_real)
rgb_basic(img_real)
```

## Applications

* Crop phenotyping
* Disease detection
* Precision agriculture
* Image-based modeling

## Reference
Singh, R. N., Krishnan, P., Singh, V. K., & Das, B. (2023). Estimation of yellow rust severity in wheat using visible and thermal imaging coupled with machine learning models. *Geocarto International*.  
https://www.tandfonline.com/doi/full/10.1080/10106049.2022.2160831
## Authors

RN Singh
Bappa Das
Sonam
Anil Kumar
Santosha Rathod (Maintainer)

Email: [santoshagriculture@gmail.com](mailto:santoshagriculture@gmail.com)
