Description Usage Arguments Details Value Examples
rasterLocalSums
finds the local sum within the weighted neighborhood of W.
1 | rasterLocalSums(r, W)
|
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. |
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.
An in memory raster image of local sums.
1 2 3 | r <- raster::raster( matrix(rnorm(36),6,6))
W <- matrix(1,3,3)
sumR <- rasterLocalSums(r,W)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.