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) |
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.
|
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 .
|
|
Defines implemented robust functions that can be used to compute the weights .
|
|
Constructs a robust multiresolution estimator by implementing the iterative reweighted least squares (IRLS) technique. |
|
Destructs the multiresolution estimator, deleting all allocated memory. |
|
If compute is true, computes the covariance matrix of the estimated 2D polynomial motion model parameters.
|
|
If compute is set as true, the residual variance of the estimated 2D polynomial motion model parameters is computed.
|
|
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[.
|
|
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.
|
|
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.
|
|
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.
|
|
Get the address of the DFD map for the level given as argument. Updates the dimension of the map. |
|
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.
|
|
Returns the pyramid level where the estimation process is stopped.
|
|
Returns the variance of the residual values.
|
|
Returns the normalized size of the estimated weight map. If the method returns true, the normalized support size is computed.
|
|
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().
|
|
Indicates if the covariance matrix of the estimated 2D motion model parameters is computed.
|
|
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.
|
|
Indicates if the normalized support size is computed.
|
|
Sets the constant used to reject outliers when a robust M-estimator is used.
|
|
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.
|
|
Sets the pyramid level where the estimation process is stopped, with Returns false if the requested level is not authorized, true otherwise.
|
|
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. |
|
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.
|
|
Sets the maximal number of iterations of IRLS performed at a given pyramid level l to estimate .
|
|
Sets the support percentage (rate) for which the estimation is considered as reliable. It must be comprised between 0.f and 1.f. |
|
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.
|
|
Defines the robust function used in the weighted least-squares resolution (IRLS). ERobustFunction() gives the list of implemented functions.
|