This short guide will demonstrate how to use the ForestTools package to detect and outline trees from a canopy height model (CHM) derived from a photogrammetric point cloud.
Begin by installing ForestTools.
A sample CHM is included in the ForestTools package. It represents a small 1.5 hectare swath of forest in the Kootenay Mountains, British Columbia.
View the CHM using the
plot function. The cell values
are equal to the canopy’s height above ground.
Dominant treetops can be detected using
function implements the variable window filter algorithm
developed by Popescu and Wynne (2004). In short, a moving window scans
the CHM and tags a given cell as treetop if it is found to be the
highest within the window. The size of the window itself changes
dynamically depending on the height of the cell on which it is centered.
This is to account for varying crown sizes, with tall trees assumed to
have wide crowns and vice versa.
Therefore, the first step is to define the function that will
define the dynamic window size. Essentially, this function
should take a CHM cell value (i.e.: the height of the
canopy above ground at that location) and return the radius of
the search window. Here, we will define a simple linear
equation, but any function with a single input and output will work. We
do not wish for the
vwf to tag low-lying underbrush or
other spurious treetops, and so we also set a minimum height of 2 m
minHeight argument. Any cell with a lower value
will not be tagged as a treetop.
We can now plot these treetops on top of the CHM.
ttops object created by
vwf in this
example contains the spatial coordinates of each detected treetop, as
well as two default attributes: height and winRadius.
These correspond to the tree’s height above ground and the radius of the
moving window where the tree was located. Note that winRadius
is not necessarily equivalent to the tree’s crown
##  5.404217
Canopy height models often represent continuous, dense forests, where
tree crowns abut against each other. Outlining discrete crown shapes
from this type of forest is often referred to as canopy
segmentation, where each crown outline is represented by a
segment. Once a set of treetops have been detected from a
canopy height model, the
mcws function can be used for this
mcws function implements the
algorithm from the imager
library. Watershed algorithms are frequently used in topographical
analysis to outline drainage basins. Given the morphological similarity
between an inverted canopy and a terrain model, this same process can be
used to outline tree crowns. However, a potential problem is the issue
of oversegmentation, whereby branches, bumps and other spurious
treetops are given their own segments. This source of error can be
mitigated by using a variant of the algorithm known as
marker-controlled watershed segmentation (Beucher & Meyer,
1993), whereby the watershed algorithm is constrained by a set of
markers – in this case, treetops.
mcws function also takes a
argument, although this value should be lower than that which was
vwf. For the latter,
defines the lowest expected treetop, whereas for the former it should
correspond to the height above ground of the fringes of the lowest
mcws returns a raster, where each crown is
given a unique cell value. Depending on the intended purpose of the
crown map, it may be preferable to store these outlines as polygons.
This can be accomplished by setting the
format argument to
“polygons”. As an added benefit, these polygons will inherit the
attributes of the treetops from which they were generated, such as
Assuming that each crown has a roughly circular shape, we can use the crown’s area to compute its average circular diameter.
## 2.882985 [m]
Popescu, S. C., & Wynne, R. H. (2004). Seeing the trees in the forest. Photogrammetric Engineering & Remote Sensing, 70(5), 589-604.
Beucher, S., and Meyer, F. (1993). The morphological approach to segmentation: the watershed transformation. Mathematical morphology in image processing, 433-481.