# NOT RUN {
##- required packages
require(uavRst)
require(link2GI)
##- linkages
##- create and check the links to the GI software
giLinks<-uavRst::linkAll(linkItems = c("saga","gdal"))
if (giLinks$saga$exist ) {
##- project folder
projRootDir<-tempdir()
##- create subfolders please mind that the pathes are exported as global variables
paths<-link2GI::initProj(projRootDir = projRootDir,
projFolders = c("data/","data/ref/","output/","run/","las/"),
global = TRUE,
path_prefix = "path_")
##- overide trailing backslash issue
path_run<-ifelse(Sys.info()["sysname"]=="Windows", sub("/$", "",path_run),path_run)
setwd(path_run)
unlink(paste0(path_run,"*"), force = TRUE)
##- get the data
data(chm_seg)
data(trp_seg)
##- tree segmentation
crowns_GWS <- chmseg_GWS( treepos = trp_seg[[1]],
chm = chm_seg[[1]],
minTreeAlt = 10,
neighbour = 0,
thVarFeature = 1.,
thVarSpatial = 1.,
thSimilarity = 0.003,
giLinks = giLinks )[[2]]
##- visualize it
raster::plot(crowns_GWS)
}
# }
Run the code above in your browser using DataLab