latest version v1.9 - last update 10 Apr 2010 |
With this tracking algorithm it is possible to track the movement of an object together with scaling and rotation in the image plane. More...
#include <ltiLinearRegressionTracking.h>
Classes | |
class | parameters |
the parameters for the class linearRegressionTracking More... | |
Public Member Functions | |
linearRegressionTracking () | |
linearRegressionTracking (const parameters &par) | |
linearRegressionTracking (const linearRegressionTracking &other) | |
virtual | ~linearRegressionTracking () |
virtual const char * | getTypeName () const |
bool | learnDisplacement (channel &referenceImage, rectangle imageSection) |
bool | learnDisplacementRGB (image &referenceImage, rectangle imageSection) |
void | getDisplacement (channel &theImage, int xpos, int ypos, double &dx, double &dy) const |
void | getDisplacementRGB (image &theImage, int xpos, int ypos, double &dx, double &dy) const |
bool | learnTracking (channel &referenceImage, rectangle imageSection) |
bool | learnTrackingRGB (image &referenceImage, rectangle imageSection) |
void | getDispRotScale (channel &theImage, double xpos, double ypos, double alpha, double scale, double &dx, double &dy, double &dAlpha, double &dScale) const |
void | getDispRotScaleRGB (image &theImage, double xpos, double ypos, double alpha, double scale, double &dx, double &dy, double &dAlpha, double &dScale) const |
linearRegressionTracking & | copy (const linearRegressionTracking &other) |
linearRegressionTracking & | operator= (const linearRegressionTracking &other) |
virtual functor * | clone () const |
const parameters & | getParameters () const |
virtual bool | read (ioHandler &handler, const bool complete=true) |
virtual bool | write (ioHandler &handler, const bool complete=true) const |
void | getReferenceSection (vector< double > &referenceSection, int &w, int &h) const |
void | setReferenceSection (vector< double > &referenceSection, int w, int h) |
Protected Attributes | |
vector< double > | referenceValues |
int | width |
With this tracking algorithm it is possible to track the movement of an object together with scaling and rotation in the image plane.
It uses the difference between the reference image of the object and the image values at the current position to estimate the correction of the geometrical parameters. This relation is calculated in a training phase using linear regression. To achieve stable tracking results, the image values in the background should be similar to those in the training image. It is also required that the movement of the object between subsequent frames is not too big, there should be still an overlap of the object areas at the two positions.
lti::linearRegressionTracking::linearRegressionTracking | ( | ) |
default constructor
lti::linearRegressionTracking::linearRegressionTracking | ( | const parameters & | par | ) |
Construct a functor using the given parameters.
lti::linearRegressionTracking::linearRegressionTracking | ( | const linearRegressionTracking & | other | ) |
copy constructor
other | the object to be copied |
virtual lti::linearRegressionTracking::~linearRegressionTracking | ( | ) | [virtual] |
destructor
virtual functor* lti::linearRegressionTracking::clone | ( | ) | const [virtual] |
returns a pointer to a clone of this functor.
Reimplemented from lti::linearRegression< double >.
linearRegressionTracking& lti::linearRegressionTracking::copy | ( | const linearRegressionTracking & | other | ) |
copy data of "other" functor.
other | the functor to be copied |
Reimplemented from lti::functor.
void lti::linearRegressionTracking::getDisplacement | ( | channel & | theImage, | |
int | xpos, | |||
int | ypos, | |||
double & | dx, | |||
double & | dy | |||
) | const |
void lti::linearRegressionTracking::getDisplacementRGB | ( | image & | theImage, | |
int | xpos, | |||
int | ypos, | |||
double & | dx, | |||
double & | dy | |||
) | const |
estimates the object displacement from the difference of current and reference RGB values
void lti::linearRegressionTracking::getDispRotScale | ( | channel & | theImage, | |
double | xpos, | |||
double | ypos, | |||
double | alpha, | |||
double | scale, | |||
double & | dx, | |||
double & | dy, | |||
double & | dAlpha, | |||
double & | dScale | |||
) | const |
estimates the object displacement, scaling and rotation from the difference of current and reference channel values.
Use more than one iteration per frame for best results.
theImage | current frame channel | |
xpos | current x-position of object center | |
ypos | current y-position of object center | |
alpha | current object angle | |
scale | current object scale | |
dx | estimated displacement in x-direction | |
dy | estimated displacement in y-direction | |
dAlpha | estimated angle difference | |
dScale | estimated scale difference |
void lti::linearRegressionTracking::getDispRotScaleRGB | ( | image & | theImage, | |
double | xpos, | |||
double | ypos, | |||
double | alpha, | |||
double | scale, | |||
double & | dx, | |||
double & | dy, | |||
double & | dAlpha, | |||
double & | dScale | |||
) | const |
estimates the object displacement, scaling and rotation from the difference of current and reference RGB values.
Use more than one iteration per frame for best results.
theImage | current frame image | |
xpos | current x-position of object center | |
ypos | current y-position of object center | |
alpha | current object angle | |
scale | current object scale | |
dx | estimated displacement in x-direction | |
dy | estimated displacement in y-direction | |
dAlpha | estimated angle difference | |
dScale | estimated scale difference |
const parameters& lti::linearRegressionTracking::getParameters | ( | ) | const |
returns used parameters
Reimplemented from lti::linearRegression< double >.
void lti::linearRegressionTracking::getReferenceSection | ( | vector< double > & | referenceSection, | |
int & | w, | |||
int & | h | |||
) | const |
virtual const char* lti::linearRegressionTracking::getTypeName | ( | ) | const [virtual] |
returns the name of this type ("linearRegressionTracking")
Reimplemented from lti::linearRegression< double >.
linearRegressionTracking& lti::linearRegressionTracking::operator= | ( | const linearRegressionTracking & | other | ) |
virtual bool lti::linearRegressionTracking::read | ( | ioHandler & | handler, | |
const bool | complete = true | |||
) | [virtual] |
reads this functor from the given handler.
Reimplemented from lti::linearRegression< double >.
void lti::linearRegressionTracking::setReferenceSection | ( | vector< double > & | referenceSection, | |
int | w, | |||
int | h | |||
) |
virtual bool lti::linearRegressionTracking::write | ( | ioHandler & | handler, | |
const bool | complete = true | |||
) | const [virtual] |
writes this functor to the given handler.
Reimplemented from lti::linearRegression< double >.
vector<double> lti::linearRegressionTracking::referenceValues [protected] |
int lti::linearRegressionTracking::width [protected] |
width and height of the image region