focal_extrem {ursa} | R Documentation |
Extremal spatial filter for image
Description
For each band and for each cell, depending of specification, function finds either minimal or maximal value inside of square window. Focal operation of map algebra.
Usage
focal_extrem(x, kind = c("min", "max"), size = 3, cover = 1e-06,
fillNA = FALSE, saveMargin = TRUE, verbose = 0L)
focal_min(x, size = 3, cover = 1e-06, fillNA = FALSE, saveMargin = TRUE, verbose = 0L)
focal_max(x, size = 3, cover = 1e-06, fillNA = FALSE, saveMargin = TRUE, verbose = 0L)
Arguments
x |
Object of class |
kind |
Character. What kind of extremum is required. Allowed values |
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 |
Details
focal_min(x,...)
is a wrapper to focal_extrem(x,"min",...)
focal_max(x,...)
is a wrapper to focal_extrem(x,"max",...)
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_median
.
Examples
session_grid(NULL)
a <- ursa_dummy(nband=2,mul=1/8,elements=32)
a[a<80] <- NA
b.min <- focal_extrem(a,"min",size=4,cover=0.5,verbose=1L)
b.max <- focal_extrem(a,"max",size=4,cover=0.5,verbose=1L)
print(list(src=a,min=b.min,max=b.max,dif=b.max-b.min))