Loading [MathJax]/extensions/tex2jax.js
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 : Path
Remark : mandatory
-DTM path to the DTM file
Type : Path
Remark : mandatory
-nDSM path to the optional nDSM file
Type : Path
Remark : optional
Description: if no nDSM is provided it will be calculated
-erMask path to the optional echo ratio building mask
Type : Path
Remark : optional
-crownSizes list crown sizes corresponding to minimum tree heights (in meter)
Type : Floating-point number
Remark : optional, default: (1.5, 2.5, 3.5)
-minHeights list of minimum tree heights corresponding to crown sizes (in meter)
Type : Floating-point number
Remark : optional, default: (3, 15, 25)
-kernelShape shape of the kernel - circle | square | diamond
Type : String
Remark : optional, default: circle
-resamplingMethod resampling method bilinear | bicubic | nearestNeighbour | simple average]
Type : String
Remark : optional, default: bilinear
-outfile output file [estimated]
Type : Path
Remark : optional
-workingDir working directory
Type : PathArgument
Remark : optional, default: current directory
Description: working directory - All results will be stored here (folders will be generated)
Logging Options
Settings concerning the verbosity level of logging.
-fileLogLevel Log level in the logfile
Type : LogLevel
Remark : optional, default: info
-screenLogLevel Log level on screen
Type : LogLevel
Remark : optional, default: info
-logger Logger
Type : Logger
Remark : optional
Description: Logger is usually provided by the opals framework.The user may provide their own logger object, but it has to function in the same way as the opals Logger.

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))