lidR icon indicating copy to clipboard operation
lidR copied to clipboard

Segmentation with Li 2012 may change as a function of point ordering

Open Jean-Romain opened this issue 4 years ago • 0 comments

Some point ordering lead to different results when performing the segmentation. This is related to #349.

library(lidR)
LASfile <- system.file("extdata", "MixedConifer.laz", package = "lidR")
las0 = readLAS(LASfile)
las0@data$ID <- 1:npoints(las0)
las1 = filter_poi(las0, X < 481300)
las2 = filter_poi(las0, X >= 481300)
las3 = rbind(las1,las2)
las4 = rbind(las2,las1)

las0 = lastrees(las0, li2012(speed_up = 5), uniqueness = 'bitmerge')
las3 = lastrees(las3, li2012(speed_up = 5), uniqueness = 'bitmerge')
las4 = lastrees(las4, li2012(speed_up = 5), uniqueness = 'bitmerge')

length(na.omit(unique(las0@data$treeID)))
#> [1] 274
length(na.omit(unique(las3@data$treeID)))
#> [1] 273
length(na.omit(unique(las4@data$treeID)))
#> [1] 274

plot(las0$ID, cex = 0.5)
points(las3$ID, col = "red", cex = 0.5)
points(las4$ID, col = "blue", cex = 0.5)

Jean-Romain avatar Jun 25 '20 15:06 Jean-Romain