Replies: 2 comments 1 reply
-
Test it, compare it, measure it and publish it. If you can go to last step I'll happy to add it into lidR if you wish. But at this step I can't say anything about it.
Also please rename your fork and update your readme. You removed almost everything from lidRplugin and copy many things from lidR. Your fork is no longer really a fork of lidRplugin. You are better to create a brand new repo with your own name. |
Beta Was this translation helpful? Give feedback.
-
Thanks @Jean-Romain, I have renamed my package to As for the testing, comparison, measurements, and publishing - I will have to get on that at some point! I have a question as well that expands beyond what I have done here. As I mentioned, I'm not well versed in C++, so I'm wondering if anyone sees any opportunity in being able to parallelize the currently existing |
Beta Was this translation helpful? Give feedback.
-
I have been trying to segment trees multiple ways, and while it can be slow I always appreciated the simplicity of the
li2012()
segmentation algorithm, as it only requires that the LAS object is passed to it. In comparison, other provided segmentation algorithms require a CHM be provided in order to run (or both a CHM and calculated treetops found through a separate tree detection algorithm).I was interested in understanding the
li2012()
algorithm further, so I looked at the coding of the provided algorithm which follows the exact steps intended from the original paper, with some optimizations. The algorithm has a parameterR
, which is the search radius for a local maxima. This maxima is found on this line, which effectively uses the definedR
parameter as the search radius in thefilter_local_maxima
C++ function.My thought was that the
R
parameter can be more finely tuned in theli2012()
algorithm. Much like how thelmf()
tree detection algorithm can accept either a single number or a function for itsws
parameter, I am proposing that theR
parameter in theli2012()
algorithm should be able to handle a function and pass on the resulting window sizes for each point to thefilter_local_maxima
function to be able to define the search radius for each point. I am admittedly a novice when it comes to C++ programming, but I have created a fork of thelidRplugins
package which contains a prototype functionli2012_auto()
, which can be found here.Also within that fork, I have created a similar function to the
lmfauto()
tree detection algorithm,lmfxauto()
. The main difference between the original and my implementation is that the first step useslmfx(5)
instead oflmf(5)
, which increases the speed of that function a bit. The coding for generating the window size withinlmfxauto()
is re-used inside theli2012_auto()
function when theR
parameter is defined asNULL
; in other words, window size (aka:R
) is automatically calculated for each point before running thefilter_local_maxima
function. I have placed that all into the R function file algo-li2012_auto.R.I wonder if this is something that is worth implementing into the existing
li2012()
algorithm? Or if this should stand alone in my own plugin? The only significant change to the C++ coding is that the data type of theR
parameter changes fromdouble
toNumericVector
within both theLAS::segment_trees
andC_li2012
functions, and then implementing the acceptance of a function to theR
parameter in theli2012()
algorithm. Please feel free to browse my forked repository oflidR.li2012enhancement
here. Thanks for any and all feedback!Beta Was this translation helpful? Give feedback.
All reactions