latest version v1.9 - last update 10 Apr 2010 |
The csPresegmentation functor (states for color space presegmentation) tries to detect which pixels belong to the background and which not. More...
#include <ltiCsPresegmentation.h>
Classes | |
class | parameters |
the parameters for the class csPresegmentation More... | |
Public Member Functions | |
csPresegmentation () | |
csPresegmentation (const csPresegmentation &other) | |
virtual | ~csPresegmentation () |
virtual const char * | getTypeName () const |
bool | apply (const image &src, channel8 &mask) |
csPresegmentation & | copy (const csPresegmentation &other) |
csPresegmentation & | operator= (const csPresegmentation &other) |
virtual functor * | clone () const |
const parameters & | getParameters () const |
Protected Member Functions | |
bool | validBackground (const rgbPixel &p, const trgbPixel< float > &mean, const trgbPixel< float > &var, const float &tolerance) const |
Protected Attributes | |
palette | lastPalette |
The csPresegmentation functor (states for color space presegmentation) tries to detect which pixels belong to the background and which not.
For its task there are some assumtions/requirements:
These conditions are not met in many applications, for which other segmentation approaches have to be found.
The algorithm works as follows:
First, a color quantization using k-Means is done. This produces usually a "noisy" index mask and a palette. A median filter or a k-Nearest-Neighbor Filter smooths this mask. Assuming that the border of the image contains mostly background pixels, some simple statistics are done, to decide which palette entries belong to the background. Pixels belonging to other palette entries are taken as the object pixels.
See the lti::csPresegmentation::parameters for more information.
lti::csPresegmentation::csPresegmentation | ( | ) |
default constructor
lti::csPresegmentation::csPresegmentation | ( | const csPresegmentation & | other | ) |
copy constructor
other | the object to be copied |
virtual lti::csPresegmentation::~csPresegmentation | ( | ) | [virtual] |
destructor
apply the presegmentation algorithm to the given image and return a mask where the background pixels will be mark with the value zero and the non-background pixels with a non-zero value.
Note that some information of this segmentation is "stored" in the internal state, which affects the next segmentation steps. (see lti::csPresegmentation::parameters::useAlwaysNewPalette)
src | image with the source data. | |
mask | the mask with the found objects. |
virtual functor* lti::csPresegmentation::clone | ( | ) | const [virtual] |
returns a pointer to a clone of this functor.
Reimplemented from lti::segmentation.
csPresegmentation& lti::csPresegmentation::copy | ( | const csPresegmentation & | other | ) |
copy data of "other" functor.
other | the functor to be copied |
Reimplemented from lti::segmentation.
const parameters& lti::csPresegmentation::getParameters | ( | ) | const |
returns used parameters
Reimplemented from lti::functor.
virtual const char* lti::csPresegmentation::getTypeName | ( | ) | const [virtual] |
returns the name of this type ("csPresegmentation")
Reimplemented from lti::segmentation.
csPresegmentation& lti::csPresegmentation::operator= | ( | const csPresegmentation & | other | ) |
bool lti::csPresegmentation::validBackground | ( | const rgbPixel & | p, | |
const trgbPixel< float > & | mean, | |||
const trgbPixel< float > & | var, | |||
const float & | tolerance | |||
) | const [inline, protected] |
valid background returns true if the given pixel lies between the mean value and the given variance.
palette lti::csPresegmentation::lastPalette [protected] |
last used palette