latest version v1.9 - last update 10 Apr 2010 |
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>
Classes | |
class | parameters |
the parameters for the class gradientFunctor More... | |
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 |
gradientFunctor & | copy (const gradientFunctor &other) |
gradientFunctor & | operator= (const gradientFunctor &other) |
virtual functor * | clone () const |
const parameters & | getParameters () 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 |
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.
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.
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
other | the object to be copied |
virtual lti::gradientFunctor::~gradientFunctor | ( | ) | [virtual] |
destructor
Computes the gradient of the given channel.
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. |
Reimplemented in lti::colorContrastGradient.
bool lti::gradientFunctor::apply | ( | channel & | srcdest | ) | const |
Computes the gradient of the given channel.
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. |
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.
other | the functor to be copied |
Reimplemented from lti::functor.
Reimplemented in lti::colorContrastGradient.
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
other | the functor to be copied |
Reimplemented from lti::functor.
Reimplemented in lti::colorContrastGradient.
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)
src | the already smoothed image | |
dx | x component of the gradient | |
dy | y component of the gradient |
arctanLUT lti::gradientFunctor::atan2 [protected] |
Look-Up Table for computation of arc tangent.