## -----------------------------------------------------------------------------
library(rgbIndices)
library(raster)

# ---------------------------
# Example
# ---------------------------
set.seed(123)
r <- raster::raster(matrix(runif(30*30), 30, 30))
g <- raster::raster(matrix(runif(30*30), 30, 30))
b <- raster::raster(matrix(runif(30*30), 30, 30))
img <- raster::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)

## ----eval=FALSE---------------------------------------------------------------
# img_real <- raster::stack(rgb_example())
# raster::plotRGB(img_real)
# rgb_basic(img_real)

