# NOT RUN {
LASfile <- system.file("extdata", "Topography.laz", package="lidR")
las <- readLAS(LASfile)
plot(las)
# First option: use a RasterLayer as DTM
# =======================================================
dtm <- grid_terrain(las, 1, knnidw(k = 6L, p = 2))
las <- lasnormalize(las, dtm)
plot(dtm)
plot(las)
# restore original elevations
las <- lasunnormalize(las)
plot(las)
# operator - can be used. This is equivalent to the previous
las <- las - dtm
plot(las)
# restore original elevations
las <- lasunnormalize(las)
# Second option: interpolate each point (no discretization)
# =========================================================
las <- lasnormalize(las, tin())
plot(las)
# operator - can be used. This is equivalent to the previous
las <- lasunnormalize(las)
las <- las - tin()
# }
# NOT RUN {
# All the following syntaxes are correct
las <- lasnormalize(las, knnidw())
las <- lasnormalize(las, knnidw(k = 8, p = 2))
las <- las - knnidw()
las <- las - knnidw(k = 8)
las <- lasnormalize(las, kriging())
las <- las - kriging(k = 8)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab