read_tree_pc: Read a tree point cloud

View source: R/read_tree_pc.R

read_tree_pcR Documentation

Read a tree point cloud

Description

Reads a tree point cloud file of txt, las/laz or ply format and returns the tree point cloud as a data.frame with 3 columns (X,Y,Z).

Usage

read_tree_pc(path, samplefactor = 1)

Arguments

path

A character with the path to the tree point cloud file. File can be txt, las, laz or ply format. The 3D coordinates have to be in the first three columns in case of a txt file.

samplefactor

A numeric value ranging from 0 to 1 (default=1). This determines the amount of points that are sampled from the point cloud. 1 to sample 100 percent of the points and for example 0.5 to sample 50 percent of the points.

Details

Reading the txt, las/laz and ply files is based on fread, readTLSLAS and vcgPlyRead respectively. Sampling is based on sample and is mainly a useful tool to reduce the amount of points for quicker plotting.

Value

The tree point cloud as a data.frame (nx3) with X, Y, and Z coordinates in the first, second and third column respectively.

Examples

## Not run: 
# Read a tree point cloud file of the txt format
pc_txt <- read_tree_pc(PC_path = "path/to/point_cloud.txt")
# Read a tree point cloud file of the ply format
pc_ply <- read_tree_pc(PC_path = "path/to/point_cloud.ply")
# Read a tree point cloud file of the las/laz format
# and subsample to 20 percent of the points
pc_las <- read_tree_pc(PC_path = "path/to/point_cloud.las", 0.2)

## End(Not run)

lmterryn/ITSMe documentation built on Feb. 4, 2025, 2:21 a.m.