Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

glcm

Grey-Level Co-Occurrence Matrix


Description

Generate textural metrics for a segmented raster using Grey-Level Co-Occurrence Matrices (GLCM). It will return a series of GLCM statistics for each segment (segs) based on an underlying single-band raster image (image) in the form of a data.frame.

Usage

glcm(
  segs,
  image,
  n_grey = 32,
  angle = 0,
  clusters = 1,
  showprog = FALSE,
  roundCoords = 4
)

Arguments

segs

RasterLayer. A segmented raster. Cell values should be equal to segment numbers

image

RasterLayer. A single-band raster layer from which texture is measured

n_grey

integer. Number of grey levels the image should be quantized into

angle

integer. Angle at which GLCM will be calculated. Valid inputs are 0, 45, 90, or 135

clusters

integer. Number of clusters to use during parallel processing

showprog

logical. Display progress in terminal

roundCoords

integer. Errors in coordinate precision can trigger errors in this function. Internally, the coordinates are rounded to this decimal place. Default value of 4 decimals.

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)

Examples

## Not run: 
# Generate raster segments
segs <- mcws(kootenayTrees, kootenayCHM, minHeight = 0.2, format = "raster")

# Get textural metrics for ortho's red band
tex <- glcm(segs, kootenayOrtho[[1]])

## End(Not run)

ForestTools

Analyzing Remotely Sensed Forest Data

v0.2.4
GPL (>= 3)
Authors
Andrew Plowright, Jean-Romain Roussel
Initial release
2021-04-12

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.