rasterLocalSums: Local sums for an in memory raster image.
Description
rasterLocalSums finds the local sum within the weighted neighborhood of W.
Usage
rasterLocalSums(r, W)
Arguments
r
An in memory raster image.
W
A matrix of weights. The sums will be applied at each centroid.
Dimensions must be non-zero and odd. Only non-missing neighbors are used in
the sum.
Value
An in memory raster image of local sums.
Details
A spatial neighborhood is calculated for each pixel in r.
The spatial neighborhood for each pixel is defined by the weight matrix
W, where the center of the odd dimensioned matrix W is identified
with the target pixel. The target pixel value is replaced with the sum of
all pixels within the neighborhood weighted by W. Only non-missing
or neighbors with non-zero weights are used in the calculation.