In rLiDAR, you can segment trees by using CHMs ASCIIs produced by Fusion. Can the same be done in lidR? I know in lidR you have to use the .laz file for tree segmentation:

LASfile <- system.file("extdata", "MixedConifer.laz", package="lidR")
las <- readLAS(LASfile, select = "xyz", filter = "-drop_z_below 0")
# Using Li et al. (2012)
las <- segment_trees(las, li2012(R = 3, speed_up = 5))

So basically, instead of using the .laz file, can I just use its representative CHM.asc produced by Fusion to segment/find trees and then make convex hulls. The reason for using lidR is that I have done crown delineation using rLiDAR, but since rLiDAR does not use more than one CPU cores, it takes a lot of time. However, lidR does support parallelization, hence it's way faster than rLiDAR.


1 Answer 1


Well, it is more complicated than that.

Can you read a CHM from ASCII file? Yes, but this is related to the raster package not to lidR. https://stackoverflow.com/questions/20177581/reading-an-asc-file-into-r

Can you segment trees from a raster in lidR? Yes some algorithm are raster-based. This is not the case of li2012 you mentioned that is point-cloud based. For example the documentation of the dalpon2016 method states:

Because this algorithm works on a CHM only there is no actual need for a point cloud. Sometimes the user does not even have the point cloud that generated the CHM. lidR is a point cloud-oriented library, which is why this algorithm must be used in segment_trees to merge the result with the point cloud. However the user can use this as a stand-alone function like this:

chm = raster("file/to/a/chm/")
ttops = find_trees(chm, lmf(3))
crowns = dalponte2016(chm, ttops)()

Can you run raster-based method in parallel? Not natively with lidR. lidR is designed to process collections of las/laz files and has tools to do that in parallel. In your case you are asking for processing a collection of rasters and lidR is not designed for raster processing. At this stage you must get your hand dirty and use the available tool given in the R's ecosystem. If you have question you can ask specific questions with the appropriated tags.

Can you run the algorithm of rLiDAR with lidR? Yes. The algorithm silva2016 is the same than the one implemented in rLiDAR. The doc states:

It implements an algorithm for tree segmentation based on the Silva et al. (2016) article (see reference). This is a simple method based on seed + voronoi tesselation. This algorithm is implemented in the package rLiDAR. This version is not the version from rLiDAR. It is code written from the original article by the lidR authors and is considerably (between 250 and 1000 times) faster.

If the algorithm from rLiDAR satisfies you, you can use the 250 to 1000 times faster version implemented in lidR this is much faster than what you will ever achieve with parallelization.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.