Visual Servoing Platform version 3.7.0
Loading...
Searching...
No Matches
vpImageMorphology Class Reference

#include <vpImageMorphology.h>

Public Types

enum  vpConnexityType { CONNEXITY_4 , CONNEXITY_8 }

Static Public Member Functions

template<class Type>
static void erosion (vpImage< Type > &I, Type value, Type value_out, vpConnexityType connexity=CONNEXITY_4)
template<class Type>
static void dilatation (vpImage< Type > &I, Type value, Type value_out, vpConnexityType connexity=CONNEXITY_4)
template<typename T>
static void erosion (vpImage< T > &I, const vpConnexityType &connexity=CONNEXITY_4)
template<typename T>
static void dilatation (vpImage< T > &I, const vpConnexityType &connexity=CONNEXITY_4)
template<typename T>
static void erosion (vpImage< T > &I, const int &size)
template<typename T>
static void dilatation (vpImage< T > &I, const int &size)

Deprecated functions

static VP_DEPRECATED void erosion (vpImage< unsigned char > &I, const vpConnexityType &connexity=CONNEXITY_4)
static VP_DEPRECATED void dilatation (vpImage< unsigned char > &I, const vpConnexityType &connexity=CONNEXITY_4)

Detailed Description

Various mathematical morphology tools, erosion, dilatation...

Definition at line 67 of file vpImageMorphology.h.

Member Enumeration Documentation

◆ vpConnexityType

Type of connexity 4, or 8.

Enumerator
CONNEXITY_4 

For a given pixel 4 neighbors are considered (left, right, up, down)

CONNEXITY_8 

For a given pixel 8 neighbors are considered (left, right, up, down, and the 4 pixels located on the diagonal)

Examples
catchImageMorphology.cpp, perfImageMorphology.cpp, and tutorial-connected-components.cpp.

Definition at line 73 of file vpImageMorphology.h.

Member Function Documentation

◆ dilatation() [1/4]

template<typename T>
void vpImageMorphology::dilatation ( vpImage< T > & I,
const int & size )
static

Dilatation of size >=3 with 8-connectivity.

The dilatation of $ A \left( x, y \right) $ by $ B \left
(x, y \right) $ is defined as:

\‍[ \left ( A \oplus B \right ) \left( x,y
\right) = \textbf{max} \left \{ A \left ( x-x', y-y' \right ) + B \left (
x', y'\right ) | \left ( x', y'\right ) \subseteq D_B \right \} \‍]

where $ D_B $ is the domain of the structuring element $ B $ and $ A
\left( x,y \right) $ is assumed to be $ - \infty $ outside the domain of the image.

In our case, the dilatation is performed with a flat structuring element $ \left( B \left( x,y \right) = 0 \right) $. The dilatation using such a structuring element is equivalent to a local-maximum operator:

\‍[  \left ( A \oplus B \right ) \left( x,y \right) = \textbf{max} \left \{ A
\left ( x-x', y-y' \right ) | \left ( x', y'\right ) \subseteq D_B \right \}
\‍]

Template Parameters
TAny type of image, except vpRGBa .
Parameters
[out]IThe image to which the dilatation must be applied, where the dilatation corresponds to a max operator on a window of size size.
[in]sizeThe size of the window on which is performed the max operator for each pixel.
See also
erosion(vpImage<T> &, const int &)

Definition at line 570 of file vpImageMorphology.h.

◆ dilatation() [2/4]

template<typename T>
void vpImageMorphology::dilatation ( vpImage< T > & I,
const vpConnexityType & connexity = CONNEXITY_4 )
static

Dilate an image using the given structuring element.

The dilatation of $ A \left( x, y \right) $ by $ B \left
(x, y \right) $ is defined as:

\‍[ \left ( A \oplus B \right ) \left( x,y
\right) = \textbf{max} \left \{ A \left ( x-x', y-y' \right ) + B \left (
x', y'\right ) | \left ( x', y'\right ) \subseteq D_B \right \} \‍]

where $ D_B $ is the domain of the structuring element $ B $ and $ A
\left( x,y \right) $ is assumed to be $ - \infty $ outside the domain of the image.

In our case, the dilatation is performed with a flat structuring element $ \left( B \left( x,y \right) = 0 \right) $. The dilatation using such a structuring element is equivalent to a local-maximum operator:

\‍[  \left ( A \oplus B \right ) \left( x,y \right) = \textbf{max} \left \{ A
\left ( x-x', y-y' \right ) | \left ( x', y'\right ) \subseteq D_B \right \}
\‍]

Parameters
I: Image to process.
connexity: Type of connexity: 4 or 8.
See also
erosion(vpImage<T> &, const vpConnexityType &)

Definition at line 464 of file vpImageMorphology.h.

◆ dilatation() [3/4]

template<class Type>
void vpImageMorphology::dilatation ( vpImage< Type > & I,
Type value,
Type value_out,
vpConnexityType connexity = CONNEXITY_4 )
static

Dilate a binary image using a structuring element of size one.

Parameters
I: Image to process.
value: Values of the pixels to dilate.
value_out: Value to set if dilatation is done.
connexity: Type of connexity: 4 or 8.

To dilate a black area in an unsigned char image with one element mask, set value to 0 and value_out to 255.

To dilate a white area in an unsigned char image with one element mask, set value to 255 and value_out to 0.

See also
erosion()
Examples
catchImageMorphology.cpp, perfImageMorphology.cpp, and tutorial-count-coins.cpp.

Definition at line 304 of file vpImageMorphology.h.

References CONNEXITY_4, vpImage< Type >::getHeight(), and vpImage< Type >::getWidth().

