Vista     Main Page   Class List   Function List   File List   Examples  


CMotion2DEstimator Class Reference

The CMotion2DEstimator class implements the robust multiresolution estimation of the parametric motion model. More...

List of all members.

Public Types

enum  ERobustFunction { Tukey, Talwar, Cauchy, Welsh }
enum  ECConstType { CConst_Fixed, CConst_Classic, CConst_Robust }

Public Methods

 CMotion2DEstimator ()
 ~CMotion2DEstimator ()
bool estimate (const CMotion2DPyramid &pyramid1, const CMotion2DPyramid &pyramid2, const short *support, short label, CMotion2DModel &model, bool useModelAsInitialization=false)
bool estimate (const CMotion2DPyramid &pyramid1, const CMotion2DPyramid &pyramid2, const unsigned char *support, unsigned char label, CMotion2DModel &model, bool useModelAsInitialization=false)
float * getWeights (int &n_rows, int &n_cols)
void setRobustEstimator (bool robust=true)
void setRobustFunction (ERobustFunction function=Tukey)
void setCConstant (ECConstType C_type=CConst_Fixed, double C=8.0)
void setNIterationMaxIRLS (int niter=8)
void setNIterationMaxLevel (int niter=7)
void setLevelParameterIntroduction (int level_const=-1, int level_affine=-1, int level_quadratic=-1)
bool setFirstEstimationLevel (unsigned level=3)
unsigned getFirstEstimationLevel ()
bool setLastEstimationLevel (unsigned level=0)
unsigned getLastEstimationLevel ()
void setReliableSupportRate (float rate=0.4)
void computeSupportSize (bool compute=true, float threshold=0.2f)
bool isSupportSizeComputed ()
bool getSupportSize (double &size)
void computeResidualVariance (bool compute=false)
bool isResidualVarianceComputed ()
double getResidualVariance ()
void computeCovarianceMatrix (bool compute=false)
bool isCovarianceMatrixComputed ()
double * getCovarianceMatrix (int &n_rows, int &n_cols)
float * getDFDDataAddress (int level, int &n_rows, int &n_cols)


Detailed Description

The CMotion2DEstimator class implements the robust multiresolution estimation of the parametric motion model.

We consider the displaced frame difference corresponding to the motion model:

where and are two successive images, the motion model to estimate (including a global intensity shift to account for global illumination change) and

denotes the flow vector modeled at the image point .

To ensure the goal of robustness, we introduce a M-estimation criterion with a hard-redescending robust estimator. Thus, the motion model is given by:

where is the Tukey, Talwar, Cauchy or Welsh biweight function which is bounded for high values of and a scale parameter to be set.

The estimation support usually consists of the whole image. If required, it can also be restricted to a specific area of the image. The minimization is embedded in a multiresolution and incremental scheme based on the Gauss-Newton method. At each incremental step (at a given resolution level, or from a resolution level to a finer one), we have:

where is the current estimate of the parameter vector . A linearization of around is performed, leading to the expression linear with respect to :

where denotes the spatial gradient of the intensity function at location and at time . Then, we substitute for the minimization of the minimization of the expression given by:

which is equivalent to minimizing:

with

where is the derivative of the function. The error function is minimized using an Iterative-Reweighted-Least-Squares procedure, with 0 as an initial value for . For more details about the method and its performances, see the Motion-2D related references.

Examples:

Motion2D.cpp.


Member Enumeration Documentation

enum CMotion2DEstimator::ECConstType
 

Describes the way in which the constant evolves between two successive estimations.

At the beginning of the process, the estimator must be rather tolerant to outliers; thus, is set to a large value (typically equal to the largest absolute temporal intensity difference). Then, as the accuracy of the dominant motion estimate improves, outliers are better identified and should be rejected. Therefore, is lowered at each computation of a new increment , using the following schedule: until it reaches a preset value , or a robustly estimated value .

See also:
setCConstant(), ERobustFunction
Enumeration values:
CConst_Fixed  The constant does not change between two estimations of .
CConst_Classic  The constant is lowered at each computation of a new increment according to the formula .
CConst_Robust  The constant is robustly estimated.

enum CMotion2DEstimator::ERobustFunction
 

Defines implemented robust functions that can be used to compute the weights .

See also:
setRobustFunction(), ECConstType
Enumeration values:
Tukey  Tukey biweight function: if otherwise
Talwar  Talwar biweight function: if otherwise
Cauchy  Cauchy function:
Welsh  Welsh function:


Constructor & Destructor Documentation

CMotion2DEstimator::CMotion2DEstimator  
 

Constructs a robust multiresolution estimator by implementing the iterative reweighted least squares (IRLS) technique.

CMotion2DEstimator::~CMotion2DEstimator  
 

Destructs the multiresolution estimator, deleting all allocated memory.


Member Function Documentation

void CMotion2DEstimator::computeCovarianceMatrix bool    compute = false [inline]
 

If compute is true, computes the covariance matrix of the estimated 2D polynomial motion model parameters.

