treeseg.detection module

class treeseg.detection.FixedWindowLocalMaxima(min_distance=1, threshold_abs=None, exclude_border=True, num_peaks=inf)

Bases: treeseg.detection.LocalMaximaBase

Implements a local maxima detection filter via skimage.feature.peak_local_max.

detect(height_model)
class treeseg.detection.LocalMaximaBase(min_distance=1, threshold_abs=None, exclude_border=True, num_peaks=inf)

Bases: object

Base class for local maxima filters. All derivatives use skimage.feature.peak_local_max, and this base class handles a transformation of inputs from the user (e.g. in meters) into pixels.

class treeseg.detection.VariableWindowLocalMaxima(a=2.21, b=0.01022, **kwargs)

Bases: treeseg.detection.LocalMaximaBase

Implements a variable window local maxima. This first runs a fixed window local maxima. Then it iterates over all of the detections from that filter. In each variable window, the tallest maxima is retained, and the others are discarded.

By default this function uses the coefficients described in Popescu et al. (2002), but this can be replaced by any arbitrary allometric equation by setting the .variable_window_function attribute. The function must take a single argument, the height of any given pixel in the units of the input height model (e.g. meters).

detect(height_model, diagnostic=False)
variable_window_function