| focal_metrics {geodiv} | R Documentation |
Calculate Texture Metrics per Pixel
Description
Calculates the various texture metrics over windows centered
on individual pixels. This creates a continuous surface of the
texture metric.
This function is a modified version of the window_lsm function from the
landscapemetrics package (Hesselbarth et al. 2019).
Usage
focal_metrics(x, window, metrics, progress, ...)
Arguments
x |
A raster or matrix. Image over which to apply focal window calculations. |
window |
Matrix. The focal window used to create the image. |
metrics |
List. List of metrics to apply. Function names must be strings. |
progress |
Logical. Display progress through metrics list? |
... |
Additional arguments for the metric functions. All applicable arguments will be applied to the entire list of metrics. |
Details
Metrics available from geodiv package:
'sa': average surface roughness'sq': root mean square roughness's10z': ten-point height'sdq': root mean square slope of surface, 2-point method'sdq6': root mean square slope of surface, 7-point method'sdr': surface area ratio'sbi': surface bearing index'sci': core fluid retention index'ssk': skewness'sku': kurtosis'sds': summit density'sfd': 3d fractal dimension'srw': dominant radial wavelength, radial wavelength index, mean half wavelength'std': angle of dominating texture, texture direction index'svi': valley fluid retention index'stxr': texture aspect ratio'ssc': mean summit curvature'sv': maximum valley depth'sph': maximum peak height'sk': core roughness depth'smean': mean peak height'svk': reduced valley depth'spk': reduced peak height'scl': correlation length'sdc': bearing area curve height interval
Value
A raster of the metric calculated in windows over the raster or matrix. If the input was a matrix, the function will return a raster with an extent of [0, 1, 0, 1].
References
Hesselbarth, M.H.K., Sciaini, M., With, K.A., Wiegand, K., Nowosad, J. 2019. landscapemetrics: an open-source R tool to calculate landscape metrics. - Ecography 42:1648-1657(ver. 0).
Examples
# import raster image
data(normforest)
normforest <- terra::unwrap(normforest)
# crop raster to smaller area
x <- terra::crop(normforest, terra::ext(normforest[1:100, 1:100, drop = FALSE]))
# get a surface of root mean square roughness
sa_img <- focal_metrics(x = x, window = matrix(1, 5, 5),
metrics = list('sa'), progress = TRUE)
# plot the result
terra::plot(sa_img$sa)