Molina-Valero / FORTLS

Automatic Processing of Terrestrial-Based Technologies Point Cloud Data for Forestry Purposes
https://CRAN.R-project.org/package=FORTLS
21 stars 7 forks source link

Tree location issue in tree.detection function #3

Closed ShingObt closed 2 years ago

ShingObt commented 3 years ago

I have a question related to tree.detection function in FORTLS.

I first normalized the TLS point cloud with normalize function. Then identified individual trees with tree.detection function. The code is as follows.

las.norm=normalize("Block1_plot1.las",save.result = TRUE)
id.tree=tree.detection(las.norm)

yet the XY coordinates of the individual trees do not coincide with the distribution of the normalized point cloud.

# randomly select 20,000 points from normalized point cloud.
id=sample(seq(1,dim(las.norm)[1]),20000)
x.sample=las.norm$x[id]
y.sample=las.norm$y[id]
plot(x.sample,y.sample)# plot XY

# overlay individual tree location acquired by tree.detection
points(id.tree$x,id.tree$y,col="red",cex=3)

Rplot Black points are the XY location of 20000 points in the normalized point cloud. Red points are the XY location of the trees. I expected that the tree location is close to the region with dense point cloud (thick black in the plot) but some of the tree locations are omitted and many tree centers are identified along the edge of the plot.

Could you let me know the cause of the spatial disagreement between the normalized point cloud and identified tree location?

For reference, I show the 3D plot of the point cloud. Screen Shot 2021-09-07 at 11 47 37 PM

Thank you a lot for your help!

ShingObt commented 3 years ago

I forgot to upload my LAS file. LAS file I used is uploaded on

https://github.com/ShingObt/TLS/blob/main/demoData/Block1_plot1.las

Thanks again.

Molina-Valero commented 3 years ago

Dear Shingo Obata,

First of all, thank you to prove our R package FORTLS.

FORTLS is designed for TLS single-scan point clouds so far. However, we a new funtion to detect trees with multiple-scans and/or SLAM point clouds are coming.

Which kind of data are you using? TLS or ALS?

Best regrads,

Juan

ShingObt commented 3 years ago

Juan,

Thank you for your quick reply! I am now trying to process TLS data (https://github.com/ShingObt/TLS/blob/main/demoData/Block1_plot1.las). It is created by co-registering four scan results. So the inconsistency between distribution of points and identified tree locations might be attributed to multi-scan. I also have single-scan data that I will check if the single scan data works well.

In addition, I found minor issues (probably because of the version of the vroom packages I use) in the normalize function and tree.identification function that I will create another issue later.

Thanks gain,

Molina-Valero commented 3 years ago

OK. Remember is neccesary to use the parameters of TLS resolution:

tls.resolution List containing parameters of TLS resolution. This can be defined by the angle aperture: • horizontal.angle: horizontal angle aperture (degrees). • vertical.angle: vertical angle aperture (degrees). or separation between two consecutive points at a certain distance from TLS: • point.dist: distance (mm) between two consecutive points. • tls.dist: distance (m) from TLS at which two consecutive points are separated by point.dist. If this argument is not specified by the user, it will be set to NULL by default and, as a consequence the function will stop giving an error message.

Example:

Establishment of working directories (optional)

By default here we propose the current working directory of the R process

dir.data <- getwd() dir.result <- getwd()

Loading example data (LAS file) to dir.data

download.file("https://www.dropbox.com/s/2c3d320o3srcawb/1.las?raw=1", destfile = file.path(dir.data, "1.las"), method = "wininet", mode = "wb")

Normalizing the point cloud data as a neccesary step for detecting trees

pcd <- normalize(las = "1.las", max.dist = 15, min.height = 0.25, max.height = 25, id = "1", file = "1.txt", dir.data = dir.data, dir.result = dir.result)

Tree detection without considering arguments

For this case study, TLS resolution was established as:

point.dist = 7.67 mm and tls.dist = 10 m

tree.list.tls <- tree.detection(data = pcd, tls.resolution = list(point.dist = 7.67, tls.dist = 10), dir.result = dir.result)