Description Usage Arguments Details Value Author(s) See Also Examples
applies several filter functions to each RasterLayer in a RasterStack.
1 | filter_Stk(stk, fLS = "all", sizes, layernames = names(stk))
|
fLS |
comma-separated character combinations of the desired filter functions. Select from "sum","min","max","sd","mean","modal","sobel","sobel_hrzt","sobel_vert". default = all; (see details). |
sizes |
numeric - a single value or combinations for the MovingWindow, number must be odd. |
layernames |
optional - comma-seperated character combinations of the desired layernames. |
Stk |
a RasterStack. |
"sum" - sum of all cells in a MovingWindow
"min" - minimum value of all cells in a MovingWindow
"max" - maximum value of all cells in a MovingWindow
"mean"- mean value of all cells in a MovingWindow
"sd" - standard deviation of all cells in a MovingWindow
"modal" - most frequent value of all cells in a MovingWindow
"sobel" - sobel edge detection filter in horizontal and vertical directions
"sobel_hrzt" - sobel edge detection filter in horizontal direction only
"sobel_vert" - sobel edge detection filter in vertical direction only
returns a RasterStack with the desired filtered artificial layers.
Andreas Schönberg
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ### load data
extpath <-system.file("extdata","lau_mspec.tif",package = "LEGION")
mspec <- raster::stack(extpath)
### compute all filters or every layer in stack
x <- filter_Stk(mspec,sizes=3)
x # note that the names are basic set x.1
### define layernames
ln <- c("blue","green","red","nir")
z <- filter_Stk(mspec,fLS="sum",sizes=3,layernames=ln)
names(z)
### compute specific filters
flist <- c("modal","sobel_vert","mean")
y <- filter_Stk(mspec,fLS=flist,sizes=c(3,5,7))
y
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.