normalize_height: Remove the topography from a point cloud

Description Usage Arguments Value Working with a LAScatalog Supported processing options See Also Examples

View source: R/normalize_height.R

Description

Subtract digital terrain model (DTM) from LiDAR point cloud to create a dataset normalized with the ground at 0. The DTM can originate from an external file or can be computed by the user. It can also be computed on-the-fly. In this case the algorithm does not use rasterized data and each point is interpolated. There is no inaccuracy due to the discretization of the terrain and the resolution of the terrain is virtually infinite.

How well the edges of the dataset are interpolated depends on the interpolation method used. Thus, a buffer around the region of interest is always recommended to avoid edge effects.

The attribute Z of the returned LAS object is the normalized elevation. A new attribute 'Zref' records the former elevation values, which enables the use of unnormalize_height to restore original point elevations.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
normalize_height(
  las,
  algorithm,
  na.rm = FALSE,
  use_class = c(2L, 9L),
  ...,
  add_lasattribute = FALSE,
  Wdegenerated = TRUE
)

unnormalize_height(las)

## S4 method for signature 'LAS,RasterLayer'
e1 - e2

## S4 method for signature 'LAS,lidRAlgorithm'
e1 - e2

Arguments

las

An object of class LAS or LAScatalog.

algorithm

a spatial interpolation function. lidR have tin, kriging, knnidw or a RasterLayer representing a digital terrain model (can be computed with grid_terrain)

na.rm

logical. When using a RasterLayer as DTM, by default the function fails if a point fall in an empty pixel because a Z elevation cannot be NA. If na.rm = TRUE points with an elevation of NA are filtered. Be careful this creates a copy of the point cloud.

use_class

integer vector. By default the terrain is computed by using ground points (class 2) and water points (class 9). Relevant only for a normalisation without a raster DTM.

...

If algorithm is a RasterLayer, ... is propagated to extract. Typically one may use method = "bilinear".

add_lasattribute

logical. By default the above see level elevation is retained in a new attribute. However this new attribute will be discared at write time. If TRUE it is maintained as an extrabytes attribute. See also add_lasattribute.

Wdegenerated

logical. The function always check and remove degenerated ground points for computing the DTM to avoid unexpected behaviours such as infinite elevation. If TRUE a warning in thrown to alert about the presence of degenerated ground points.

e1

a LAS object

e2

RasterLayer representing a digital terrain model (can be computed with grid_terrain) or a spatial interpolation function. lidR has tin, kriging, and knnidw.

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:

See Also

grid_terrain

Other normalize: normalize_intensity()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
LASfile <- system.file("extdata", "Topography.laz", package="lidR")
las <- readLAS(LASfile, filter = "-inside 273450 5274350 273550 5274450")

#plot(las)

# First option: use a RasterLayer as DTM
# =======================================================

dtm <- grid_terrain(las, 1, knnidw(k = 6L, p = 2))
las <- normalize_height(las, dtm)

plot(dtm)
#plot(las)

# restore original elevations
las <- unnormalize_height(las)
#plot(las)

# operator - can be used. This is equivalent to the previous
las <- las - dtm
#plot(las)

# restore original elevations
las <- unnormalize_height(las)

# Second option: interpolate each point (no discretization)
# =========================================================

las <- normalize_height(las, tin())
#plot(las)

# operator - can be used. This is equivalent to the previous
las <- unnormalize_height(las)
las <- las - tin()

## Not run: 
# All the following syntaxes are correct
las <- normalize_height(las, knnidw())
las <- normalize_height(las, knnidw(k = 8, p = 2))
las <- las - knnidw()
las <- las - knnidw(k = 8)
las <- normalize_height(las, kriging())
las <- las - kriging(k = 8)

## End(Not run)

lidR documentation built on June 21, 2021, 5:07 p.m.