#' Basic RGB indices
#'
#' Computes basic RGB indices including normalized red (r), green (g),
#' blue (b), and intensity (INT) from an RGB image.
#'
#' @param image A RasterBrick or RasterStack object with three bands (R, G, B).
#'
#' @return
#' A RasterStack object with seven layers:
#' \itemize{
#'   \item R, G, B: Original red, green, and blue bands
#'   \item r, g, b: Normalized RGB indices
#'   \item INT: Intensity component (mean of R, G, B)
#' }
#'
#' @examples
#' set.seed(123)
#' r <- raster::raster(matrix(runif(50*50), 50, 50))
#' g <- raster::raster(matrix(runif(50*50), 50, 50))
#' b <- raster::raster(matrix(runif(50*50), 50, 50))
#' img <- raster::stack(r, g, b)
#' rgb_basic(img)
#'
#' @export
rgb_basic <- function(image){
  suppressWarnings({
    img <- raster::brick(image)
    R <- img[[1]]; G <- img[[2]]; B <- img[[3]]
    r <- R/(R+G+B); g <- G/(R+G+B); b <- B/(R+G+B)
    INT <- (R+G+B)/3
    out <- raster::stack(R,G,B,r,g,b,INT)
    names(out) <- c("R","G","B","r","g","b","INT")
    out[!is.finite(out)] <- NA
    out
  })
}