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

lti::nonMaximaSuppression Class Reference

The non-maxima suppression is usually the last stage of edge detectors (the most prominent example is the Canny Edge Detector, see lti::cannyEdges), but it can also be employed in other similar tasks, like detection of saliency edges from "structural" saliency maps (see for example lti::guyMedioniSaliency). More...

#include <ltiNonMaximaSuppression.h>

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

List of all members.

Classes

class  parameters
 the parameters for the class nonMaximaSuppression More...

Public Member Functions

 nonMaximaSuppression ()
 nonMaximaSuppression (const parameters &par)
 nonMaximaSuppression (const nonMaximaSuppression &other)
virtual ~nonMaximaSuppression ()
virtual const char * getTypeName () const
bool apply (const channel &preedges, const channel &orientation, channel8 &edges, const float maxPreedge=1.0f) const
bool apply (const channel &preedges, const channel &orientation, const channel &relevance, channel8 &edges, const float maxPreedge=1.0f) const
nonMaximaSuppressioncopy (const nonMaximaSuppression &other)
nonMaximaSuppressionoperator= (const nonMaximaSuppression &other)
virtual functorclone () const
const parametersgetParameters () const

Protected Member Functions

float interpolate (const float y1, const float y2, const float fOffset) const
void nonMaxSuppression (const channel &preedges, const channel &orientation, channel8 &edges, const float thresholdMin) const
void hysteresis (const channel &preedge, const channel8 &maxima, const float thresholdMax, channel8 &dest) const
void thresholdValues (const channel &grad, const float maxGrad, float &thresholdMin, float &thresholdMax) const
void checkOrientation (const channel &src, channel &dest) const
int findEndPoints (const channel8 &src, channel8 &endPts, pointList &endPtsList) const
bool trackPoints (const channel8 &edges, const pointList &endPtsList, const channel &orientation, tpointList< float > &deltas) const
bool fillGaps (const channel8 &edges, const channel &gradMag, const pointList &endPtsList, const tpointList< float > &deltas, channel8 &dest) const

Detailed Description

The non-maxima suppression is usually the last stage of edge detectors (the most prominent example is the Canny Edge Detector, see lti::cannyEdges), but it can also be employed in other similar tasks, like detection of saliency edges from "structural" saliency maps (see for example lti::guyMedioniSaliency).

From a sort of "diffuse edge" channel, this functor tries first to find all local maxima, and suppresses the rest. In an optional hysteresis stage, neighbor pixels of detected maxima can also "survive" the suppression if their value exceeds a lower threshold value.

A similar class used in detection of local maxima is the lti::localMaxima.

There are two way to given the thresholds. The classical way is to give them as a percentage of the maximal pixel value found in the image. This is the way usually described in the text-books when describing the last stages of the Canny Edge Detection.

This functor provides an additional (sometimes more robust way) to select the thresholds. It is an indirect way that computes the threshold such that a given percentage of the total number of pixels have a value above it. It is a way to tell the functor your expectation how many pixels in an image will be considered edges, instead of telling which value the edges will have.

Some parameters will allow you to select which way of threshold computation you prefer for the low- and high-thresholds.

See also:
parameters
localMaxima

Constructor & Destructor Documentation

lti::nonMaximaSuppression::nonMaximaSuppression (  ) 

default constructor

lti::nonMaximaSuppression::nonMaximaSuppression ( const parameters par  ) 

Construct a functor using the given parameters.

lti::nonMaximaSuppression::nonMaximaSuppression ( const nonMaximaSuppression other  ) 

copy constructor

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

destructor


Member Function Documentation

bool lti::nonMaximaSuppression::apply ( const channel preedges,
const channel orientation,
const channel relevance,
channel8 edges,
const float  maxPreedge = 1.0f 
) const

operates on a copy of the given parameters.

