LTI-Lib latest version v1.9 - last update 24 Nov 2005
Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

lti::gradientFunctor Class Reference
[Linear filtering]

The gradient is a simple wrapper for the convolution functor with some convenience parameterization to choose between different common gradient kernels. More...

#include <ltiGradientFunctor.h>

Inheritance diagram for lti::gradientFunctor:

Inheritance graph
[legend]
Collaboration diagram for lti::gradientFunctor:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 gradientFunctor (const bool initializeParameters=true)
 gradientFunctor (const parameters::eOutputFormat &format, const int gradKernelSize=0)
 gradientFunctor (const parameters &par)
 gradientFunctor (const gradientFunctor &other)
virtual ~gradientFunctor ()
virtual const char * getTypeName () const
bool apply (const channel &src, channel &xOrMag, channel &yOrArg) const
bool apply (const channel &src, channel &mag) const
bool apply (channel &srcdest) const
bool apply (const channel8 &src, channel &xOrMag, channel &yOrArg) const
gradientFunctorcopy (const gradientFunctor &other)
gradientFunctoroperator= (const gradientFunctor &other)
virtual functorclone () const
const parametersgetParameters () const

Protected Member Functions

void cartToPolar (const int dx, const int dy, float &mag, float &angle) const
One channel gradient computation
bool computeGradientCart (const channel &src, channel &dx, channel &dy) const
bool xyDifferentiateImageCart (const channel &src, channel &dx, channel &dy) const
bool xyDifferentiateImageCartOpt (const channel &src, channel &dx, channel &dy) const
bool xyDifferentiateImageCartClassicSep (const channel &src, channel &dx, channel &dy) const
bool xyDifferentiateImageCartClassic2D (const channel &src, channel &dx, channel &dy) const
bool xyDifferentiateImageCartInterPixel (const channel &src, channel &dx, channel &dy) const
bool xyDifferentiateImage (const channel8 &src, channel &gradAbs, channel &gradPhi) const

Protected Attributes

arctanLUT atan2

Classes

class  parameters
 the parameters for the class gradientFunctor More...

Detailed Description

The gradient is a simple wrapper for the convolution functor with some convenience parameterization to choose between different common gradient kernels.

Not only the classical simple difference computation (right minus left for the x direction or bottom minus top for the y direction) and the classical Sobel, Prewitt, Robinson, Roberts and Kirsch kernels can be used, but the more sophisticated Ando optimal kernels (see lti::gradientKernelX) and the approximation using oriented gaussian derivatives can be used.

The kernel computes the gradient for lti::channel objects only. For color images you can use one of the derived classes.

See also:
lti::gradientFunctor,lti::gradientKernelX,lti::colorContrastGradient


Constructor & Destructor Documentation

lti::gradientFunctor::gradientFunctor const bool  initializeParameters = true  ) 
 

Default constructor.

lti::gradientFunctor::gradientFunctor const parameters::eOutputFormat format,
const int  gradKernelSize = 0
 

Construct a functor using gradient kernels with the specified values.

Parameters:
format specify the format to be use: Cartesic or Polar
gradKernelSize size for the gradient kernel to be used.

lti::gradientFunctor::gradientFunctor const parameters par  ) 
 

Construct a functor using the given parameters.

lti::gradientFunctor::gradientFunctor const gradientFunctor other  ) 
 

copy constructor

Parameters:
other the object to be copied

virtual lti::gradientFunctor::~gradientFunctor  )  [virtual]
 

destructor


Member Function Documentation

bool lti::gradientFunctor::apply const channel8 src,
channel xOrMag,
channel yOrArg
const
 

Computes the gradient of the given channel.

Parameters:
src channel8 with the source data.
xOrMag the resulting x component or magnitude of the gradient will be left here.
yOrArg the resulting y component or argument (orientation) of the gradient will be left here.
Returns:
true if apply successful or false otherwise.

Reimplemented in lti::colorContrastGradient.

bool lti::gradientFunctor::apply channel srcdest  )  const
 

Computes the gradient magnitude of the given channel.

Parameters:
srcdest channel with source data, the resulting magnitude will be left here too.
Returns:
true if apply successful or false otherwise.

bool lti::gradientFunctor::apply const channel src,
channel mag
const
 

Computes the gradient magnitude of the given channel.

