focal_median {ursa} | R Documentation |
Median spatial filter for image
Description
For each band and for each cell, function finds median value inside of square window. Focal operation of map algebra.
Usage
focal_median(x, size = 3, cover = 1e-06, fillNA = FALSE, saveMargin = TRUE, verbose = 0L)
Arguments
x |
Object of class |
size |
Positive numeric. Odd values (3, 5, 7, ...) are allowed, but if other value is specified, then it expanded to the next odd value not less than original value. Default is |
cover |
Numeric. |
fillNA |
Logical. If |
saveMargin |
Logical. If |
verbose |
Integer of |
Value
Object of class ursaRaster
with the same number of bands as in input raster.
Author(s)
Nikita Platonov platonov@sevin.ru
See Also
Other focal operations: focal_mean
, focal_extrem
.
Examples
session_grid(NULL)
a <- ursa_dummy(1,mul=1/8,elements=0,bandname="src")
a[a<80] <- NA
bF <- c(fillNA.F=focal_median(a[1],size=5,cover=0.5,fillNA=FALSE))
bT <- c(fillNA.T=focal_median(a[1],size=5,cover=0.5,fillNA=TRUE))
print(c(diff=bT-bF))
d <- c(a,bF,bT)
print(d)
display(d)