PCL
|
Abstract base class of all PCL structuring elements. More...
#include <StructuringElement.h>
Public Types | |
using | existence_mask = GenericVector< existence_mask_element > |
using | existence_mask_count = GenericVector< int > |
using | existence_mask_element = uint32 |
using | existence_mask_set = GenericVector< existence_mask > |
Public Member Functions | |
StructuringElement (const StructuringElement &x) | |
StructuringElement (int size=3, int n=1) | |
virtual | ~StructuringElement () |
virtual StructuringElement * | Clone () 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 |
StructuringElement & | operator= (const StructuringElement &x) |
template<typename T > | |
void | PeekElements (T *h1, int &nh1, const T *h, int k) const |
void | Reflect () |
int | Size () const |
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.
Definition at line 107 of file StructuringElement.h.
Represents a structure existence mask.
Definition at line 119 of file StructuringElement.h.
A vector type used to store the number of existing structure elements.
Definition at line 129 of file StructuringElement.h.
Represents an element of a structure existence mask.
Definition at line 114 of file StructuringElement.h.
Represents a set of structure existence masks.
Definition at line 124 of file StructuringElement.h.
|
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.
|
inline |
Copy constructor.
Definition at line 150 of file StructuringElement.h.
|
inlinevirtual |
Virtual destructor.
Definition at line 162 of file StructuringElement.h.
|
pure virtual |
Returns a pointer to a dynamically allocated duplicate of this structuring element.
Implemented in pcl::BitmapStructure, pcl::ThreeWayStructure, pcl::StarStructure, pcl::DiagonalStructure, pcl::OrthogonalStructure, pcl::CircularStructure, and pcl::BoxStructure.
Referenced by pcl::MorphologicalTransformation::MorphologicalTransformation(), and pcl::MorphologicalTransformation::SetStructure().
|
inlinevirtual |
Returns true iff a given element exists in this structure.
i | column position (X-coordinate) of the requested structure element. Must be 0 <= i < n, where n is the structure size. |
j | row position (Y-coordinate) of the requested structure element. Must be 0 <= j < n, where n is the structure size. |
k | Way 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.
|
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.
Definition at line 338 of file StructuringElement.h.
Referenced by pcl::MorphologicalTransformation::MorphologicalTransformation(), and pcl::MorphologicalTransformation::SetStructure().
|
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.
Reimplemented in pcl::ThreeWayStructure, pcl::StarStructure, pcl::DiagonalStructure, pcl::OrthogonalStructure, pcl::CircularStructure, and pcl::BoxStructure.
Definition at line 228 of file StructuringElement.h.
|
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.
|
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.
|
inline |
Returns the number of ways in this structure.
Definition at line 194 of file StructuringElement.h.
Referenced by operator=().
|
inline |
Copy assignment operator. Returns a reference to this object.
Definition at line 175 of file StructuringElement.h.
References NumberOfWays().
|
inline |
Gets the subset of pixel sample values that correspond to existing elements in a way of this structure.
[out] | h1 | Vector of samples from the input h array that correspond to existing structure elements. |
[out] | nh1 | The number of existing elements in the k-th way of this structure. This is also the number of samples stored in the h1 vector. |
h | Input 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()). | |
k | Way index. Must be 0 <= k < m, where m is the number of ways defined in this structure. |
Definition at line 277 of file StructuringElement.h.
|
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.
|
inline |
Returns the size of this structure in pixels.
Definition at line 202 of file StructuringElement.h.