Description Usage Arguments Details Value Examples
View source: R/rasterLocalCategoricalModes.R
rasterLocalCategoricalModes
finds the most popular category within the
weighted neighborhood of W
.
1 |
r |
An in memory raster image. Pixels should be whole numbers or |
W |
A matrix of weights. The modal kernel will be applied to each
pixel in |
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 most
popular value within the neighborhood weighted by W
. Ties are
handled by randomly by uniformly selecting a category amongst the tied
categories. Only non-missing or neighbors with non-zero weights are used
in the calculation.
An in memory raster image by most popular categories.
1 2 3 | r <- raster::raster( matrix(runif(81),9,9))
W <- matrix(1,3,3)
modeR <- rasterLocalCategoricalModes(r,W)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.