Learn R Programming

RStoolbox (version 0.1.1)

rescaleImage: Linear image rescaling

Description

performs linear shifts of value ranges either to match min and max of another image or to any other min and max value.

Usage

rescaleImage(x, y, xmin, xmax, ymin, ymax, forceMinMax = FALSE)

Arguments

x
Raster* object. Image to normalise.
y
Raster* object. Reference image.
xmin
Numeric. Min value of x.
xmax
Numeric. Max value of x.
ymin
Numeric. Min value of y.
ymax
Numeric. Max value of y.
forceMinMax
Logical. Forces update of min and max data slots in x or y.

Value

  • Returns a Raster* object of the same dimensions as the input raster x but shifted and stretched to the new limits.

See Also

histMatch

Examples

Run this code
## Create example data
data(lsat)
lsat2 <- lsat - 1000
lsat2

## Rescale lsat2 to match original lsat value rang
lsat2_rescaled <- rescaleImage(lsat2, lsat)
lsat2_rescaled

## Rescale lsat to value range [0,1]
lsat2_unity <- rescaleImage(lsat2, ymin = 0, ymax = 1)
lsat2_unity

Run the code above in your browser using DataLab