glcm | R Documentation |
Generate textural metrics using Grey-Level Co-Occurrence Matrices (GLCM). Can be applied to an entire or image or, if a coterminous raster of segments is provided, GLCM can be calculated for each segment.
glcm(image, segs = NULL, n_grey = 32, angle = c(0, 1), discretize_range = NULL)
image |
SpatRaster. A single-band raster layer from which texture is measured |
segs |
SpatRaster. A segmented raster. Cell values should be equal to segment numbers. If |
n_grey |
integer. Number of grey levels into which the image will be discretized |
angle |
integer. Angle at which GLCM will be calculated. Ex.: 'c(0,1)' |
discretize_range |
numeric. Vector of two values indicating the minimum and maximum input values for discretizing the image. This can be useful when processing tiles of a larger image, for which you may want to impose a consistent value range. |
data.frame
Parmar, C., Velazquez, E.R., Leijenaar, R., Jermoumi, M., Carvalho, S., Mak, R.H., Mitra, S., Shankar, B.U., Kikinis, R., Haibe-Kains, B. and Lambin, P. (2014). Robust radiomics feature quantification using semiautomatic volumetric segmentation. PloS one, 9(7)
mcws
## Not run:
library(terra)
library(ForestTools)
chm <- rast(kootenayCHM)
image <- rast(kootenayOrtho)[[1]]
# Generate raster segments
segs <- mcws(kootenayTrees, chm, minHeight = 0.2, format = "raster")
# Get textural metrics for ortho's red band
tex <- glcm(image, segs)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.