slideBrick: Sliding-Windows Statistics Over a Hyperspectral Image

View source: R/slideBrick.R

slideBrickR Documentation

Sliding-Windows Statistics Over a Hyperspectral Image

Description

Calculate focal statistics on a hyperspectral image using non-overlapping sliding windows.

Usage

slideBrick(Brick, slide_windows, fun = median)

Arguments

Brick

An object of class RasterBrick or RasterStack (from package raster), containing multiple layers (spectral bands).

slide_windows

An object of class slideWindows, which consists of a list of spatial extents giving the location of the non-overlapping sliding windows that covers the entire image.

fun

A vectorized function indicating the statistics to be calculated within each sliding-windows, e.g. median (default), mean, sd.

Value

A vector or matrix containing the estimates of each sliding windows.

See Also

slideWindows()

Examples

p <- system.file('exdata', 'obory.dat', package = 'hyperbrick')
im <- buildBrick(p, ref_layer = 35,
                spectral_feature = "radiance",
                hFOV = 36.8, vFOV = 36.8, height = 45)
print(im)
plotRGB(im, r = 63, b = 34, g = 11, scale = 90)

ext <- extent(c(512700.2, 512715, 5769462, 5769477))
sw <- slideWindows(ext, n = c(7, 7))
lapply(sw, lines, col = "white") -> null_obj

sb <- slideBrick(im, sw, fun = mean)
head(sb)


hyperbrick documentation built on April 1, 2022, 9:07 a.m.