PCL
pcl::StructuringElement Class Referenceabstract

Abstract base class of all PCL structuring elements. More...

#include <StructuringElement.h>

+ Inheritance diagram for pcl::StructuringElement:

Public Types

typedef GenericVector< existence_mask_elementexistence_mask
 
typedef GenericVector< int > existence_mask_count
 
typedef uint32 existence_mask_element
 
typedef GenericVector< existence_maskexistence_mask_set
 

Public Member Functions

 StructuringElement (int size=3, int n=1)
 
 StructuringElement (const StructuringElement &x)
 
virtual ~StructuringElement ()
 
virtual StructuringElementClone () const =0
 
virtual bool ElementExists (int i, int j, int k) const
 
void Initialize () const
 
virtual bool IsBox (int k) const
 
bool IsReflected () const
 
int NumberOfElements () const
 
int NumberOfWays () const
 
StructuringElementoperator= (const StructuringElement &x)
 
template<typename T >
void PeekElements (T *h1, int &nh1, const T *h, int k) const
 
void Reflect ()
 
int Size () const
 

Detailed Description

StructuringElement defines a square multiway structure that can be used, along with a MorphologicalOperator, to build a MorphologicalTransformation.

A structure is a square matrix of Boolean elements. When an element is true we say that that element exists. Nonexistent (false) structure elements are ignored when a morphological operator is applied to an image.

A structuring element works for morphological transformations in a similar way to a kernel filter for spatial convolutions: the structure is placed centered on a pixel of the image being processed, and only those neighbor pixels falling behind existing structure elements are taken into account to compute the result of a morphological operator. When this operation is repeated for each pixel in an image, it implements a morphological transformation.

StructuringElement holds a multiway structure. Each way is actually a separate structure, so a multiway structure actually groups a set of structures with the same dimensions. When a multiway structure is used to apply a morphological operator, the operator is first applied through each way in the structure, and the result is the same operator applied to the partial results.

This class is thread-safe. This means that multiple execution threads can access the same StructuringElement instance concurrently to perform morphological transformations.

See also
MorphologicalOperator, MorphologicalTransformation

Definition at line 107 of file StructuringElement.h.

Member Typedef Documentation

◆ existence_mask

Represents a structure existence mask.

Definition at line 119 of file StructuringElement.h.

◆ existence_mask_count

A vector type used to store the number of existing structure elements.

Definition at line 129 of file StructuringElement.h.

◆ existence_mask_element

Represents an element of a structure existence mask.

Definition at line 114 of file StructuringElement.h.

◆ existence_mask_set

Represents a set of structure existence masks.

Definition at line 124 of file StructuringElement.h.

Constructor & Destructor Documentation

◆ StructuringElement() [1/2]

pcl::StructuringElement::StructuringElement ( int  size = 3,
int  n = 1 
)
inline

Constructs a default box StructuringElement object of the specified size in pixels and number of ways n.

Definition at line 135 of file StructuringElement.h.

◆ StructuringElement() [2/2]

pcl::StructuringElement::StructuringElement ( const StructuringElement x)
inline

Copy constructor.

Definition at line 150 of file StructuringElement.h.

◆ ~StructuringElement()

virtual pcl::StructuringElement::~StructuringElement ( )
inlinevirtual

Destroys a StructuringElement object.

Definition at line 162 of file StructuringElement.h.

Member Function Documentation

◆ Clone()

virtual StructuringElement* pcl::StructuringElement::Clone ( ) const
pure virtual

◆ ElementExists()

virtual bool pcl::StructuringElement::ElementExists ( int  i,
int  j,
int  k 
) const
inlinevirtual

Returns true iff a given element exists in this structure.

Parameters
icolumn position (X-coordinate) of the requested structure element. Must be 0 <= i < n, where n is the structure size.
jrow position (Y-coordinate) of the requested structure element. Must be 0 <= j < n, where n is the structure size.
kWay index. Must be 0 <= k < m, where m is the number of ways defined in this structure.

