LTI-Lib latest version v1.9 - last update 10 Apr 2010

lti::colorContrastGradient Class Reference

The contrast gradient is used in color or multi-spectral image as a replacement of the gray-value gradient in gray images. More...

#include <ltiColorContrastGradient.h>

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

List of all members.

Classes

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

Public Member Functions

 colorContrastGradient ()
 colorContrastGradient (const parameters::eOutputFormat &format, const int gradKernelSize=0)
 colorContrastGradient (const parameters &par)
 colorContrastGradient (const colorContrastGradient &other)
virtual ~colorContrastGradient ()
virtual const char * getTypeName () const
bool apply (const image &src, channel &xOrMag, channel &yOrArg) const
bool apply (const channel &src, channel &xOrMag, channel &yOrArg) const
bool apply (const channel8 &src, channel &xOrMag, channel &yOrArg) const
bool apply (const channel &c1, const channel &c2, const channel &c3, channel &xOrMag, channel &yOrArg) const
bool apply (const channel &c1, const channel &c2, const channel &c3, channel &xOrMag, channel &yOrArg, float &maxMag) const
bool apply (const channel &c1, const channel &c2, channel &xOrMag, channel &yOrArg, float &maxMag) const
bool apply (const channel &c1, const channel &c2, const channel &c3, channel &lambdaMin, channel &lambdaMax, channel &orientation, float &maxMag) const
colorContrastGradientcopy (const colorContrastGradient &other)
colorContrastGradientoperator= (const colorContrastGradient &other)
virtual functorclone () const
const parametersgetParameters () const

Protected Member Functions

bool computeGradientPolar (const channel &c1, const channel &c2, const channel &c3, channel &gradAbs, channel &orientation, float &maxVal) const
bool computeGradientPolar (const channel &c1, const channel &c2, channel &gradAbs, channel &orientation, float &maxVal) const
bool computeGradientPolar (const channel &c1, const channel &c2, const channel &c3, channel &lambdaMin, channel &lambdaMax, channel &orientation, float &maxVal) const
bool computeColorGradientCart (const channel &c1, const channel &c2, channel &xchnl, channel &ychnl, float &maxVal) const
bool computeColorGradientCart (const channel &c1, const channel &c2, const channel &c3, channel &xchnl, channel &ychnl, float &maxVal) const
float magSqr (const float a, const float b) const

Detailed Description

The contrast gradient is used in color or multi-spectral image as a replacement of the gray-value gradient in gray images.

Here, the approach introduced in A. Cumani, "Edge Detection in Multispectral Images", Technical Report, Istituto Elettrotecnico Nazionale "Galileo Ferraris", 1989 is followed.

A more detail theoretical analysis can be found in I.R. Greenshields "Coherent computation of the multispectral maximal directional derivative" Image and Vision Computing, Vol 18. 1999, pp. 1-7

With this approach, instead of a gradient, the maximum of the contrast function for each pixel is searched. The contrast function defines the direction at the (x,y) plane at which the contrast change is maximal. It corresponds to the greater eigenvalue and corresponding eigenvector of the square of the Jacobian matrix:

\[ \begin{pmatrix} \frac{\partial \mathbf{f}}{\partial x}\cdot \frac{\partial \mathbf{f}}{\partial x} & \frac{\partial \mathbf{f}}{\partial x}\cdot \frac{\partial \mathbf{f}}{\partial y} \\ \frac{\partial \mathbf{f}}{\partial x}\cdot \frac{\partial \mathbf{f}}{\partial y} & \frac{\partial \mathbf{f}}{\partial y}\cdot \frac{\partial \mathbf{f}}{\partial y} \\ \end{pmatrix} \]

As suggested in the literature, the difference between both eigenvalues should be used as contrast, and the direction of the main eigenvector as gradient direction.

with $\mathbf{f}(x,y)$ being any multi-spectral image. In this case this vector function is defined in a three dimensional color space.

Since this method uses the lti::arctanLUT class to accelerate the computation (sacrifying a little bit in angle precision, which anyway cannot be accurately determined due to the spatial quantization effects) the angles returned in the parameters::Polar mode are always possitive between 0 and 2*Pi.


Constructor & Destructor Documentation

lti::colorContrastGradient::colorContrastGradient (  ) 

default constructor

