latest version v1.9 - last update 10 Apr 2010 |
This simple functor tries to find the local maxima at a given window and suppresses all other values, setting them the "nonMaxValue" given in the parameters (usually 0). More...
#include <ltiLocalMaxima.h>
Classes | |
class | parameters |
the parameters for the class localMaxima More... | |
Public Member Functions | |
localMaxima () | |
localMaxima (const parameters &par) | |
localMaxima (const localMaxima &other) | |
virtual | ~localMaxima () |
virtual const char * | getTypeName () const |
bool | apply (matrix< T > &srcdest) |
bool | apply (vector< T > &srcdest) |
bool | apply (const matrix< T > &src, matrix< T > &dest) |
bool | apply (const matrix< T > &src, matrix< T > &dest, pointList &theMaxs) |
bool | apply (const matrix< T > &src, pointList &theMaxs) |
bool | apply (const vector< T > &src, vector< T > &dest) |
localMaxima & | copy (const localMaxima &other) |
localMaxima & | operator= (const localMaxima &other) |
virtual functor * | clone () const |
const parameters & | getParameters () const |
virtual bool | updateParameters () |
Protected Member Functions | |
bool | apply (const vector< T > &src, const vector< T > &maxRes, vector< T > &dest) |
T | getValue (const T srcVal) const |
bool | hystheresisSuppression (const matrix< T > &src, matrix< T > &localMax, pointList &maxList) const |
Protected Attributes | |
T | suppressValue |
Static Protected Attributes | |
static const T | minimumT |
This simple functor tries to find the local maxima at a given window and suppresses all other values, setting them the "nonMaxValue" given in the parameters (usually 0).
The template parameter T defines the type of the matrix or vector to be filtered.
An instance of this class cannot be used from different threads (not thread-save). If you have multiple threads, use simply one functor instance for each thread.
This class is used for example in the extraction of the maxima in the Hough Transform.
A very similar functor with more use in edge-detection applications is the lti::nonMaximaSuppression, which is used for example in the Canny edge detection.
lti::localMaxima< T >::localMaxima | ( | ) |
default constructor
lti::localMaxima< T >::localMaxima | ( | const parameters & | par | ) |
Construct a functor using the given parameters.
lti::localMaxima< T >::localMaxima | ( | const localMaxima< T > & | other | ) |
copy constructor
other | the object to be copied |
virtual lti::localMaxima< T >::~localMaxima | ( | ) | [virtual] |
destructor
bool lti::localMaxima< T >::apply | ( | const vector< T > & | src, | |
const vector< T > & | maxRes, | |||
vector< T > & | dest | |||
) | [protected] |
operates on a copy of the given parameters.
src | vector<T> with the source data. | |
maxRes | vector<T> with the source data, where is has been filtered to contain the max of columns. | |
dest | vector<T> where the result will be left. |
bool lti::localMaxima< T >::apply | ( | const vector< T > & | src, | |
vector< T > & | dest | |||
) |
Extract the local maxima from src and leave the result in dest, consisting on the maxima values in their respective positions and in the rest of the image the value indicated in parameters::noMaxValue.
src | vector<T> with the source data. | |
dest | vector<T> where the result will be left. |
Reimplemented from lti::maximumFilter< T >.
bool lti::localMaxima< T >::apply | ( | const matrix< T > & | src, | |
pointList & | theMaxs | |||
) |
Extract the local maxima from src and leave their position in the given theMaxs point-list.
src | matrix<T> with the source data. | |
theMaxs | list of points where the local maxima are found. It is sorted in decreasing order of the maxima values |
bool lti::localMaxima< T >::apply | ( | const matrix< T > & | src, | |
matrix< T > & | dest, | |||
pointList & | theMaxs | |||
) |
Extract the local maxima from src and leave the result in dest, consisting on the maxima values in their respective positions and in the rest of the image the value indicated in parameters::noMaxValue.
Those positions with local maxima are also stored in the theMaxs list.
operates on a copy of the given parameters.
src | matrix<T> with the source data. | |
dest | matrix<T> where the result will be left. | |
theMaxs | list of points where the local maxima are found. It is sorted in decreasing order of the maxima values |
bool lti::localMaxima< T >::apply | ( | const matrix< T > & | src, | |
matrix< T > & | dest | |||
) |
Extract the local maxima from src and leave the result in dest, consisting on the maxima values in their respective positions and in the rest of the image the value indicated in parameters::noMaxValue.
src | matrix<T> with the source data. | |
dest | matrix<T> where the result will be left. |
Reimplemented from lti::maximumFilter< T >.
bool lti::localMaxima< T >::apply | ( | vector< T > & | srcdest | ) |
Extract the local maxima from srcdest and leave the result there too, consisting on the maxima values in their respective positions and in the rest of the image the value indicated in parameters::noMaxValue.
srcdest | vector<T> with the source data. The result will be left here too. |
Reimplemented from lti::maximumFilter< T >.
bool lti::localMaxima< T >::apply | ( | matrix< T > & | srcdest | ) |
Extract the local maxima from srcdest and leave the result there too, consisting on the maxima values in their respective positions and in the rest of the image the value indicated in parameters::noMaxValue.
srcdest | matrix<T> with the source data. The result will be left here too. |
Reimplemented from lti::maximumFilter< T >.
virtual functor* lti::localMaxima< T >::clone | ( | ) | const [virtual] |
returns a pointer to a clone of this functor.
Reimplemented from lti::maximumFilter< T >.
localMaxima& lti::localMaxima< T >::copy | ( | const localMaxima< T > & | other | ) |
copy data of "other" functor.
other | the functor to be copied |
Reimplemented from lti::maximumFilter< T >.
const parameters& lti::localMaxima< T >::getParameters | ( | ) | const |
returns used parameters
Reimplemented from lti::maximumFilter< T >.
virtual const char* lti::localMaxima< T >::getTypeName | ( | ) | const [virtual] |
returns the name of this type ("localMaxima")
Reimplemented from lti::maximumFilter< T >.
T lti::localMaxima< T >::getValue | ( | const T | srcVal | ) | const [inline, protected] |
this function evaluates if the given srcVal can be a local maximum depending on the content of the buffer array (in the parent class).
bool lti::localMaxima< T >::hystheresisSuppression | ( | const matrix< T > & | src, | |
matrix< T > & | localMax, | |||
pointList & | maxList | |||
) | const [protected] |
Suppression with hystheresis.
Given all local maxima in localMax, this method sorts them and beginning with the smallest ones, it starts a region search through all pixels with a value greater than the local maximum being evaluated multiplied with the parameter hystheresisThreshold. All other local maxima found in the region will be absorved if they are smaller, or they eliminate the actual local maximum if they are greater.
src | the source image | |
localMax | local maxima found. It may contain at the end of the algorithm less maxima as in the beginning. Also the minimumT value will be replaced by suppressValue. | |
maxList | list of local maxima sorted in descending order. |
localMaxima& lti::localMaxima< T >::operator= | ( | const localMaxima< T > & | other | ) |
virtual bool lti::localMaxima< T >::updateParameters | ( | ) | [virtual] |
set functor's parameters.
This member makes a copy of theParam: the functor will keep its own copy of the parameters!
Reimplemented from lti::maximumFilter< T >.
const T lti::localMaxima< T >::minimumT [static, protected] |
minimumT is the smallest number that type T can describe
T lti::localMaxima< T >::suppressValue [protected] |
value used to indicate a "suppressed" value (usually 0)