Max-tree

Include <mln/morpho/maxtree.hpp>

Image{I}
auto maxtree(I input, Neighborhood nbh)
Image{I}
auto mintree(I input, Neighborhood nbh)

Compute a max-tree or a min-tree and returns a pair (tree, node_map). See Component Trees (Overview) for more information about the representation of tree. The value_type of the image must be an unsigned integral.

Parameters:
  • input – The input image

  • nbh – The neighborhood to consider

Returns:

A pair (tree, node_map) where tree is of type component_tree<image_value_t<I>> and

Requirements

  • image_value_t<I> is a UnsignedIntegral

  • N is model of Neighborhood

Example

#include <mln/morpho/maxtree.hpp>
#include <mln/core/image/ndimage.hpp>

mln::image2d<uint8_t> input = ...;

auto [tree, node_map] = mln::morpho::maxtree(input, mln::c4);

Notes

Complexity

The algorithm is quasi-linear and requires \(O(n)\) extra-memory space.

References