Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members

iptk::Gradient Class Reference

#include <gradient.h>

Inheritance diagram for iptk::Gradient:

Inheritance graph
[legend]
Collaboration diagram for iptk::Gradient:

Collaboration graph
[legend]
List of all members.

Detailed Description

Class to determine the gradient of an image.
Let I(m,n) be an image.

Then gradient image is calculated using:

Gx(m, n) = I(m+1, n) - I(m, n),
Gy(m, n) = I(m, n+1) - I(m, n),
G(m, n) = sqrt(Gx(m, n)^2 + Gy(m, n)^2),

and the direction is calculated using:

PHI(m, n) = atan2(Gy(m, n)/Gx(m, n))

The gradient operation simultaneously generates a 'direction map'. In generating the direction map, it is assumed that slope can be only in one of the eight directions as shown below:

6 7 8
5 X 1
4 3 2

The direction map is an array as large as the image and each cell stores the direction number corresponding to the direction of the gradient at the location. The registered image is not disturbed in this process. A new image, with its own memory space, holds the calculated gradient.

NOTE: An RGB image would be converted to a gray-scale image in this process of gradient determination.


Public Member Functions

 Gradient (void)
 Default constructor.

 Gradient (const iptk::Image &im)
 Image registering constructor.

 Gradient (const Gradient &g)
 Copy constructor Though this constructor does not look like a reference copier, the image data is shared between the passed object(i.e the parameter to the copy constructor) and the new object.

virtual ~Gradient ()
 Do nothing destructor.

virtual void process (void)
 A virtual function to process the image.

TNT::Array2D< int > getDirectionMap (void)
 Returns the direction map as an object of type tsip::Matrix.

virtual iptk::Image getResult (void)
 Returns the gradient image.


Protected Attributes

TNT::Array2D< int > dirMap
 Protected data member to hold the direction map.


Constructor & Destructor Documentation

iptk::Gradient::Gradient void   ) 
 

Default constructor.

An object created using the default constructor should set the image by using the setImage member function.

iptk::Gradient::Gradient const iptk::Image im  ) 
 

Image registering constructor.

The image is autmatically registered at the construction stage and processed in place.

virtual iptk::Gradient::~Gradient  )  [virtual]
 

Do nothing destructor.

Destructor does nothing at all as the default destructor would have been sufficient.


Member Function Documentation

TNT::Array2D< int > iptk::Gradient::getDirectionMap void   ) 
 

Returns the direction map as an object of type tsip::Matrix.

See the class description above for more information on direction maps.

virtual iptk::Image iptk::Gradient::getResult void   )  [virtual]
 

Returns the gradient image.

This image has its own memory different from the registered image.

Reimplemented from iptk::IP_Function.

Reimplemented in iptk::PrewittGradient, iptk::RobertGradient, iptk::SobelGradient, iptk::SteepestAscent, and iptk::SteepestDescent.

virtual void iptk::Gradient::process void   )  [virtual]
 

A virtual function to process the image.

This function actually performs the gradient operation on the registered image. The result is stored in a new memory location and can be accessed by the getResult member function. The image registered is un-affected by this process.

Implements iptk::IP_Function.

Reimplemented in iptk::PrewittGradient, iptk::RobertGradient, iptk::SobelGradient, iptk::SteepestAscent, and iptk::SteepestDescent.


Member Data Documentation

TNT::Array2D< int > iptk::Gradient::dirMap [protected]
 

Protected data member to hold the direction map.

Refer to the TNT documentation for more information.


The documentation for this class was generated from the following file:
Generated on Mon Nov 22 11:12:42 2004 for ImprolaLib by doxygen 1.3.7