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

lti::kNearestNeighFilter Class Reference

A smoothness filter for label images (channel8,matrix<int>) which uses the idea of the k-Nearest Neighbour concept. More...

#include <ltiKNearestNeighFilter.h>

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

List of all members.

Classes

class  parameters
 the parameters for the class kNearestNeighFilter More...

Public Member Functions

 kNearestNeighFilter ()
 kNearestNeighFilter (const kNearestNeighFilter &other)
virtual ~kNearestNeighFilter ()
virtual const char * getTypeName () const
bool apply (channel8 &srcdest)
bool apply (const channel8 &src, channel8 &dest)
bool apply (imatrix &srcdest)
bool apply (const imatrix &src, imatrix &dest)
kNearestNeighFiltercopy (const kNearestNeighFilter &other)
kNearestNeighFilteroperator= (const kNearestNeighFilter &other)
virtual functorclone () const
const parametersgetParameters () const

Protected Member Functions

int getMostLabel (const ivector &histogram, const imatrix &src, const int &row, const int &col) const
int getMedian (const ivector &histogram, const int max, const int numOfMax) const
void histogramMethodMiddle (const imatrix &src, imatrix &dest, ivector &histogram, const int &row, int &col) const
bool histogramMethodZero (const imatrix &src, imatrix &dest) const
bool histogramMethodConstant (const imatrix &src, imatrix &dest) const
bool histogramMethodPeriodic (const imatrix &src, imatrix &dest) const
bool histogramMethodMirror (const imatrix &src, imatrix &dest) const
bool histogramMethodNoBoundary (const imatrix &src, imatrix &dest) const

Protected Attributes

int sizeOfKernel
int histoSize

Detailed Description

A smoothness filter for label images (channel8,matrix<int>) which uses the idea of the k-Nearest Neighbour concept.

This means, this filter will assign to the origin position of the kernel mask, the label with the most number of instances within the kernel region. The filter removes disturbance pixels and smooths edges.

In case that more than one label has the "maximal" number of instances within the kernel mask, then the assigned label will

  1. remain unchanged, if the kernel origin contains already one of the most frequent labels.
  2. be the median of all "winner" labels will.

The algorithms uses an optimized histogram actualization method, similar to the one used for the median filter of channel8 (see also Sonka et.al, Image Processing, Analysis, and Machine Vision, 2nd edition, 1998, pp. 74-76


Constructor & Destructor Documentation

lti::kNearestNeighFilter::kNearestNeighFilter (  ) 

default constructor

lti::kNearestNeighFilter::kNearestNeighFilter ( const kNearestNeighFilter other  ) 

copy constructor

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

destructor


Member Function Documentation

bool lti::kNearestNeighFilter::apply ( const imatrix src,
imatrix dest 
)

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 apply successful or false otherwise.
bool lti::kNearestNeighFilter::apply ( imatrix srcdest  ) 

operates on the given parameter.

Parameters:
srcdest channel8 with the source data. The result will be left here too.
Returns:
true if apply successful or false otherwise.
bool lti::kNearestNeighFilter::apply ( const channel8 src,
channel8 dest 
)

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 apply successful or false otherwise.
bool lti::kNearestNeighFilter::apply ( channel8 srcdest  ) 

operates on the given parameter.

Parameters:
srcdest channel8 with the source data. The result will be left here too.
Returns:
true if apply successful or false otherwise.
virtual functor* lti::kNearestNeighFilter::clone (  )  const [virtual]

returns a pointer to a clone of this functor.

Implements lti::functor.

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

copy data of "other" functor.

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

Reimplemented from lti::functor.

int lti::kNearestNeighFilter::getMedian ( const ivector histogram,
const int  max,
const int  numOfMax 
) const [protected]

returns the median of all (max)histogram entries

int lti::kNearestNeighFilter::getMostLabel ( const ivector histogram,
const imatrix src,
const int &  row,
const int &  col 
) const [protected]

return the most avaible label in the given histogram

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

returns used parameters

Reimplemented from lti::modifier.

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

returns the name of this type ("kNearestNeighFilter")

Reimplemented from lti::modifier.

bool lti::kNearestNeighFilter::histogramMethodConstant ( const imatrix src,
imatrix dest 
) const [protected]

applies the histogramMethod for the type boundary Constant

void lti::kNearestNeighFilter::histogramMethodMiddle ( const imatrix src,
imatrix dest,
ivector histogram,
const int &  row,
int &  col 
) const [protected]

runs inside the image src

bool lti::kNearestNeighFilter::histogramMethodMirror ( const imatrix src,
imatrix dest 
) const [protected]

applies the histogramMethod for the type boundary Mirror

bool lti::kNearestNeighFilter::histogramMethodNoBoundary ( const imatrix src,
imatrix dest 
) const [protected]

applies the histogramMethod for the type boundary NoBoundary

bool lti::kNearestNeighFilter::histogramMethodPeriodic ( const imatrix src,
imatrix dest 
) const [protected]

applies the histogramMethod for the type boundary Periodic

bool lti::kNearestNeighFilter::histogramMethodZero ( const imatrix src,
imatrix dest 
) const [protected]

applies the histogramMethod for the type boundary Zero

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

alias for copy member

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

Reimplemented from lti::functor.


Member Data Documentation

size of the histogram (= max.

labelnumber from src-image)

the corrected kernel size (always odd number)


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

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