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

lti::backgroundModel Class Reference

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>

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

List of all members.

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 ()
backgroundModelcopy (const backgroundModel &other)
backgroundModeloperator= (const backgroundModel &other)
virtual functorclone () const
const parametersgetParameters () 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

Detailed Description

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.


Constructor & Destructor Documentation

lti::backgroundModel::backgroundModel (  ) 

default constructor

lti::backgroundModel::backgroundModel ( const backgroundModel other  ) 

copy constructor

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

destructor


Member Function Documentation

bool lti::backgroundModel::adaptBackground ( const image src,
const channel8 mask 
)

With this fuction you can adapt the model by hand.

You can define a mask with the values 0 and not 0. The image and the mask must have the same size. The model is adept with the image at every point where the mask is equal to zero.

bool lti::backgroundModel::addBackground ( const image src  ) 

Adds a image to the backgroud model.

You must call this function serveral times with images displaing the same scene with no foreground objects. The functor creates the initial backgroundmodel based on thus images. It is absolutly reqired that all the images disply the same scene.

bool lti::backgroundModel::apply ( const image src,
channel8 dest 
)

Implements first the apply with channel and cast than the result into a channel8.

Parameters:
src image with the source data.
dest channel with the distance of each pixel
Returns:
true if apply successful or false otherwise.
bool lti::backgroundModel::apply ( const image src,
channel dest 
)

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.

Parameters:
src image with the source data.
dest channel with the distance of each pixel
Returns:
true if apply successful or false otherwise.
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.

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

Reimplemented from lti::segmentation.

bool lti::backgroundModel::getModel ( image model  ) 

This function returns an image of the background model.

The image consist of the mean color values of each pixel.

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  ) 

alias for copy member

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

Reimplemented from lti::functor.

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.

Parameters:
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.
Returns:
true if write was successful

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.

Parameters:
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.
Returns:
true if write was successful

Reimplemented from lti::functor.


Member Data Documentation

std::vector< std::vector< serialVectorStats<float> > > lti::backgroundModel::bgStat [protected]

For each point of the image a statistic functor.

This functor creates the variance and the mean value of alle pixels in the images added to the model.


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

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