Extract spectral indices from RGB at the crown scale
Source:R/extract_rgbValues.R
extract_rgbValues.Rd
The function extracts RGB indices (red, green, blue, sumrgb,
rcc, gcc, bcc, gndvi, gli) for each crown at each date. It extracts the value
at the crown scale using the exactextractr::exact_extract
function. The mean and / or the variance can be extracted (see 'fun' parameter).
Usage
extract_rgbValues(
path_images,
path_crowns,
out_dir_path = NULL,
ncor = 1,
sites = NULL,
dates = NULL,
tempdir_custom = NULL,
file_type = ".RData"
)
Arguments
- path_images
list with the full paths to the RGB rasters.
- path_crowns
chr. Path to the crown delinetion shapefile
- out_dir_path
chr. The path to the directory use to stored the images
- ncor
Number of cores use in the parallelisation proccess.
- sites
chr. name of the site, p.e 'Mbalmayo'.
- dates
chr. vector of dates (format should be 'YYYY_MM_DD', p.e '2022_09_25'). The order of the dates should match with the order of the path_images !
- tempdir_custom
chr. Path where to store temporary files
- file_type
chr. By default it is '.RData' but can be '.csv' or '.xlsx'
Value
A tibble with the variable site, id, date, family, genus, species, type, metric, band and value.
Examples
if (FALSE) { # \dontrun{
imgs = list.files('my-path-to-images', full.names = T)
path_crowns = "my-path-to-crowns-shapefile"
out_dir_path = "output-directory"
rgb_data <- extract_rgbValues (
path_images = imgs,
path_crowns = path_crowns,
out_dir_path = out_dir_path,
ncor = 10,
sites = NULL,
dates = NULL
)
} # }