RStoolbox (version 1.0.0)

normImage: Normalize Raster Images: Center and Scale

Description

For each pixel subtracts the mean of the raster layer and optionally divide by its standard deviation.

Usage

normImage(img, norm = TRUE, ...)

Value

Returns a SpatRaster with the same number layers as input layers with each layer being centered and optionally normalized.

Arguments

img

SpatRaster. Image to transform. Transformation will be performed separately for each layer.

norm

Logical. Perform normalization (scaling) in addition to centering, i.e. divide by standard deviation.

...

further arguments passed to writeRaster.

Examples

Run this code
library(terra)
## Load example data

## Normalization: Center and Scale
rlogo_center_norm <- normImage(rlogo)
hist(rlogo_center_norm)

## Centering
rlogo_center <- normImage(rlogo, norm = FALSE)

Run the code above in your browser using DataLab