latest version v1.9 - last update 10 Apr 2010 |
Implementation of an part of the paper 'Pfinder: Real-Time Tracking of the Human Body' from Wren, Azarbayejani, Darrell and Pentland published in IEEE PAMI July 1997, vol 19, no 7, pp. More...
#include <ltiBackgroundModel.h>
Classes | |
class | parameters |
the parameters for the class backgroundModel More... | |
Public Member Functions | |
backgroundModel () | |
backgroundModel (const backgroundModel &other) | |
virtual | ~backgroundModel () |
virtual const char * | getTypeName () const |
bool | apply (const image &src, channel &dest) |
bool | apply (const image &src, channel8 &dest) |
bool | addBackground (const image &src) |
bool | adaptBackground (const image &src, const channel8 &mask) |
bool | getModel (image &model) |
bool | clearMoldel () |
backgroundModel & | copy (const backgroundModel &other) |
backgroundModel & | operator= (const backgroundModel &other) |
virtual functor * | clone () const |
const parameters & | getParameters () const |
virtual bool | updateParameters () |
virtual bool | write (ioHandler &handler, const bool complete=true) const |
virtual bool | read (ioHandler &handler, const bool complete=true) |
Protected Attributes | |
std::vector< std::vector < serialVectorStats< float > > > | bgStat |
Implementation of an part of the paper 'Pfinder: Real-Time Tracking of the Human Body' from Wren, Azarbayejani, Darrell and Pentland published in IEEE PAMI July 1997, vol 19, no 7, pp.
780-785. This functor can separate things in front of a background. The background model is generate of same images displaying only the background. With this model you can than separate objects witch belong not to the background. The model is a statistic representation of every pixel in the scene. And the foreground objects are alle colored faces witch do not fit to the statistic model. The rule wether a pixel fit ore not is the malanowis distance, a distance between a vector(r,g,b) to the mean vector. Furthermore you can adapt the model with the images displaying back and foreground. The claas adapt, if you want, all pixels with the malanowis smaler as a threshold. The normal way of operation is: addd with the 'addBackgrund' function same images, with only background, to the model, than use the apply function with an image with fore and background and you get in the channel8 the malanowis of each pixel to the background. You can set the outputTreshold parameter for displying only foreground objects (try 500). If you set the flag binaryOutput you get the background black an the foreground white.
lti::backgroundModel::backgroundModel | ( | ) |
default constructor
lti::backgroundModel::backgroundModel | ( | const backgroundModel & | other | ) |
copy constructor
other | the object to be copied |
virtual lti::backgroundModel::~backgroundModel | ( | ) | [virtual] |
destructor
bool lti::backgroundModel::addBackground | ( | const image & | src | ) |
The function calculates the malanowis distance of each pixel in the image to the same pixel in the model.
The outpout channel is filled with the rules in the parameters. If adaptModel is set true the backgroundmoldel is updated with the background of the image 'src'. Every pixel with a distance smaler than 'adaptaionThreshold' is background of the image.
bool lti::backgroundModel::clearMoldel | ( | ) |
This function emptys the model saved in the class.
After calling this funktion you have to add backgroundimages before you can call the apply function
virtual functor* lti::backgroundModel::clone | ( | ) | const [virtual] |
returns a pointer to a clone of this functor.
Reimplemented from lti::segmentation.
backgroundModel& lti::backgroundModel::copy | ( | const backgroundModel & | other | ) |
copy data of "other" functor.
other | the functor to be copied |
Reimplemented from lti::segmentation.
bool lti::backgroundModel::getModel | ( | image & | model | ) |
const parameters& lti::backgroundModel::getParameters | ( | ) | const |
returns used parameters
Reimplemented from lti::functor.
virtual const char* lti::backgroundModel::getTypeName | ( | ) | const [virtual] |
returns the name of this type ("backgroundModel")
Reimplemented from lti::segmentation.
backgroundModel& lti::backgroundModel::operator= | ( | const backgroundModel & | other | ) |
virtual bool lti::backgroundModel::read | ( | ioHandler & | handler, | |
const bool | complete = true | |||
) | [virtual] |
read the parameters from the given ioHandler.
The default implementation is to read just the parameters object.
handler | the ioHandler to be used | |
complete | if true (the default) the enclosing begin/end will be also written, otherwise only the data block will be written. |
Reimplemented from lti::functor.
virtual bool lti::backgroundModel::updateParameters | ( | ) | [virtual] |
Update functor's parameters.
Initialize internal data according to the parameters
Reimplemented from lti::functor.
virtual bool lti::backgroundModel::write | ( | ioHandler & | handler, | |
const bool | complete = true | |||
) | const [virtual] |
write the functor in the given ioHandler.
The default implementation is to write just the parameters object.
handler | the ioHandler to be used | |
complete | if true (the default) the enclosing begin/end will be also written, otherwise only the data block will be written. |
Reimplemented from lti::functor.
std::vector< std::vector< serialVectorStats<float> > > lti::backgroundModel::bgStat [protected] |