Canopy texture metrics
metrics_texture.Rd
Generates a suite of GLCM (Grey-Level Co-Occurence Matrix) metrics of a canopy height model (CHM). CHM is calculated on the fly
to allow easy integration with e.g. lidR::pixel_metrics
function.
Arguments
- x, y, z
X, Y, Z coordinates of a point cloud
- pixel_size
pixel size
- zmin
numeric. Minimum
z
value. If set,z
values (heights) below are ignored in calculations.- chm_algorithm
Function used to generate the CHM. By default
lidR::p2r(na.fill = lidR::knnidw())
is used.- ...
additional parameters passed to
ForestTools::glcm()
.
Details
Function first uses the lidR::rasterize_canopy()
algorithm to create a CHM.
ForestTools::glcm()
function is then used to calculate GLCM statistics (see package manual for details).
This implementation of GLCM does not allow for missing values - after CHM is created, any missing values are converted to 0.
Examples
library(lidR)
library(lidRmetrics)
LASfile <- system.file("extdata", "Megaplot.laz", package="lidR")
las <- readLAS(LASfile, select = "*", filter = "-keep_random_fraction 0.5")
m1 <- cloud_metrics(las, ~metrics_texture(x = X, y = Y, z = Z, pixel_size = 1))
m2 <- pixel_metrics(las, ~metrics_texture(x = X, y = Y, z = Z, pixel_size = 1), res = 20)