glcm: Grey-Level Co-Occurrence Matrix

View source: R/glcm.R

glcmR Documentation

Grey-Level Co-Occurrence Matrix

Description

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.

Usage

glcm(image, segs = NULL, n_grey = 32, angle = c(0, 1), discretize_range = NULL)

Arguments

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 segs are not provided, GLCM will be calculated for the entire image.

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.

Value

data.frame

References

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)

See Also

mcws

Examples

## 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)


ForestTools documentation built on June 22, 2024, 7:08 p.m.