Ops.focal_extrem: Extremal spatial filter for image

focal_extremR Documentation

Extremal spatial filter for image


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.


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)



Object of class ursaRaster.


Character. What kind of extremum is required. Allowed values "min" or "max".


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 3L.


Numeric. 0<=cover<=1. Quota for NA values in the focal window in relation to the squared size of the focal window. Quota exceeding leads to recording NA value in the cell. Default is cover=1e-6.


Logical. If TRUE then only NA values of source image can be changed, and non-NA values of source image are kept without changes. It may provide less reducing of spatial resolution in the task of spatial interpolation. Default is FALSE.


Logical. If TRUE then adaptive window size is used for cells, where original window goes over image boundary. If FALSE then image is expanded to the half size of focal window by NA values and argument cover is applied to this expanded part. Default is TRUE.


Integer of 0L, 1L, or 2L, or logical, which is coerced to integer. The level of verbosity. Values >0 provide some additional information on console, verbose=1L is less detailed, verbose=2L is more detailed. Default is 0L.


focal_min(x,...) is a wrapper to focal_extrem(x,"min",...)
focal_max(x,...) is a wrapper to focal_extrem(x,"max",...)


Object of class ursaRaster with the same number of bands as in input raster.


Nikita Platonov platonov@sevin.ru

See Also

Other focal operations: focal_mean, focal_median.


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)

ursa documentation built on Dec. 28, 2022, 2:18 a.m.