R: Snag classification

segment_snags {lidR} | R Documentation

## Snag classification

### Description

Snag classification/segmentation using several possible algorithms (see details). The function attributes a number identifying a snag class (`snagCls` attribute) to each point of the point cloud. The classification/segmentation is done at the point cloud level and currently only one algorithm implemented, which uses LiDAR intensity thresholds and specified neighborhoods to differentiate bole and branch from foliage points (see details).

### Usage

    segment_snags(las, algorithm, attribute = "snagCls")

### Arguments

`las` | An object of class LAS or LAScatalog.
`algorithm` | function. An algorithm for snag segmentation. `lidR` has wing2015.
`attribute` | character. The returned LAS object automatically has a new attribute (a new column). This parameter is the name of this new attribute.

### Value

If the input is a `LAS` object, return a `LAS` object. If the input is a `LAScatalog`, returns a `LAScatalog`.

### Working with a `LAScatalog`

This section appears in each function that supports a LAScatalog as input.

In `lidR` when the input of a function is a LAScatalog the function uses the LAScatalog processing engine. The user can modify the engine options using the available options. A careful reading of the engine documentation is recommended before processing `LAScatalogs`. Each `lidR` function should come with a section that documents the supported engine options.

The `LAScatalog` engine supports `.lax` files that significantly improve the computation speed of spatial queries using a spatial index. Users should really take advantage a `.lax` files, but this is not mandatory.

### Supported processing options

Supported processing options for a `LAScatalog` (in bold). For more details see the LAScatalog engine documentation:

- chunk size: How much data is loaded at once.

- chunk buffer*: Mandatory to get a continuous output without edge effects. The buffer is always removed once processed and will never be returned either in R or in files.

- chunk alignment: Align the processed chunks.

- progress: Displays a progression estimation.

- output files*: Mandatory because the output is likely to be too big to be returned in R and needs to be written in las/laz files. Supported templates are `{XLEFT}`, `{XRIGHT}`, `{YBOTTOM}`, `{YTOP}`, `{XCENTER}`, `{YCENTER}` `{ID}` and, if chunk size is equal to 0 (processing by file), `{ORIGINALFILENAME}`.

- select: The function will write files equivalent to the original ones. Thus `select = "*"` and cannot be changed.

- filter: Read only points of interest.

### Examples

    ## Not run:
    LASfile <- system.file("extdata", "MixedConifer.laz", package="lidR")
    las <- readLAS(LASfile, select = "xyzi", filter="-keep_first") # Wing also included -keep_single

    # For the Wing2015 method, supply a matrix of snag BranchBolePtRatio conditional
    # assessment thresholds (see Wing et al. 2015, Table 2, pg. 172)
    bbpr_thresholds <- matrix(c(0.80, 0.80, 0.70,
                              0.85, 0.85, 0.60,
                              0.80, 0.80, 0.60,
                              0.90, 0.90, 0.55),
                              nrow =3, ncol = 4)

    # Run snag classification and assign classes to each point
    las <- segment_snags(las, wing2015(neigh_radii = c(1.5, 1, 2), BBPRthrsh_mat = bbpr_thresholds))

    # Plot it all, tree and snag points...
    plot(las, color="snagCls", colorPalette = rainbow(5))

    # Filter and plot snag points only
    snags <- filter_poi(las, snagCls > 0)
    plot(snags, color="snagCls", colorPalette = rainbow(5)[-1])

    # Wing et al's (2015) methods ended with performing tree segmentation on the
    # classified and filtered point cloud using the watershed method

    ## End(Not run)

[Package lidR version 3.2.2 Index]