![]() |
latest version v1.9 - last update 10 Apr 2010 |
![]() |
A smoothness filter for label images (channel8,matrix<int>) which uses the idea of the k-Nearest Neighbour concept. More...
#include <ltiKNearestNeighFilter.h>
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) |
kNearestNeighFilter & | copy (const kNearestNeighFilter &other) |
kNearestNeighFilter & | operator= (const kNearestNeighFilter &other) |
virtual functor * | clone () const |
const parameters & | getParameters () 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 |
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
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
lti::kNearestNeighFilter::kNearestNeighFilter | ( | ) |
default constructor
lti::kNearestNeighFilter::kNearestNeighFilter | ( | const kNearestNeighFilter & | other | ) |
copy constructor
other | the object to be copied |
virtual lti::kNearestNeighFilter::~kNearestNeighFilter | ( | ) | [virtual] |
destructor
bool lti::kNearestNeighFilter::apply | ( | imatrix & | srcdest | ) |
operates on the given parameter.
srcdest | channel8 with the source data. The result will be left here too. |
bool lti::kNearestNeighFilter::apply | ( | channel8 & | srcdest | ) |
operates on the given parameter.
srcdest | channel8 with the source data. The result will be left here too. |
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.
other | the functor to be copied |
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 | ) |
int lti::kNearestNeighFilter::histoSize [protected] |
size of the histogram (= max.
labelnumber from src-image)
int lti::kNearestNeighFilter::sizeOfKernel [protected] |
the corrected kernel size (always odd number)