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 = 0)

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. Valid inputs are 0, 45, 90, or 135

Details

The underlying C++ code for computing GLCMs and their statistics was originally written by Joel Carlson for the defunct [radiomics](https://github.com/cran/radiomics) library. It has been reused here with permission from the author.

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)


andrew-plowright/ForestTools documentation built on Feb. 2, 2024, 3:19 p.m.