texture_image | R Documentation |
Calculates the various texture metrics over windows centered on individual pixels. This creates a continuous surface of the texture metric.
texture_image(
x,
window_type = "square",
size = 5,
in_meters = FALSE,
metric,
args = NULL,
parallel = TRUE,
ncores = NULL,
nclumps = 100
)
x |
A raster or matrix. |
window_type |
Character. Type of window, either circular or square. |
size |
Numeric. Size of window (edge length) or diameter (in meters). |
in_meters |
Logical. Is the size given in meters? |
metric |
Character. Metric to calculate for each window. Metrics from the geodiv package are listed below. |
args |
List. Arguments from function to be applied over each window (e.g., list(threshold = 0.2)). |
parallel |
Logical. Option to run the calculations in parallel on available cores. |
ncores |
Numeric. If parallel is TRUE, number of cores on which to run the calculations. Defaults to all available, minus 1. |
nclumps |
Numeric. Number of clumps to split the raster or matrix into. |
Note that this function is meant to work on rasters with an equal area projection.
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
A raster or list of rasters (if function results in multiple outputs) with pixel values representative of the metric value for the window surrounding that pixel.
The total window size for square windows will be (size * 2) + 1.
# 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 <- texture_image(x = x, window = 'square',
size = 5, metric = 'sa',
parallel = TRUE, ncores = 1, nclumps = 20)
# plot the result
terra::plot(sa_img)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.