lti::colorContrastGradient::colorContrastGradient ( 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::colorContrastGradient::colorContrastGradient ( const parameters par  ) 

Construct a functor using the given parameters.

lti::colorContrastGradient::colorContrastGradient ( const colorContrastGradient other  ) 

copy constructor

Parameters:
other the object to be copied
virtual lti::colorContrastGradient::~colorContrastGradient (  )  [virtual]

destructor


Member Function Documentation

bool lti::colorContrastGradient::apply ( const channel c1,
const channel c2,
const channel c3,
channel lambdaMin,
channel lambdaMax,
channel orientation,
float &  maxMag 
) const

Computes the eigenvalues of the square of the Jacobian matrix of a tri-spectral image.

This method ignores the parameter format, as it makes only sense for a polar system, and also the contrastFormat parameter as it explicitely requests the computation of all eigenvalues.

Parameters:
c1 first channel of the input image.
c2 second channel of the input image.
c3 third channel of the input image.
lambdaMin the resulting minimal eigenvalues
lambdaMax the resulting maximal eigenvalues
orientation the angle of the main axis (diretion of the eigenvector with the greater eigenvalue)
maxMag maximum contrast value found (lambdaMin-lambdaMax)
Returns:
true if apply successful or false otherwise.
bool lti::colorContrastGradient::apply ( const channel c1,
const channel c2,
channel xOrMag,
channel yOrArg,
float &  maxMag 
) const

Computes the color contrast gradient of a bi-spectral image defined by the two given components.

Parameters:
c1 first channel of the input image.
c2 second channel of the input image.
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.
maxMag if polar and cartesic modes (see parameters), the maximum magnitude of the gradient found.
Returns:
true if apply successful or false otherwise.
bool lti::colorContrastGradient::apply ( const channel c1,
const channel c2,
const channel c3,
channel xOrMag,
channel yOrArg,
float &  maxMag 
) const

Computes the color contrast gradient of a tri-spectral image defined by the three given components.

Parameters:
c1 first channel of the input image.
c2 second channel of the input image.
c3 third channel of the input image.
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.
maxMag if polar and cartesic modes (see parameters), the maximum magnitude of the gradient found.
Returns:
true if apply successful or false otherwise.
bool lti::colorContrastGradient::apply ( const channel c1,
const channel c2,
const channel c3,
channel xOrMag,
channel yOrArg 
) const

Computes the color contrast gradient of a tri-spectra image defined by the three given components.

Parameters:
c1 first channel of the input image.
c2 second channel of the input image.
c3 third channel of the input image.
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.
bool lti::colorContrastGradient::apply ( const channel8 src,
channel xOrMag,
channel yOrArg 
) const

Computes the (monochromatic) 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 from lti::gradientFunctor.

bool lti::colorContrastGradient::apply ( const channel src,
channel xOrMag,
channel yOrArg 
) const

Computes the (monochromatic) 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 from lti::gradientFunctor.

bool lti::colorContrastGradient::apply ( const image src,
channel xOrMag,
channel yOrArg 
) const

Computes the color contrast gradient of the given RGB image.

Parameters:
src image with the source data. The image will be splitted in its R,G and B components for the analysis.
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.
virtual functor* lti::colorContrastGradient::clone (  )  const [virtual]

returns a pointer to a clone of this functor.

Reimplemented from lti::gradientFunctor.

bool lti::colorContrastGradient::computeColorGradientCart ( const channel c1,
const channel c2,
const channel c3,
channel xchnl,
channel ychnl,
float &  maxVal 
) const [protected]

differentiate the image in X and Y directions

Parameters:
c1 first channel
c2 second channel
c3 third channel
xchnl x component
ychnl y component
maxVal maximum magnitude (max(sqrt(xchnl*xchnl+ychnl*ychnl))
Returns:
true if successful, false otherwise
bool lti::colorContrastGradient::computeColorGradientCart ( const channel c1,
const channel c2,
channel xchnl,
channel ychnl,
float &  maxVal 
) const [protected]

differentiate the image in X and Y directions

Parameters:
c1 first channel
c2 second channel
xchnl x component
ychnl y component
maxVal maximum magnitude (max(sqrt(xchnl*xchnl+ychnl*ychnl))
Returns:
true if successful, false otherwise
bool lti::colorContrastGradient::computeGradientPolar ( const channel c1,
const channel c2,
const channel c3,
channel lambdaMin,
channel lambdaMax,
channel orientation,
float &  maxVal 
) const [protected]

differentiate the image in X and Y directions

Parameters:
c1 first channel
c2 second channel
c3 third channel
lambdaMin minimum eigenvalues
lambdaMax maximum eigenvalues
orientation the orientation map of the gradient image
maxVal maximum contrast value found (lambdaMin-lambdaMax)
Returns:
true if successful, false otherwise
bool lti::colorContrastGradient::computeGradientPolar ( const channel c1,
const channel c2,
channel gradAbs,
channel orientation,
float &  maxVal 
) const [protected]

differentiate the image in X and Y directions

Parameters:
c1 first channel
c2 second channel
gradAbs the absolute values of the gradient
orientation the orientation map of the gradient image
maxVal maximum value found in gradAbs
Returns:
true if successful, false otherwise
bool lti::colorContrastGradient::computeGradientPolar ( const channel c1,
const channel c2,
const channel c3,
channel gradAbs,
channel orientation,
float &  maxVal 
) const [protected]

differentiate the image in X and Y directions

Parameters:
c1 first channel
c2 second channel
c3 third channel
gradAbs the absolute values of the gradient
orientation the orientation map of the gradient image
maxVal maximum value found in gradAbs
Returns:
true if successful, false otherwise
colorContrastGradient& lti::colorContrastGradient::copy ( const colorContrastGradient other  ) 

copy data of "other" functor.

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

Reimplemented from lti::gradientFunctor.

const parameters& lti::colorContrastGradient::getParameters (  )  const

returns used parameters

Reimplemented from lti::gradientFunctor.

virtual const char* lti::colorContrastGradient::getTypeName (  )  const [virtual]

returns the name of this type ("colorContrastGradient")

Reimplemented from lti::gradientFunctor.

float lti::colorContrastGradient::magSqr ( const float  a,
const float  b 
) const [inline, protected]

Compute the square of the magnitude: a*a + b*b.

colorContrastGradient& lti::colorContrastGradient::operator= ( const colorContrastGradient other  ) 

alias for copy member

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

Reimplemented from lti::gradientFunctor.


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

Generated on Sat Apr 10 15:27:08 2010 for LTI-Lib by Doxygen 1.6.1