Relative Coordinates and Density Reduction for Terrestrial-Based Technologies Point Clouds
normalize.Rd
This function obtains coordinates relative to the plot centre for Terrestrial Laser Scanner (TLS) and Simultaneous Localization and Mapping (SLAM) point clouds (supplied as LAS files) derived from single scans (with TLS scanner point as plot centre). In addition, the point cropping process developed by Molina-Valero et al., (2019) is applied as a criterion for reducing point density homogeneously in space and proportionally to object size.
Usage
normalize(las, normalized = NULL,
x.center = NULL, y.center = NULL,
max.dist = NULL, min.height = NULL, max.height = 50,
algorithm.dtm = "knnidw", res.dtm = 0.2,
csf = list(cloth_resolution = 0.5),
RGB = NULL,
scan.approach = "single",
id = NULL, file = NULL,
dir.data = NULL, save.result = TRUE, dir.result = NULL)
Arguments
- las
Character string containing the name of LAS file belonging to TLS point cloud, including .las extension (see ‘Examples’). Planimetric coordinates of point cloud data must be in local, representing TLS scan point the origin with Cartesian coordinates x and y as (0, 0).
- normalized
Optional argument to establish as
TRUE
when point cloud is already normalized.- x.center
Planimetric x center coordinate of point cloud data.
- y.center
Planimetric y center coordinate of point cloud data.
- max.dist
Optional maximum horizontal distance (m) considered from the plot centre. All points farther than
max.dist
will be discarded after the normalization process. If this argument is not specified by the user, it will be set to NULL by default and, as a consequence, all points will be used in processing, withmax.dist
representing the farthest point.- min.height
Optional minimum height (m) considered from ground level. All points below
min.height
will be discarded after the normalization process. If this argument is not specified by the user, it will be set to NULL by default and, as a consequence, all points will be used in processing, withmin.height
representing the lowest point.- max.height
Optional maximum height (m) considered from ground level. All points above
max.height
will be discarded after the normalization process. If this argument is not specified by the user, it will be set to NULL by default and, as a consequence, all points will be used in processing, withmax.height
representing the highest point.- algorithm.dtm
Algorithm used to generate the digital terrain model (DTM) from the TLS point cloud. There are two posible options based on spatial interpolation: ‘tin’ and ‘knnidw’ (see ‘Details’). If this argument is not specified by the user, it will be set to ‘knnidw’ algorithm.
- res.dtm
Numeric parameter. Resolution of the DTM generated to normalize point cloud (see ‘Details’). If this argument is not specified by the user, it will be set to 0.2 m.
- csf
List containing parameters of CSF algorithm:
cloth_resolution
: by default 0.5.
- scan.approach
Character parameter indicating TLS single-scan (‘single’) or TLS multi-scan approach or SLAM point clouds (‘multi’) approaches. If this argument is not specified by the user, it will be set to ‘multi’ approach.
- RGB
Logical parameter useful when point clouds are colorized, thus including values of RGB colors. It is based on the Green Leaf Algorithm (GLA) (see ‘Details’).
- id
Optional plot identification encoded as character string or numeric. If this argument is not specified by the user, it will be set to NULL by default and, as a consequence, the plot will be encoded as 1.
- file
Optional file name identification encoded as character string or numeric value. If it is null, file will be encoded as
id
by default.- dir.data
Optional character string naming the absolute path of the directory where LAS files containing TLS point clouds are located.
.Platform$file.sep
must be used as the path separator indir.data
. If this argument is not specified by the user, it will be set toNULL
by default and, as a consequence, the current working directory of the R process will be assigned todir.data
during the execution.- save.result
Optional logical which indicates whether or not the output files described in ‘Output Files’ section must be saved in
dir.result
. If this argument is not specified by the user, it will be set toTRUE
by default and, as consequence, the output files will be saved.- dir.result
Optional character string naming the absolute path of an existing directory where files described in ‘Output Files’ section will be saved.
.Platform$file.sep
must be used as the path separator indir.result
. If this argument is not specified by the user, andsave.result
isTRUE
, it will be set toNULL
by default and, as a consequence, the current working directory of the R process will be assigned todir.result
during the execution.
Details
Relative coordinates are obtained by means of a normalization process, generating a digital terrain model (DTM) from the TLS point cloud, with the ground height set at 0 m. The DTM is generated by spatial interpolation of ground points classified with the CSF algorithm (Zhang et al., (2016)). Two algorithms are available for that purpose: (i) spatial interpolation based on a Delaunay triangulation, which performs a linear interpolation within each triangle (‘tin’); (ii) spatial interpolation using a k-nearest neighbour (KNN) approach with inverse-distance weighting (IDW) (‘knnidw’). Note that normalization process is based on lidR package functions: classify_ground
, grid_terrain
and normalize_height
.
The point cropping process reduces the point cloud density proportionally to the likelihood that objects will receive points according to their distance from TLS and their size, which is determined by angle aperture (the farther they are, the lower the density is). The result is an approximately homogeneous point cloud in three-dimensional space (for more details see Molina-Valero et al., (2019)).
The Green Leaf Algorithm (GLA) is calculated according to Louhaichi et al., (2001)as follows:
Those points with values below 0 are clasified as woody parts, thus retained for tree detection in further functions.
Value
Data frame of normalized point cloud including the following columns (each row corresponds to one point):
- id
Plot identification encoded as a character string or numeric in the argument
id
.- file
File name identification encoded as character string or numeric, corresponding to the normalized and reduced point clouds saved. This coincides with the TXT file in the absolute path specified in
dir.result
(ifsave.result
is set toTRUE
).- Coordinates
-
Cartesian (according to https://en.wikipedia.org/wiki/Cartesian_coordinate_system notation):
x
: x axis distance (m).y
: y axis distance (m).z
: height (m).
Cylindrical (according to https://en.wikipedia.org/wiki/Cylindrical_coordinate_system notation):
rho
: horizontal distance (m).phi
: angular coordinate (rad).z
: height (m).
Spherical (according to https://en.wikipedia.org/wiki/Spherical_coordinate_system notation):
r
: radial distance (m).theta
: polar angle (rad).phi
: azimuthal angle (rad)
- slope
Slope of the terrain (rad).
- GLA
Green Leaf Algorithm (only if point cloud is colorized and specified in arguments).
- prob
selection probability assigned in point cropping process (0-1]. Only the farthest will have probability of 1.
- prob.select
final selection probability assigned in point cropping process. Selected (1) and discarded point (0).
Output Files
At the end of the normalization process, if the save.result
argument is TRUE
, the function will save the reduced point cloud as TXT file and encoded according to file
argument. The format is the same as data frame described in ‘Value’, except for a prob
column, which is removed because all points selected after the point cropping process have a final selection probability of 1. The data frame is written without row names in dir.result
directory using the vroom_write
function in the vroom package.
Note
Note that max.dist
, min.height
and max.height
arguments may be useful for optimizing computing time as well as for removing unnecessary and/or outlier points. These values may be selected more appropriately when inventory data are already available, or the user has some knowledge about autoecology of scanned tree species.
Note also that the linear interpolation algorithm (‘tin’ in this package) showed the highest accuracy in Liang et al., (2018) in DTM generation with single-scans. In this work a DTM resolution of 0.2 m was also considered adequately for square plots of 32 x 32 m.
References
Liang, X., Hyyppä, J., Kaartinen, H., Lehtomäki, M., Pyörälä, J., Pfeifer, N., ... & Wang, Y. (2018). International benchmarking of terrestrial laser scanning approaches for forest inventories. ISPRS journal of photogrammetry and remote sensing, 144, 137-179. doi:10.1016/j.isprsjprs.2018.06.021
Louhaichi, M., Borman, M. M., & Johnson, D. E. (2001). Spatially located platform and aerial photography for documentation of grazing impacts on wheat. Geocarto International, 16(1), 65-70. doi:10.1080/10106040108542184
Molina-Valero J. A., Ginzo-Villamayor M. J., Novo Pérez M. A., Álvarez-González J. G., & Pérez-Cruzado C. (2019). Estimación del área basimétrica en masas maduras de Pinus sylvestris en base a una única medición del escáner laser terrestre (TLS). Cuadernos de la Sociedad Espanola de Ciencias Forestales, 45(3), 97-116. doi:10.31167/csecfv0i45.19887 .
Zhang, W., Qi, J., Wan, P., Wang, H., Xie, D., Wang, X., & Yan, G. (2016). An easy-to-use airborne LiDAR data filtering method based on cloth simulation. Remote Sensing, 8(6), 501. doi:10.3390/rs8060501 .
Examples
# \donttest{
# Establishment of working directories (optional)
# By default here we propose the current working directory of the R process
dir.data <- getwd()
dir.result <- getwd()
# SINGLE-SCAN APPROACH
# Loading example data (LAZ file) to dir.data
download.file("https://www.dropbox.com/s/v9tomu358xgho25/Galicia_single_scan.laz?dl=1",
destfile = file.path(dir.data, "Galicia_single_scan.laz"),
mode = "wb")
# Normalizing the whole point cloud data without considering arguments
pcd <- normalize(las = "Galicia_single_scan.laz",
dir.data = dir.data, dir.result = dir.result)
#> Inverse distance weighting: [===-----------------------------------------------] 6% (2 threads)
Inverse distance weighting: [===-----------------------------------------------] 7% (2 threads)
Inverse distance weighting: [====----------------------------------------------] 8% (2 threads)
Inverse distance weighting: [====----------------------------------------------] 9% (2 threads)
Inverse distance weighting: [=====---------------------------------------------] 10% (2 threads)
Inverse distance weighting: [=====---------------------------------------------] 11% (2 threads)
Inverse distance weighting: [======--------------------------------------------] 12% (2 threads)
Inverse distance weighting: [======--------------------------------------------] 13% (2 threads)
Inverse distance weighting: [=======-------------------------------------------] 14% (2 threads)
Inverse distance weighting: [=======-------------------------------------------] 15% (2 threads)
Inverse distance weighting: [========------------------------------------------] 16% (2 threads)
Inverse distance weighting: [========------------------------------------------] 17% (2 threads)
Inverse distance weighting: [=========-----------------------------------------] 18% (2 threads)
Inverse distance weighting: [=========-----------------------------------------] 19% (2 threads)
Inverse distance weighting: [==========----------------------------------------] 20% (2 threads)
Inverse distance weighting: [==========----------------------------------------] 21% (2 threads)
Inverse distance weighting: [===========---------------------------------------] 22% (2 threads)
Inverse distance weighting: [===========---------------------------------------] 23% (2 threads)
Inverse distance weighting: [============--------------------------------------] 24% (2 threads)
Inverse distance weighting: [============--------------------------------------] 25% (2 threads)
Inverse distance weighting: [=============-------------------------------------] 26% (2 threads)
Inverse distance weighting: [=============-------------------------------------] 27% (2 threads)
Inverse distance weighting: [==============------------------------------------] 28% (2 threads)
Inverse distance weighting: [==============------------------------------------] 29% (2 threads)
Inverse distance weighting: [===============-----------------------------------] 30% (2 threads)
Inverse distance weighting: [===============-----------------------------------] 31% (2 threads)
Inverse distance weighting: [================----------------------------------] 32% (2 threads)
Inverse distance weighting: [================----------------------------------] 33% (2 threads)
Inverse distance weighting: [=================---------------------------------] 34% (2 threads)
Inverse distance weighting: [=================---------------------------------] 35% (2 threads)
Inverse distance weighting: [==================--------------------------------] 36% (2 threads)
Inverse distance weighting: [==================--------------------------------] 37% (2 threads)
Inverse distance weighting: [===================-------------------------------] 38% (2 threads)
Inverse distance weighting: [===================-------------------------------] 39% (2 threads)
Inverse distance weighting: [====================------------------------------] 40% (2 threads)
Inverse distance weighting: [====================------------------------------] 41% (2 threads)
Inverse distance weighting: [=====================-----------------------------] 42% (2 threads)
Inverse distance weighting: [=====================-----------------------------] 43% (2 threads)
Inverse distance weighting: [======================----------------------------] 44% (2 threads)
Inverse distance weighting: [======================----------------------------] 45% (2 threads)
Inverse distance weighting: [=======================---------------------------] 46% (2 threads)
Inverse distance weighting: [=======================---------------------------] 47% (2 threads)
Inverse distance weighting: [========================--------------------------] 48% (2 threads)
Inverse distance weighting: [========================--------------------------] 49% (2 threads)
Inverse distance weighting: [=========================-------------------------] 50% (2 threads)
Inverse distance weighting: [=========================-------------------------] 51% (2 threads)
Inverse distance weighting: [==========================------------------------] 52% (2 threads)
Inverse distance weighting: [==========================------------------------] 53% (2 threads)
Inverse distance weighting: [===========================-----------------------] 54% (2 threads)
Inverse distance weighting: [===========================-----------------------] 55% (2 threads)
Inverse distance weighting: [============================----------------------] 56% (2 threads)
Inverse distance weighting: [============================----------------------] 57% (2 threads)
Inverse distance weighting: [=============================---------------------] 58% (2 threads)
Inverse distance weighting: [=============================---------------------] 59% (2 threads)
Inverse distance weighting: [==============================--------------------] 60% (2 threads)
Inverse distance weighting: [==============================--------------------] 61% (2 threads)
Inverse distance weighting: [===============================-------------------] 62% (2 threads)
Inverse distance weighting: [===============================-------------------] 63% (2 threads)
Inverse distance weighting: [================================------------------] 64% (2 threads)
Inverse distance weighting: [================================------------------] 65% (2 threads)
Inverse distance weighting: [=================================-----------------] 66% (2 threads)
Inverse distance weighting: [=================================-----------------] 67% (2 threads)
Inverse distance weighting: [==================================----------------] 68% (2 threads)
Inverse distance weighting: [==================================----------------] 69% (2 threads)
Inverse distance weighting: [===================================---------------] 70% (2 threads)
Inverse distance weighting: [===================================---------------] 71% (2 threads)
Inverse distance weighting: [====================================--------------] 72% (2 threads)
Inverse distance weighting: [====================================--------------] 73% (2 threads)
Inverse distance weighting: [=====================================-------------] 74% (2 threads)
Inverse distance weighting: [=====================================-------------] 75% (2 threads)
Inverse distance weighting: [======================================------------] 76% (2 threads)
Inverse distance weighting: [======================================------------] 77% (2 threads)
Inverse distance weighting: [=======================================-----------] 78% (2 threads)
Inverse distance weighting: [=======================================-----------] 79% (2 threads)
Inverse distance weighting: [========================================----------] 80% (2 threads)
Inverse distance weighting: [========================================----------] 81% (2 threads)
Inverse distance weighting: [=========================================---------] 82% (2 threads)
Inverse distance weighting: [=========================================---------] 83% (2 threads)
Inverse distance weighting: [==========================================--------] 84% (2 threads)
Inverse distance weighting: [==========================================--------] 85% (2 threads)
Inverse distance weighting: [===========================================-------] 86% (2 threads)
Inverse distance weighting: [===========================================-------] 87% (2 threads)
Inverse distance weighting: [============================================------] 88% (2 threads)
Inverse distance weighting: [============================================------] 89% (2 threads)
Inverse distance weighting: [=============================================-----] 90% (2 threads)
Inverse distance weighting: [=============================================-----] 91% (2 threads)
Inverse distance weighting: [==============================================----] 92% (2 threads)
Inverse distance weighting: [==============================================----] 93% (2 threads)
Inverse distance weighting: [===============================================---] 94% (2 threads)
Inverse distance weighting: [===============================================---] 95% (2 threads)
Inverse distance weighting: [================================================--] 96% (2 threads)
Inverse distance weighting: [================================================--] 97% (2 threads)
Inverse distance weighting: [=================================================-] 98% (2 threads)
Inverse distance weighting: [=================================================-] 99% (2 threads)
Inverse distance weighting: [==================================================] 100% (2 threads)
# MULTI-SCAN APPROACH
# Loading example data (LAZ file) to dir.data
download.file("https://www.dropbox.com/s/j48chrbngwoma6y/Galicia_multi_scan.laz?dl=1",
destfile = file.path(dir.data, "Galicia_multi_scan.laz"),
mode = "wb")
# Normalizing the whole point cloud data without considering arguments
pcd <- normalize(las = "Galicia_multi_scan.laz",
scan.approach = "multi",
dir.data = dir.data, dir.result = dir.result)
# }