Ops.focal_extrem: Extremal spatial filter for image

Description Usage Arguments Details Value Author(s) See Also Examples

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

1
2
3
4
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 ursaRaster.

kind

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

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

cover

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.

fillNA

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.

saveMargin

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.

verbose

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.

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

1
2
3
4
5
6
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))

ursa documentation built on May 23, 2021, 1:06 a.m.