ForestTools R 包中树顶检测的错误

问题描述

我的目标是使用 ForestTools::vwf() 算法检测树顶。我知道我们需要根据树高和树冠宽度之间的线性回归来确定可变移动窗口大小(以下示例:https://cran.r-project.org/web/packages/ForestTools/vignettes/treetopAnalysis.html

这是我的代码

#
chm <- raster("chm.tif") ## Canopy Height Model raster of 0.25 m resolution
#
# read tree measurements (tm) dataframe
tm <- structure(list(Id = 1:22,tree_height = c(26.52,30.18,17.98,25.91,24.08,10.36,15.24,25.6,22.86,26.21,22.56,22.25,17.37,20.42,27.13,20.73,4.88,9.45,7.015),crown_width = c(177.38,169.69,274.51,293.41,163.11,97.88,52.20,490.73,81.29,189.05,59.36,210.83,393.13,201.74,216.47,296.87,108.06,47.56,18.75,19.15,47.58,25.36)),class = "data.frame",row.names = c(NA,-22L))
#
head(tm) ##this is how my df is organized
#  Id tree_height crown_width
#1  1     26.5176    177.3790
#2  2     30.1752    169.6940
#3  3     17.9832    274.5130
#4  4     25.9080    293.4080
#5  5     24.0792    163.1080
#6  6     10.3632     97.8815
#
lin <- lm(crown_width ~ tree_height,data = tm) 
print(lin)
#Coefficients:
#      (Intercept)  tree_height
#           3.0158       0.5483
linearModel <- function(x){x * 0.5483 + 3.0158}
ttops <- ForestTools::vwf(CHM = chm,winFun = linearModel,minHeight = 2)

但是,我从树顶检测算法 ForestTools::vwf() 中得到以下错误

ForestTools::vwf(CHM = chm,minHeight = 2) 中的错误: 'winFun' 的输入函数产生 163 个单元格的窗口直径,这比 'maxWinDiameter' 中的最大允许值宽。 更改 'winFun' 函数或将 'maxWinDiameter' 设置为更高的值(或 NULL)。

我对这个错误的理解是我的可变移动窗口大小大于算法中设置的最大直径 -- 有谁知道如何解决这个问题?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)