forTreeDetection.py script

Aim of script

Detect single trees from topographic models (DSM, DTM) derived from 3D point clouds.

General description

This script attempts to detect single trees in topographic models (-DSM and -DTM). To do so it calculates a local maxima map with a kernel based on the chosen crown sizes (-crownSizes) and kernel shape (-kernelShape) to find the positions of potential trees. The user defined minimum height corresponding to this crown size is then checked against the nDSM height values of potential trees. The nDSM (-nDSM) may optionally be provided to speed up processing. Finally you have the option to provide a echo ratio building mask (-er) to mask out buildings.

Parameter description

-DSM path to the DSM file
Type : PathArgument
Remark : mandatory
Description:
-DTM path to the DTM file
Type : PathArgument
Remark : mandatory
Description:
-nDSM path to the optional nDSM file
Type : PathArgument
Remark : optional
Description: if no nDSM is provided it will be calculated
-er path to the optional er building mask
Type : PathArgument
Remark : optional
Description:
-crownSizes list crown sizes corresponding to minimum tree heights (in meter) (default: [1.5, 2.5, 3.5])
Type : Floating-point number
Remark : optional, default: [1.5, 2.5, 3.5]
Description:
-minHeights list of minimum tree heights corresponding to crown sizes (in meter) (default: [3, 15, 25])
Type : Floating-point number
Remark : optional, default: [3, 15, 25]
Description:
-kernelShape shape of the kernel - circle | square | diamond (default: circle)
Type : String
Remark : optional, default: 'circle'
Description:
-resamplingMethod resampling method bilinear | bicubic | nearestNeighbour | simple average] (default: bilinear)
Type : String
Remark : optional, default: 'bilinear'
Description:
-outFile output file [estimated]
Type : PathArgument
Remark : optional, default:
Description:
-workingDir working directory (default: current directory)
Type : PathArgument
Remark : optional, default: E:\autobuild\swdvlp64\opals
Description: working directory - All results will be stored here (folders will be generated)

Examples

The data used in the following examples can be found in the $OPALS_ROOT/demo/forDelineation directory.

Example 1

This example shows the use of the forTreeDetection script with default parameters.

forTreeDetection -DSM forDelineation\DSM\DSM.tif -dtm forDelineation\DTM\DTM.tif
Figure 1: Each green point represents a detected tree; hillshaded DSM in background for reference

Example 2

This example shows the use of the forTreeDetection script with some optional parameters set.

forTreeDetection -DSM forDelineation\DSM\DSM.tif -dtm forDelineation\DTM\DTM.tif -crownSizes 2 3 4 5 -minHeights 2 10 20 40 -kernelShape square -outfile single_trees.tif
@ square
square kernel (Chebyshev metrics))