latest version v1.9 - last update 10 Apr 2010 |
This class implements the median filter. More...
#include <ltiMedianFilter.h>
Classes | |
class | parameters |
the parameters for the class medianFilter More... | |
Public Member Functions | |
medianFilter () | |
medianFilter (const parameters &par) | |
medianFilter (const medianFilter &other) | |
virtual | ~medianFilter () |
virtual const char * | getTypeName () const |
bool | apply (channel &srcdest) const |
bool | apply (channel8 &srcdest) const |
bool | apply (const channel &src, channel &dest) const |
bool | apply (const channel8 &src, channel8 &dest) const |
medianFilter & | copy (const medianFilter &other) |
virtual functor * | clone () const |
const parameters & | getParameters () const |
void | setKernelSize (const int &newKernelSize) |
Protected Member Functions | |
void | histogramMethodMiddle (const channel8 &src, channel8 &dest, ivector &histogram, int &lessThanMedian, const int &row, int &col, ubyte &median, const int &sizeOfKernel) const |
bool | histogramMethodZero (const channel8 &src, channel8 &dest, const int &sizeOfKernel) const |
bool | histogramMethodConstant (const channel8 &src, channel8 &dest, const int &sizeOfKernel) const |
bool | histogramMethodPeriodic (const channel8 &src, channel8 &dest, const int &sizeOfKernel) const |
bool | histogramMethodMirror (const channel8 &src, channel8 &dest, const int &sizeOfKernel) const |
bool | histogramMethodNoBoundary (const channel8 &src, channel8 &dest, const int &sizeOfKernel) const |
bool | histogramMethod (const channel8 &src, channel8 &dest) const |
template<class T > | |
bool | realMedian (const matrix< T > &src, matrix< T > &dest) const |
This class implements the median filter.
The median filter is a non-linear filter. It takes the median value (see lti::quickMedian) of a n*n kernel.
The algorithm used for lti::channel uses the straightforward method, and is not as fast as the histogram-based method used for lti::channel8.
lti::medianFilter::medianFilter | ( | ) |
default constructor
lti::medianFilter::medianFilter | ( | const parameters & | par | ) |
default constructor
lti::medianFilter::medianFilter | ( | const medianFilter & | other | ) |
copy constructor
other | the object to be copied |
virtual lti::medianFilter::~medianFilter | ( | ) | [virtual] |
destructor
operates on a copy of the given parameters.
Reimplemented from lti::modifier.
operates on a copy of the given parameters.
Reimplemented from lti::modifier.
bool lti::medianFilter::apply | ( | channel8 & | srcdest | ) | const [virtual] |
operates on the given parameter.
srcdest | channel8 with the source data. The result will be left here too. |
Reimplemented from lti::modifier.
bool lti::medianFilter::apply | ( | channel & | srcdest | ) | const [virtual] |
operates on the given parameter.
srcdest | channel with the source data. The result will be left here too. |
Reimplemented from lti::modifier.
virtual functor* lti::medianFilter::clone | ( | ) | const [virtual] |
returns a pointer to a clone of this functor.
Implements lti::functor.
medianFilter& lti::medianFilter::copy | ( | const medianFilter & | other | ) |
copy data of "other" functor.
other | the functor to be copied |
Reimplemented from lti::functor.
const parameters& lti::medianFilter::getParameters | ( | ) | const |
virtual const char* lti::medianFilter::getTypeName | ( | ) | const [virtual] |
returns the name of this type ("medianFilter")
Reimplemented from lti::modifier.
bool lti::medianFilter::histogramMethodConstant | ( | const channel8 & | src, | |
channel8 & | dest, | |||
const int & | sizeOfKernel | |||
) | const [protected] |
applies the histogramMethod for the type boundary Constant
void lti::medianFilter::histogramMethodMiddle | ( | const channel8 & | src, | |
channel8 & | dest, | |||
ivector & | histogram, | |||
int & | lessThanMedian, | |||
const int & | row, | |||
int & | col, | |||
ubyte & | median, | |||
const int & | sizeOfKernel | |||
) | const [protected] |
runs inside the image src
bool lti::medianFilter::histogramMethodMirror | ( | const channel8 & | src, | |
channel8 & | dest, | |||
const int & | sizeOfKernel | |||
) | const [protected] |
applies the histogramMethod for the type boundary Mirror
bool lti::medianFilter::histogramMethodNoBoundary | ( | const channel8 & | src, | |
channel8 & | dest, | |||
const int & | sizeOfKernel | |||
) | const [protected] |
applies the histogramMethod for the type boundary NoBoundary
bool lti::medianFilter::histogramMethodPeriodic | ( | const channel8 & | src, | |
channel8 & | dest, | |||
const int & | sizeOfKernel | |||
) | const [protected] |
applies the histogramMethod for the type boundary Periodic
bool lti::medianFilter::histogramMethodZero | ( | const channel8 & | src, | |
channel8 & | dest, | |||
const int & | sizeOfKernel | |||
) | const [protected] |
applies the histogramMethod for the type boundary Zero
bool lti::medianFilter::realMedian | ( | const matrix< T > & | src, | |
matrix< T > & | dest | |||
) | const [inline, protected] |
realMedian is a template function which apply the median filter to a matrix of type T.
The median filter does not depend on the type of the elements of a matrix. The implementation must be here due to a bug of the MSVC++
References lti::quickMedian< T >::apply(), lti::genericMatrix< T >::at(), lti::genericVector< T >::at(), lti::genericMatrix< T >::clear(), lti::genericMatrix< T >::columns(), lti::Constant, lti::matrix< T >::copy(), lti::genericMatrix< T >::empty(), lti::genericVector< T >::fill(), getParameters(), lti::genericMatrix< T >::lastColumn(), lti::genericMatrix< T >::lastRow(), lti::Mirror, lti::Periodic, lti::genericMatrix< T >::resize(), lti::genericMatrix< T >::rows(), and lti::Zero.
void lti::medianFilter::setKernelSize | ( | const int & | newKernelSize | ) |
shortcut for resizing the kernel.
Following code using the shortcut
medianFilter theMedFilter; theMedFilter.setKernelSize(5);
is equivalent to
medianFilter theMedFilter; medianFilter::parameters param(theMedFilter.getParameters); param.kernelSize = 5; theMedFilter.setParameters(param);