Parameters:
preedges channel containing pre-edges, i.e. only some confidence values are expected, where the maxima represent edges. Only those values greater than thresholdMax times the maximum value here will be considered.
orientation channel with the angles. It is an angle in the image coordinate system, i.e. a positive angle direction is clockwise. The units must be radians and the values MUST be zero or * positive between 0.0f and 2*Pi. See documentation of * parameters::checkAngle for more information.
relevance the thresholds will be computed "dividing" the ones given in the parameters by the corresponding element in this channel.
edges After the suppression, only the edges will be left.
maxPreedge Optional argument. The algorithm uses as maximum threshold the given parameters::maxThreshold multiplied by this argument. It is usally employed to give here the maximum of the preedges, which may be computed previously.
Returns:
true if apply successful or false otherwise.
bool lti::nonMaximaSuppression::apply ( const channel preedges,
const channel orientation,
channel8 edges,
const float  maxPreedge = 1.0f 
) const

operates on a copy of the given parameters.

Parameters:
preedges channel containing pre-edges, i.e. only some confidence values are expected, where the maxima represent edges. Only those values greater than thresholdMax times the maximum value here will be considered.
orientation channel with the angles. It is an angle in the image coordinate system, i.e. a positive angle direction is clockwise. The units must be radians and the values MUST be zero or * positive between 0.0f and 2*Pi. See documentation of * parameters::checkAngle for more information.
edges After the suppression, only the edges will be left.
maxPreedge Optional argument. The algorithm uses as maximum threshold the given parameters::maxThreshold multiplied by this argument. It is usally employed to give here the maximum of the preedges, which may be computed previously.
Returns:
true if apply successful or false otherwise.
void lti::nonMaximaSuppression::checkOrientation ( const channel src,
channel dest 
) const [protected]

ensure that the angles are between 0.0f and 2*Pi.

virtual functor* lti::nonMaximaSuppression::clone (  )  const [virtual]

returns a pointer to a clone of this functor.

Implements lti::functor.

nonMaximaSuppression& lti::nonMaximaSuppression::copy ( const nonMaximaSuppression other  ) 

copy data of "other" functor.

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

Reimplemented from lti::functor.

bool lti::nonMaximaSuppression::fillGaps ( const channel8 edges,
const channel gradMag,
const pointList endPtsList,
const tpointList< float > &  deltas,
channel8 dest 
) const [protected]

fill the gaps

int lti::nonMaximaSuppression::findEndPoints ( const channel8 src,
channel8 endPts,
pointList endPtsList 
) const [protected]

Find the edge points in the given src and create a new endPts channel with only those points.

At the same time a kd-Tree will be build, containing all end-points. This allows an efficient way to search for other end points in the neighborhood.

Parameters:
src edge mask
endPts resulting end-point mask
endPtsList list of end points
Returns:
the number of end-points found
const parameters& lti::nonMaximaSuppression::getParameters (  )  const

returns used parameters

Reimplemented from lti::transform.

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

returns the name of this type ("nonMaximaSuppression")

Reimplemented from lti::transform.

void lti::nonMaximaSuppression::hysteresis ( const channel preedge,
const channel8 maxima,
const float  thresholdMax,
channel8 dest 
) const [protected]

hysteresis

float lti::nonMaximaSuppression::interpolate ( const float  y1,
const float  y2,
const float  fOffset 
) const [inline, protected]

interpolate between two values (bilinear interpolation)

Parameters:
y1 value at x==0
y2 value at x==1
fOffset value in range of 0..1 to beinterpolated at
Returns:
returns the interpolated value
void lti::nonMaximaSuppression::nonMaxSuppression ( const channel preedges,
const channel orientation,
channel8 edges,
const float  thresholdMin 
) const [protected]

suppress the maxima.

This method assumes the edges channel has been adecuatelly resized.

The preedges and orientation channels MUST be connected.

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

alias for copy member

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

Reimplemented from lti::functor.

void lti::nonMaximaSuppression::thresholdValues ( const channel grad,
const float  maxGrad,
float &  thresholdMin,
float &  thresholdMax 
) const [protected]

compute the real thresholMin and threshodMax values to be used.

Parameters:
grad magnitude of the gradient
maxGrad max value in grad
thresholdMin minimum threshold for a pixel to be possible an edge
thresholdMax maximum threshold to be reached by a pixel to be definitively an edge.
bool lti::nonMaximaSuppression::trackPoints ( const channel8 edges,
const pointList endPtsList,
const channel orientation,
tpointList< float > &  deltas 
) const [protected]

Track points back the given number of pixels.

This method is used to track back the end points to get enough information about the possible extrapolations.

The result is a list of corresponding delta values to extrapolate the line beginning with an end point.


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

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