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

lti::medianFilter Class Reference

This class implements the median filter. More...

#include <ltiMedianFilter.h>

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

List of all members.

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
medianFiltercopy (const medianFilter &other)
virtual functorclone () const
const parametersgetParameters () 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

Detailed Description

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.


Constructor & Destructor Documentation

lti::medianFilter::medianFilter (  ) 

default constructor

lti::medianFilter::medianFilter ( const parameters par  ) 

default constructor

lti::medianFilter::medianFilter ( const medianFilter other  ) 

copy constructor

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

destructor


Member Function Documentation

bool lti::medianFilter::apply ( const channel8 src,
channel8 dest 
) const [virtual]

operates on a copy of the given parameters.

Parameters:
src channel8 with the source data.
dest channel8 where the result will be left.
Returns:
true if successful, false otherwise.

Reimplemented from lti::modifier.

bool lti::medianFilter::apply ( const channel src,
channel dest 
) const [virtual]

operates on a copy of the given parameters.

Parameters:
src channel with the source data.
dest channel where the result will be left.
Returns:
true if successful, false otherwise.

Reimplemented from lti::modifier.

bool lti::medianFilter::apply ( channel8 srcdest  )  const [virtual]

operates on the given parameter.

Parameters:
srcdest channel8 with the source data. The result will be left here too.
Returns:
true if successful, false otherwise.

Reimplemented from lti::modifier.

bool lti::medianFilter::apply ( channel srcdest  )  const [virtual]

operates on the given parameter.

Parameters:
srcdest channel with the source data. The result will be left here too.
Returns:
true if successful, false otherwise.

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.

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

Reimplemented from lti::functor.

const parameters& lti::medianFilter::getParameters (  )  const

returns used parameters

Reimplemented from lti::modifier.

Referenced by realMedian().

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

returns the name of this type ("medianFilter")

Reimplemented from lti::modifier.

bool lti::medianFilter::histogramMethod ( const channel8 src,
channel8 dest 
) const [protected]

the histogramMethod apply the median filter to a matrix of type channel8.In difference with the function realMedian, histogramMethod use a histogram,which avoid to sort each time the kernel

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

template<class T >
bool lti::medianFilter::realMedian ( const matrix< T > &  src,
matrix< T > &  dest 
) const [inline, protected]
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);

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

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