#include <steepestDescent.h>
Inheritance diagram for iptk::SteepestDescent:
The algorithm for steepest-descent gradient extraction is as follows:
For every pixel in the image, find that neighbour, travelling to which we will have to encounter the steepest descent. Then this steepness is the gradient.
The steepest-descent path is that which climbs the most for a fixed distance. Hence, in our algorithm, the steepness measure is got by calculating the ratio of the intensity difference and the distance between the pixels. We should keep in mind that the distance between a pixel and its diagonal neighbour is 1.414, and 1 for other neighbours.
The gradient operation simultaneously generates a 'direction map'. 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. Direction number is the number assigned to each of the possible 8 directions as shown below. If there are no paths of ascent from a pixel, then the gradient there is assigned a value of zero.
6 | 7 | 8 |
5 | X | 1 |
4 | 3 | 2 |
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 | |
SteepestDescent (void) | |
Default Constructor. | |
SteepestDescent (const iptk::Image &im) | |
Image registering constructor. | |
SteepestDescent (const SteepestDescent &mdg) | |
Copy constructor. | |
virtual | ~SteepestDescent () |
Destructor. | |
virtual void | process (void) |
The function which does the actual gradient extraction. | |
virtual iptk::Image | getResult (void) |
Returns the resulting gradient as an iptk::Image object. |
|
Default Constructor.
|
|
Image registering constructor.
|
|
Copy constructor.
|
|
Destructor.
|
|
Returns the resulting gradient as an iptk::Image object.
Reimplemented from iptk::Gradient. |
|
The function which does the actual gradient extraction.
Reimplemented from iptk::Gradient. |