Normalize numeric and raster data.
normalize(r, mn = NULL, mx = NULL, force_range = FALSE)
An object from the same class as r
with values from r
linearly rescaled to make mn
equal to zero and mx
equal to
one. Therefore, if mn
and mx
do not match the actual minimum
and maximum from r
, then the output will not cover the 0-to-1 range
and may be outside that range if force_range
is set to FALSE
.
SpatRaster or numeric vector.
Numeric vector of length one. Minimum expected value. Default is
equivalent to enter the minimum value from r
.
Numeric vector of length one. Maximum expected value. Default is
equivalent to enter the maximum value from r
.
Logical vector of length one. If it is TRUE
, the
range is forced to be between 0
and 1
by flattening values
found below and above those limits.
Normalize data laying between mn
and mx
to the range 0
to 1
. Data greater than mx
get values greater than 1
in
a proportional fashion. Conversely, data less than mn
get values less
than 0
.This function can be used for linear stretching of the
histogram.
Other Pre-processing Functions:
enhance_caim()
,
gbc()
,
local_fuzzy_thresholding()
,
membership_to_color()