Nav2 Navigation Stack - rolling  main
ROS 2 Navigation Stack
Public Member Functions | List of all members
nav2_costmap_2d::imgproc_impl::EquivalenceLabelTrees< Label > Class Template Reference

Union-find data structure Implementation of union-find data structure, described in reference article. Store rooted trees, where each node of a tree is a provisional label and each edge represents an equivalence between two labels. More...

#include <nav2_costmap_2d/include/nav2_costmap_2d/denoise/image_processing.hpp>

Inheritance diagram for nav2_costmap_2d::imgproc_impl::EquivalenceLabelTrees< Label >:
Inheritance graph
[legend]
Collaboration diagram for nav2_costmap_2d::imgproc_impl::EquivalenceLabelTrees< Label >:
Collaboration graph
[legend]

Public Member Functions

void reset (const size_t rows, const size_t columns, ConnectivityType connectivity)
 Reset labels tree to initial state. More...
 
Label makeLabel ()
 Creates new next unused label and returns it back. More...
 
Label unionTrees (Label i, Label j)
 Unite the two trees containing nodes i and j and return the new root See union function in reference article. More...
 
const std::vector< Label > & getLabels ()
 Convert union-find trees to labels lookup table. More...
 

Detailed Description

template<class Label>
class nav2_costmap_2d::imgproc_impl::EquivalenceLabelTrees< Label >

Union-find data structure Implementation of union-find data structure, described in reference article. Store rooted trees, where each node of a tree is a provisional label and each edge represents an equivalence between two labels.

Template Parameters
Labelinteger type of label

Definition at line 393 of file image_processing.hpp.

Member Function Documentation

◆ getLabels()

template<class Label >
const std::vector<Label>& nav2_costmap_2d::imgproc_impl::EquivalenceLabelTrees< Label >::getLabels ( )
inline

Convert union-find trees to labels lookup table.

Returns
pair(labels lookup table, unique labels count)
Warning
This method invalidate EquivalenceLabelTrees inner state
Returns an internal buffer that will be invalidated on subsequent calls to the methods of EquivalenceLabelTrees

Definition at line 466 of file image_processing.hpp.

◆ makeLabel()

template<class Label >
Label nav2_costmap_2d::imgproc_impl::EquivalenceLabelTrees< Label >::makeLabel ( )
inline

Creates new next unused label and returns it back.

Exceptions
LabelOverflowif all possible labels already used
Returns
label

Definition at line 429 of file image_processing.hpp.

Referenced by nav2_costmap_2d::imgproc_impl::ProcessPixel< ConnectivityType::Way8 >::pass(), and nav2_costmap_2d::imgproc_impl::ProcessPixel< ConnectivityType::Way4 >::pass().

Here is the caller graph for this function:

◆ reset()

template<class Label >
void nav2_costmap_2d::imgproc_impl::EquivalenceLabelTrees< Label >::reset ( const size_t  rows,
const size_t  columns,
ConnectivityType  connectivity 
)
inline

Reset labels tree to initial state.

Parameters
rowsnumber of image rows
columnsnumber of image columns
connectivitypixels connectivity type

Definition at line 402 of file image_processing.hpp.

◆ unionTrees()

template<class Label >
Label nav2_costmap_2d::imgproc_impl::EquivalenceLabelTrees< Label >::unionTrees ( Label  i,
Label  j 
)
inline

Unite the two trees containing nodes i and j and return the new root See union function in reference article.

Parameters
itree node
jtree node
Returns
root of joined tree

Definition at line 446 of file image_processing.hpp.

Referenced by nav2_costmap_2d::imgproc_impl::ProcessPixel< ConnectivityType::Way8 >::pass(), and nav2_costmap_2d::imgproc_impl::ProcessPixel< ConnectivityType::Way4 >::pass().

Here is the caller graph for this function:

The documentation for this class was generated from the following file: