BestSegVal: Test for best performing parameters for TreeSeg...

Description Usage Arguments Details Value Note Author(s) Examples

View source: R/BestSegVal.R

Description

Iterates over a,b,h,MIN and supports iterating over filtered chms. Uses supervised computed Treepositions to validate best fitting values for a,b, height, MIN and CHM filters to detect trees.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
BestSegVal(
  chm,
  a,
  b,
  h,
  vp,
  MIN = 0,
  MAX = 1000,
  skipCheck = FALSE,
  filter = 1
)

Arguments

chm

raster - Canopy Height Model RasterLayer derived form LiDAR data

a

numeric - single value, combination of values or sequence for MovingWindow

b

numeric - single value, combination of values or sequence for MovingWindow

h

numeric - single value, combination of values or a sequence for the maximum height of trees (in meter) to detect trees.

vp

shp - PointLayer with estimated Positions of trees (see details).

MIN

numeric - single value, combination of values or a sequence of minimum area for crowns. Smaller polygons are cropped Default= 0

MAX

numeric - the maximum area for crowns. Larger polygons are cropped. Default=1000

skipCheck

for development - bolean - if TRUE skips checking input data and estimation of ETA.

filter

numeric - single value, combination of values or a sequence for filtersize, uses a sum filter on the chm with a MovingWindow of (x*x), which must be odd., default= 1 (no filter.)

Details

Value

returns a dataframe with several validation scores (see details).

Note

The 'brute force' approach to iterate over many parameters may result in very long time to finish. Preselected smaller samples may be more efficient (see Tutorial).

Author(s)

Andreas Schönberg

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# load packages
require(CENITH)
require(mapview)
require(raster)
require(rgdal)
### NOTE: this example is used to show the usage of 'BestSegVal'. It is NOT used to show a workflow for best Results (see 'Tutorial' vignette for workflow strategies)
### further NOTE: to reduce time usage for the example only small iteartions are used to get an overlook for the functionallities.
# load data
chm <- raster::raster(system.file("extdata","lau_chm.tif",package = "CENITH"))
vp <- rgdal::readOGR(system.file("extdata","lau_vp.shp",package = "CENITH"))
# handle CRS string
crs(vp)<-crs(chm)
# take a look at the data (chm with estimated Treeposition)
mapview(chm)+vp
# start BestSegVal with parameters for Moving window and minimum height
x <- BestSegVal(chm,a=c(0.3,0.5),b=c(0.5,0.7),h=c(0.1,1),vp = vp,filter=c(1,3))
# check for best hitrate
maxrow <- x[which.max(x$hitrate),] # search max vale but rturn only 1 value
maxhit <- maxrow$hitrate
x[which(x$hitrate==maxhit),]
# visualise best combination (due to Segment Quality)
y <- TreeSeg(chm,0.3,0.7,0.1,CHMfilter = 3)
# show result segments with validation points and chm
mapview(chm)+vp+y
# BestSegVal based on this results keep a,b and filter 3 with MIN values to reduce oversegmentation and different heights.
z <- BestSegVal(chm,a=0.3,b=0.7,h=c(0.1,0.2,0.5,1),MIN=c(10,100),vp = vp,filter=3)
### Note that row 1 and 2 lead to much lesser oversegmnetation just differ in area.
# visualize
v <- TreeSeg(chm,0.3,0.7,0.1,MIN=10,CHMfilter = 3)
mapview(chm)+vp+v

SchoenbergA/CENITH documentation built on Sept. 7, 2021, 9:54 a.m.