Reimplemented in pcl::BitmapStructure, pcl::ThreeWayStructure, pcl::StarStructure, pcl::DiagonalStructure, pcl::OrthogonalStructure, and pcl::CircularStructure.

Definition at line 247 of file StructuringElement.h.

◆ Initialize()

void pcl::StructuringElement::Initialize ( ) const
inline

Initializes the internal existence tables.

A structure is a square matrix of Boolean elements. When an element is true we say that that element exists. Nonexistent (false) structure elements are ignored when a morphological operator is applied to transform an image.

StructuringElement (and derived classes) uses a set of precomputed existence tables that greatly improves performance of morphological transformations, especially for complex structures. Calling this member function forces the immediate calculation of existence tables, if they haven't already been calculated previously. If the existence tables already exist, this function does nothing.

You normally should not need to call this member function directly, as existence tables are automatically calculated when required.

Note
This is a thread-safe routine. It can be safely called from multiple running threads.

Definition at line 338 of file StructuringElement.h.

Referenced by pcl::MorphologicalTransformation::MorphologicalTransformation(), and pcl::MorphologicalTransformation::SetStructure().

◆ IsBox()

virtual bool pcl::StructuringElement::IsBox ( int  k) const
inlinevirtual

Returns true iff this is a box structure. All elements in a box structure are existing elements.

The default implementation of this member function returns true if all elements in the k-th way are reported as existing elements by the ElementExists() member function.

Note
This is a performance-critical routine. When possible, derived classes should reimplement it in more efficient ways (for example, a circular structure is never a box structure).

Reimplemented in pcl::ThreeWayStructure, pcl::StarStructure, pcl::DiagonalStructure, pcl::OrthogonalStructure, pcl::CircularStructure, and pcl::BoxStructure.

Definition at line 228 of file StructuringElement.h.

◆ IsReflected()

bool pcl::StructuringElement::IsReflected ( ) const
inline

Returns true iff this structure has been reflected. Note that after an even number of successive reflections (which is a no-op) this member function will return false.

Definition at line 312 of file StructuringElement.h.

◆ NumberOfElements()

int pcl::StructuringElement::NumberOfElements ( ) const
inline

Returns the total number of structure elements, or Size()*Size(). Note that this includes both existing and nonexistent structure elements.

Definition at line 211 of file StructuringElement.h.

◆ NumberOfWays()

int pcl::StructuringElement::NumberOfWays ( ) const
inline

Returns the number of ways in this structure.

Definition at line 194 of file StructuringElement.h.

Referenced by operator=().

◆ operator=()

StructuringElement& pcl::StructuringElement::operator= ( const StructuringElement x)
inline

Copy assignment operator. Returns a reference to this object.

Definition at line 175 of file StructuringElement.h.

References NumberOfWays().

◆ PeekElements()

template<typename T >
void pcl::StructuringElement::PeekElements ( T *  h1,
int &  nh1,
const T *  h,
int  k 
) const
inline

Gets the subset of pixel sample values that correspond to existing elements in a way of this structure.

Parameters
[out]h1Vector of samples from the input h array that correspond to existing structure elements.
[out]nh1The number of existing elements in the k-th way of this structure. This is also the number of samples stored in the h1 vector.
hInput array of samples. Must be the starting address of a square matrix of n samples stored in row order, where n is the number of elements in this structure (equal to NumberOfElements()).
kWay index. Must be 0 <= k < m, where m is the number of ways defined in this structure.
Note
This function is thread-safe.

Definition at line 277 of file StructuringElement.h.

◆ Reflect()

void pcl::StructuringElement::Reflect ( )
inline

Reflects this structure.

Structure reflection is equivalent to a 180 degrees rotation of the underlying structure mask for each way. This member function is called internally by MorphologicalTransformation to apply dilation operators.

Definition at line 299 of file StructuringElement.h.

◆ Size()

int pcl::StructuringElement::Size ( ) const
inline

Returns the size of this structure in pixels.

Definition at line 202 of file StructuringElement.h.


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