rRescale: Change the resolution of a raster

Description Usage Arguments Details Value See Also Examples

View source: R/modify.operators.R

Description

Rescaling a raster changes the raster's resolution.

Usage

1
rRescale(obj, factor = NULL, kernelFunction = NULL)

Arguments

obj

[RasterLayer(1)]
The object to modify.

factor

[integer(1) | numeric(1)]
an integer for up-scaling and a fraction for down-scaling (see Details).

kernelFunction

[kernelFunction]
A kernel function to determine new values of the rescaled raster, defaulting to boxKernel(); see Details.

Details

The factor is a value by which the number of cells in x and y dimension will be multiplied. If the raster should be up-scaled (factor > 1), only integer values are allowed (will be truncated if it is not an integer). If the raster should be down-scaled (factor < 1) any inverse of an integer value (1/n) is allowed (denominator will be rounded to the next integer, such as 1/2 or 1/5).

The kernelFunction used here deviates from the other (morpholological) kernels in that it is a function, which interpolates the values of new cells. See kernelFunction for an in-depth description.

Value

A RasterLayer with a dimension that has been up or down-scaled from obj, where the new values have been determined by applying kernelFunction.

See Also

Other operators to modify a raster: rBlend, rReduce, rSegregate

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
input <- rtRasters$continuous
visualise(input)
visualise(rRescale(input, factor = 0.5))

# up-scaling can be useful for follow-up morphological operations
binarised <- rBinarise(input, thresh = 30)
visualise(rSkeletonise(binarised))

rescaled <- rRescale(binarised, factor = 2)
visualise(rSkeletonise(rescaled), new = TRUE)

EhrmannS/rasterTools documentation built on Sept. 4, 2019, 10:34 a.m.