Parameters:
src channel with the source data.
mag the resulting magnitude of the gradient will be left here.
Returns:
true if apply successful or false otherwise.

bool lti::gradientFunctor::apply const channel src,
channel xOrMag,
channel yOrArg
const
 

Computes the gradient of the given channel.

Parameters:
src channel with the source data.
xOrMag the resulting x component or magnitude of the gradient will be left here.
yOrArg the resulting y component or argument (orientation) of the gradient will be left here.
Returns:
true if apply successful or false otherwise.

Reimplemented in lti::colorContrastGradient.

void lti::gradientFunctor::cartToPolar const int  dx,
const int  dy,
float &  mag,
float &  angle
const [inline, protected]
 

convert a pair of values in cartesic system into a pair in polar system

The LUT takes care that the returned value lies between 0 and 2*Pi

virtual functor* lti::gradientFunctor::clone  )  const [virtual]
 

returns a pointer to a clone of this functor.

Implements lti::functor.

Reimplemented in lti::colorContrastGradient.

bool lti::gradientFunctor::computeGradientCart const channel src,
channel dx,
channel dy
const [protected]
 

compute the gradient of the src channel8 using the adecuate method xyDifferentiateXYZ

gradientFunctor& lti::gradientFunctor::copy const gradientFunctor other  ) 
 

copy data of "other" functor.

Parameters:
other the functor to be copied
Returns:
a reference to this functor object

const parameters& lti::gradientFunctor::getParameters  )  const
 

returns used parameters

Reimplemented from lti::transform.

Reimplemented in lti::colorContrastGradient.

virtual const char* lti::gradientFunctor::getTypeName  )  const [virtual]
 

returns the name of this type ("gradientFunctor")

Reimplemented from lti::transform.

Reimplemented in lti::colorContrastGradient.

gradientFunctor& lti::gradientFunctor::operator= const gradientFunctor other  ) 
 

alias for copy member

Parameters:
other the functor to be copied
Returns:
a reference to this functor object

bool lti::gradientFunctor::xyDifferentiateImage const channel8 src,
channel gradAbs,
channel gradPhi
const [protected]
 

Differentiate the image in X and Y directions using operator (-1 0 1) The result will be directly in polar coordinates.

Parameters:
src source channel
gradAbs magnitude of the gradient.
gradPhi argument of the gradient (angle).
Returns:
true if successful, false otherwise

bool lti::gradientFunctor::xyDifferentiateImageCart const channel src,
channel dx,
channel dy
const [protected]
 

differentiate the image in X and Y directions using operator (-1 0 1)

Parameters:
src source channel
dx x component of the gradient
dy y component of the gradient
Returns:
true if successful, false otherwise

bool lti::gradientFunctor::xyDifferentiateImageCartClassic2D const channel src,
channel dx,
channel dy
const [protected]
 

differentiate the image in X and Y directions using classic gradients.

Parameters:
src source channel
dx x component of the gradient
dy y component of the gradient
Returns:
true if successful, false otherwise

bool lti::gradientFunctor::xyDifferentiateImageCartClassicSep const channel src,
channel dx,
channel dy
const [protected]
 

differentiate the image in X and Y directions using optimal operators.

Parameters:
src source channel
dx x component of the gradient
dy y component of the gradient
Returns:
true if successful, false otherwise

bool lti::gradientFunctor::xyDifferentiateImageCartInterPixel const channel src,
channel dx,
channel dy
const [protected]
 

Roberts operator.

calculates the gradient at the center of a 2x2 mask. The position marked with "S" is the position where the gradient is stored at in the output channels:

 ( S  +) 
 ( +  +)

(The origin (0,0) is at the bottom left of the image)

Parameters:
src the already smoothed image
dx x component of the gradient
dy y component of the gradient
Returns:
returns NULL if successful, a textual error message otherwise

bool lti::gradientFunctor::xyDifferentiateImageCartOpt const channel src,
channel dx,
channel dy
const [protected]
 

differentiate the image in X and Y directions using optimal operators.

Parameters:
src source channel
dx x component of the gradient
dy y component of the gradient
Returns:
true if successful, false otherwise


Member Data Documentation

arctanLUT lti::gradientFunctor::atan2 [protected]
 

Look-Up Table for computation of arc tangent.


The documentation for this class was generated from the following file:
Generated on Thu Nov 24 16:41:33 2005 for LTI-Lib by Doxygen 1.4.4