varRGB | R Documentation |
varRGB
creates red-green-blue (RGB) images as a RasterStack
by
scaling the pixel values to 0-255 color range.
varRGB(red, green, blue, q.range = c(), rPath = NULL, region = NULL)
red |
a |
green |
a |
blue |
a |
q.range |
a vector with the minimum and maximum reflectance quantiles being considered. |
rPath |
the file path where the resulting RGB image is saved. |
region |
a |
The function rescales the original reflectance values to a range of 0-255.
The function re-arranges the RGB bands to create a stack ready to visualize
with plotRGB. Bands may contain outliers which cause the image to look dark.
Use the q.range
argument to remove the outliers and get a
better-looking image.
# path to the cropped and cutted MODIS images for the region of Navarre wdir <- system.file("ExNavarreVar", package = "RGISTools") # list all the tif files files.mod <- list.files(wdir, pattern="\\.tif$", recursive = TRUE, full.names = TRUE) # print the MOD09 bands getRGISToolsOpt("MOD09BANDS") # select the red, blue and NIR bands img.mod.red <- raster(files.mod[1]) img.mod.blue <- raster(files.mod[3]) img.mod.green <- raster(files.mod[4]) q.range=c(0.001,0.999) img.mod.rgb<-varRGB(img.mod.red,img.mod.green,img.mod.blue,q.range) print(plotRGB(img.mod.rgb))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.