Referenced by vpCircleHoughTransform::computeCenterCandidates(), dilatation(), and VISP_NAMESPACE_NAME::reconstruct().

◆ dilatation() [4/4]

VP_DEPRECATED void vpImageMorphology::dilatation ( vpImage< unsigned char > & I,
const vpConnexityType & connexity = CONNEXITY_4 )
inlinestatic

A dilatation is performed with a flat structuring element $ \left( B \left( x,y \right) = 0 \right) $. The erosion using such a structuring element is equivalent to a local-maximum operator:

\‍[  \left ( A \ominus B \right ) \left( x,y \right) = \textbf{max} \left \{ A
\left ( x+x', y+y' \right ) | \left ( x', y'\right ) \subseteq D_B \right \}
\‍]

Deprecated
Provided only for compat with previous releases. Use rather the template function dilatation(vpImage<T> &, const vpConnexityType &)
Parameters
I: Gray-scale image to process.
connexity: Type of connexity: 4 or 8.

Definition at line 134 of file vpImageMorphology.h.

References CONNEXITY_4, and dilatation().

◆ erosion() [1/4]

template<typename T>
void vpImageMorphology::erosion ( vpImage< T > & I,
const int & size )
static

Erosion of size >=3 with 8-connectivity. Erode an image using the given structuring element.

The erosion of $ A \left( x, y \right) $ by $ B \left (x, y
\right) $ is defined as:

\‍[ \left ( A \ominus B \right ) \left( x,y
\right) = \textbf{min} \left \{ A \left ( x+x', y+y' \right ) - B \left (
x', y'\right ) | \left ( x', y'\right ) \subseteq D_B \right \} \‍]

where $ D_B $ is the domain of the structuring element $ B $ and $ A
\left( x,y \right) $ is assumed to be $ + \infty $ outside the domain of the image.

In our case, the erosion is performed with a flat structuring element $ \left( B \left( x,y \right) = 0 \right) $. The erosion using such a structuring element is equivalent to a local-minimum operator:

\‍[  \left ( A \ominus B \right ) \left( x,y \right) = \textbf{min} \left \{ A
\left ( x+x', y+y' \right ) | \left ( x', y'\right ) \subseteq D_B \right \}
\‍]

Template Parameters
TAny type of image, except vpRGBa .
Parameters
[out]IThe image to which the erosion must be applied, where the erosion corresponds to a min operator on a window of size size.
[in]sizeThe size of the window on which is performed the min operator for each pixel.
See also
dilatation(vpImage<T> &, const int &)

Definition at line 538 of file vpImageMorphology.h.

◆ erosion() [2/4]

template<typename T>
void vpImageMorphology::erosion ( vpImage< T > & I,
const vpConnexityType & connexity = CONNEXITY_4 )
static

Erode an image using the given structuring element.

The erosion of $ A \left( x, y \right) $ by $ B \left (x, y
\right) $ is defined as:

\‍[ \left ( A \ominus B \right ) \left( x,y
\right) = \textbf{min} \left \{ A \left ( x+x', y+y' \right ) - B \left (
x', y'\right ) | \left ( x', y'\right ) \subseteq D_B \right \} \‍]

where $ D_B $ is the domain of the structuring element $ B $ and $ A
\left( x,y \right) $ is assumed to be $ + \infty $ outside the domain of the image.

In our case, the erosion is performed with a flat structuring element $ \left( B \left( x,y \right) = 0 \right) $. The erosion using such a structuring element is equivalent to a local-minimum operator:

\‍[  \left ( A \ominus B \right ) \left( x,y \right) = \textbf{min} \left \{ A
\left ( x+x', y+y' \right ) | \left ( x', y'\right ) \subseteq D_B \right \}
\‍]

Parameters
I: Image to process.
connexity: Type of connexity: 4 or 8.
See also
dilatation(vpImage<T> &, const vpConnexityType &)

Definition at line 434 of file vpImageMorphology.h.

◆ erosion() [3/4]

template<class Type>
void vpImageMorphology::erosion ( vpImage< Type > & I,
Type value,
Type value_out,
vpConnexityType connexity = CONNEXITY_4 )
static

Erode a binary image using a structuring element of size one.

Parameters
I: Image to process.
value: Values of the pixels to erode.
value_out: Value to set if erosion is done.
connexity: Type of connexity: 4 or 8.

To erode a black area in an unsigned char image, set value to 0 and value_out to 255.

To erode a white area in an unsigned char image with one element mask, set value to 255 and value_out to 0.

See also
dilatation()
Examples
catchImageMorphology.cpp, perfImageMorphology.cpp, and tutorial-count-coins.cpp.

Definition at line 225 of file vpImageMorphology.h.

References CONNEXITY_4, vpImage< Type >::getHeight(), and vpImage< Type >::getWidth().

Referenced by erosion().

◆ erosion() [4/4]

VP_DEPRECATED void vpImageMorphology::erosion ( vpImage< unsigned char > & I,
const vpConnexityType & connexity = CONNEXITY_4 )
inlinestatic

An erosion is performed with a flat structuring element $ \left( B \left( x,y \right) = 0 \right) $. The erosion using such a structuring element is equivalent to a local-minimum operator:

\‍[  \left ( A \ominus B \right ) \left( x,y \right) = \textbf{min} \left \{ A
\left ( x+x', y+y' \right ) | \left ( x', y'\right ) \subseteq D_B \right \}
\‍]

Deprecated
Provided only for compat with previous releases. Use rather the template function erosion(vpImage<T> &, const vpConnexityType &)
Parameters
I: Gray-scale image to process.
connexity: Type of connexity: 4 or 8.

Definition at line 117 of file vpImageMorphology.h.

References CONNEXITY_4, and erosion().