See also:
isCovarianceMatrixComputed(), getCovarianceMatrix()
Examples:
Motion2D.cpp.

void CMotion2DEstimator::computeResidualVariance bool    compute = false [inline]
 

If compute is set as true, the residual variance of the estimated 2D polynomial motion model parameters is computed.

See also:
isResidualVarianceComputed()

void CMotion2DEstimator::computeSupportSize bool    compute = true,
float    threshold = 0.2f
[inline]
 

If compute is set as true, the normalized support size evaluated from the weights is computed. If the weight associated to a given pixel is greater than threshold, this pixel is considered as conform to the dominant motion. The support size corresponds to the ratio between the number of pixels conform to the estimated dominant motion and the size of the part of that is likely to overlap .

The threshold value must belong to [0; 1[.

See also:
getSupportSize(), isSupportSizeComputed(), getWeights()

bool CMotion2DEstimator::estimate const CMotion2DPyramid   pyramid1,
const CMotion2DPyramid   pyramid2,
const unsigned char *    support,
unsigned char    label,
CMotion2DModel   model,
bool    useModelAsInitialization = false
 

Implements the estimation of a 2D parametric motion model.

This method differs from estimate(const CMotion2DPyramid &, const CMotion2DPyramid &, const short *, short, CMotion2DModel &) only in the type of the estimation support which is here unsigned char.

Return true if the estimation process succeeds, false otherwise.

See also:
estimate(const CMotion2DPyramid &, const CMotion2DPyramid &, const short *, short, CMotion2DModel &)

bool CMotion2DEstimator::estimate const CMotion2DPyramid   pyramid1,
const CMotion2DPyramid   pyramid2,
const short *    support,
short    label,
CMotion2DModel   model,
bool    useModelAsInitialization = false
 

Implements the estimation of a 2D parametric motion model.

Depending on setRobustEstimator() two different schemes can be used: either involving a robust multiresolution estimation implementing the IRLS technique, or involving a multiresolution least-mean-square estimation.

The estimation process is performed between images and for which the Gaussian and image gradient pyramids, denoted respectively pyramid1 and pyramid2, must be built using CMotion2DPyramid.

The parameter support refers to the estimation support . In other terms, support indicates which pixels of the image are taken into account in the estimation process. The size of support must be equal to the size of the finest level in the pyramids (pyramid1 or pyramid2). It usually consists of the whole image. In that case, all support must be set to label. But, if required, it can also be restricted to a specific area of the image. In that case, all the pixels belonging to this area must be set to label. The other pixels must be set to another value than label.

An initialization of the motion model parameters does not affect the results. That means that the parameters of the motion model given as input are not used to initialize the estimator.

This function returns the estimated 2D parametric motion model in model. The returned parameters have to be considered for the highest resolution in the pyramids (level = 0) even if the last level considered in the estimation process is different when specified for example with setLastEstimationLevel(1). If the estimation process is stopped at a pyramid level different from 0, a projection of the motion model parameter to level 0 is performed. For the projection from one given level to the next finer one, the constant parameters of the model are multiplied by 2, the affine parameters are unchanged and the quadratic parameters are divided by 2.

The weight map can be obtained by getWeights().

Returns true if the estimation process succeeds, false otherwise.

See also:
estimate(const CMotion2DPyramid &, const CMotion2DPyramid &, const unsigned char *, unsigned char, CMotion2DModel &), setRobustEstimator(), setFirstEstimationLevel(), setLastEstimationLevel(), getWeights(),
Examples:
Motion2D.cpp.

double* CMotion2DEstimator::getCovarianceMatrix int &    n_rows,
int &    n_cols
[inline]
 

Updates the address of the covariance matrix containing the covariance terms of the estimated parameters. The covariance matrix is bidimentional, with MAXCOEFSMODEL rows and MAXCOEFSMODEL colomns. If the matrix is not computed, the method returns NULL.

Returns:
true if the covariance matrix is computed, false otherwise.
See also:
computeCovarianceMatrix(), isCovarianceMatrixComputed()
Examples:
Motion2D.cpp.

float * CMotion2DEstimator::getDFDDataAddress int    level,
int &    n_rows,
int &    n_cols
 

Get the address of the DFD map for the level given as argument. Updates the dimension of the map.

unsigned CMotion2DEstimator::getFirstEstimationLevel   [inline]
 

Returns the pyramid level where the estimation process is started. Considerering the pyramids size, this level can be different from the level specified with setFirstEstimationLevel(). The returned value is updated after each call of the estimate() method.

See also:
setFirstEstimationLevel(), setLastEstimationLevel(), getLastEstimationLevel()

unsigned CMotion2DEstimator::getLastEstimationLevel   [inline]
 

Returns the pyramid level where the estimation process is stopped.

See also:
setLastEstimationLevel(), setFirstEstimationLevel(), getFirstEstimationLevel()

double CMotion2DEstimator::getResidualVariance   [inline]
 

Returns the variance of the residual values.

See also:
computeResidualVariance()
Examples:
Motion2D.cpp.

bool CMotion2DEstimator::getSupportSize double &    size [inline]
 

Returns the normalized size of the estimated weight map. If the method returns true, the normalized support size is computed.

See also:
computeSupportSize(), getWeights()
Examples:
Motion2D.cpp.

float * CMotion2DEstimator::getWeights int &    n_rows,
int &    n_cols
 

Returns a pointer to the map containing the weights computed within the robust multiresolution estimation. The dimension of this map depends on the final estimation level considered in the pyramids. The number of rows and columns of the weight map is given respectively by n_rows and n_cols.

The weight values are in [0; 1]. A value close to 1 indicates that the corresponding pixel is conforming to the dominant motion. A value close to 0 indicates that the pixel is considered as an outlier.

This method is to use after a call to estimate().

See also:
estimate()
Examples:
Motion2D.cpp.

bool CMotion2DEstimator::isCovarianceMatrixComputed   [inline]
 

Indicates if the covariance matrix of the estimated 2D motion model parameters is computed.

See also:
computeCovarianceMatrix(), getCovarianceMatrix()
Examples:
Motion2D.cpp.

bool CMotion2DEstimator::isResidualVarianceComputed   [inline]
 

Indicates if the variance of the estimated 2D motion model parameters is computed. In fact, it is the variance of the last estimated parameter increment.

See also:
computeResidualVariance()
Examples:
Motion2D.cpp.

bool CMotion2DEstimator::isSupportSizeComputed   [inline]
 

Indicates if the normalized support size is computed.

See also:
computeSupportSize()

void CMotion2DEstimator::setCConstant ECConstType    C_type = CConst_Fixed,
double    C = 8.0
[inline]
 

Sets the constant used to reject outliers when a robust M-estimator is used.

See also:
ECConstType(), setNIterationMaxIRLS(), setRobustFunction()

bool CMotion2DEstimator::setFirstEstimationLevel unsigned    level = 3 [inline]
 

Defines the pyramid first level where the estimation process is starting, with:

At the coarsest level l, no prior estimation is available. The weights are set to 1 and the mimimization is started using expression (1). A first estimate of is then obtained and successive refinements are performed at the same level considering expression (3) until the incremental estimate is small enough or a given number of iterations fixed by set setNIterationMaxIRLS() is reached. Then, the estimated parameter is projected to the finer level, where the refinement process starts again by minimizing expression (3).

Returns false if the requested level is not authorized, true otherwise.

See also:
getFirstEstimationLevel(), setLastEstimationLevel(), getLastEstimationLevel()
Examples:
Motion2D.cpp.

bool CMotion2DEstimator::setLastEstimationLevel unsigned    level = 0 [inline]
 

Sets the pyramid level where the estimation process is stopped, with

Returns false if the requested level is not authorized, true otherwise.

See also:
setFirstEstimationLevel(), getFirstEstimationLevel(), getLastEstimationLevel()
Examples:
Motion2D.cpp.

void CMotion2DEstimator::setLevelParameterIntroduction int    level_const = -1,
int    level_affine = -1,
int    level_quadratic = -1
[inline]
 

Sets the different pyramid levels where respectively the constant, affine and quadratic parameters of the 2D motion model will be first introduced and estimated.

If a parameter is set to -1, the default level is used.

void CMotion2DEstimator::setNIterationMaxIRLS int    niter = 8 [inline]
 

Sets the maximal number of iterations in the iteratively reweighted least squares (IRLS) method. IRLS first consists in evaluating the residual , and, consequently the weights . Then, a new estimate of is computed using the weighted least-squares technique. The weights are updated, and the process is repeated until convergence, or until the predefined number of iterations niter is reached.

See also:
setRobustEstimator(), setRobustFunction(), setCConstant()

void CMotion2DEstimator::setNIterationMaxLevel int    niter = 7 [inline]
 

Sets the maximal number of iterations of IRLS performed at a given pyramid level l to estimate .

See also:
setNIterationMaxIRLS()

void CMotion2DEstimator::setReliableSupportRate float    rate = 0.4 [inline]
 

Sets the support percentage (rate) for which the estimation is considered as reliable. It must be comprised between 0.f and 1.f.

void CMotion2DEstimator::setRobustEstimator bool    robust = true [inline]
 

If robust is true, a robust estimator is used. Otherwise, a least-mean-square method is considered, where all the weights are set to 1.

See also:
setRobustFunction(), setNIterationMaxIRLS()
Examples:
Motion2D.cpp.

void CMotion2DEstimator::setRobustFunction ERobustFunction    function = Tukey [inline]
 

Defines the robust function used in the weighted least-squares resolution (IRLS). ERobustFunction() gives the list of implemented functions.

See also:
ERobustFunction(), setRobustEstimator(), setNIterationMaxIRLS(), setCConstant()


The documentation for this class was generated from the following files:
Motion2D is Copyright © 1995-2005 by Inria
This documentation was generated on 31 Jan 2005 by Fabien Spindler for Motion2D 1.3.11 using doxygen1.2.18 written by Dimitri van Heesch, © 1997-2005