Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
alvar::Optimization Class Reference

Non-linear optimization routines. There are three methods implemented that include Gauss-Newton, Levenberg-Marquardt and Tukey m-estimator. More...

#include <Optimization.h>

Public Types

typedef void(* EstimateCallback) (CvMat *state, CvMat *projection, void *param)
 Pointer to the function that projects the state of the system to the measurements. More...
 
enum  OptimizeMethod { GAUSSNEWTON, LEVENBERGMARQUARDT, TUKEY_LM }
 Selection between the algorithm used in optimization. Following should be noticed: More...
 

Public Member Functions

void CalcJacobian (CvMat *x, CvMat *J, EstimateCallback Estimate)
 Numerically differentiates and calculates the Jacobian around x. More...
 
CvMat * GetErr ()
 Returns the current residual vector. More...
 
 Optimization (int n_params, int n_meas)
 Constructor. More...
 
double Optimize (CvMat *parameters, CvMat *measurements, double stop, int max_iter, EstimateCallback Estimate, void *param=0, OptimizeMethod method=LEVENBERGMARQUARDT, CvMat *parameters_mask=0, CvMat *J_mat=0, CvMat *weights=0)
 Runs the optimization loop with selected parameters. More...
 
 ~Optimization ()
 

Private Member Functions

double CalcTukeyWeight (double residual, double c)
 
double CalcTukeyWeightSimple (double residual, double c)
 

Private Attributes

CvMat * delta
 
CvMat * diag
 
CvMat * err
 
void * estimate_param
 
CvMat * J
 
CvMat * JtJ
 
double lambda
 
CvMat * tmp
 
CvMat * tmp_par
 
CvMat * W
 
CvMat * x_minus
 
CvMat * x_plus
 
CvMat * x_tmp1
 
CvMat * x_tmp2
 

Detailed Description

Non-linear optimization routines. There are three methods implemented that include Gauss-Newton, Levenberg-Marquardt and Tukey m-estimator.

Examples:
SampleOptimization.cpp.

Definition at line 44 of file Optimization.h.

Member Typedef Documentation

typedef void(* alvar::Optimization::EstimateCallback) (CvMat *state, CvMat *projection, void *param)

Pointer to the function that projects the state of the system to the measurements.

Parameters
stateSystem parameters, e.g. camera parameterization in optical tracking.
projectionThe system state projection is stored here. E.g image measurements in optical tracking.
paramAdditional parameters to the function. E.g. some constant parameters that are not optimized.

Definition at line 101 of file Optimization.h.

Member Enumeration Documentation

Selection between the algorithm used in optimization. Following should be noticed:

  • GAUSSNEWTON
Enumerator
GAUSSNEWTON 
LEVENBERGMARQUARDT 
TUKEY_LM 

Definition at line 74 of file Optimization.h.

Constructor & Destructor Documentation

alvar::Optimization::Optimization ( int  n_params,
int  n_meas 
)

Constructor.

Parameters
n_paramsNumber of parameters to be optimized.
n_measNumber of measurements that are observed.

Definition at line 34 of file Optimization.cpp.

alvar::Optimization::~Optimization ( )

Definition at line 51 of file Optimization.cpp.

Member Function Documentation

void alvar::Optimization::CalcJacobian ( CvMat *  x,
CvMat *  J,
EstimateCallback  Estimate 
)

Numerically differentiates and calculates the Jacobian around x.

Parameters
xThe set of parameters around which the Jacobian is evaluated.
JResulting Jacobian matrix is stored here.
EstimateThe function to be differentiated.

Definition at line 99 of file Optimization.cpp.

double alvar::Optimization::CalcTukeyWeight ( double  residual,
double  c 
)
private

Definition at line 68 of file Optimization.cpp.

double alvar::Optimization::CalcTukeyWeightSimple ( double  residual,
double  c 
)
private

Definition at line 89 of file Optimization.cpp.

CvMat* alvar::Optimization::GetErr ( )
inline

Returns the current residual vector.

Returns
Pointer to the residual vector.

Definition at line 93 of file Optimization.h.

double alvar::Optimization::Optimize ( CvMat *  parameters,
CvMat *  measurements,
double  stop,
int  max_iter,
EstimateCallback  Estimate,
void *  param = 0,
OptimizeMethod  method = LEVENBERGMARQUARDT,
CvMat *  parameters_mask = 0,
CvMat *  J_mat = 0,
CvMat *  weights = 0 
)

Runs the optimization loop with selected parameters.

Parameters
parametersVector of parameters to be optimized. Initial values should be set.
measurementsVector of measurements that are observed.
stopOptimization loop ends as the stop limit is reached. Criteria is calculated as
max_iterMaximum number of iteration loops that are evaluated if stop is not reached.
EstimatePointer to the function that maps the state to the measurements. See EstimateCallback.
methodOne of the three possible optimization methods.
parameters_maskVector that defines the parameters that are optimized. If vector element is 0, corresponding parameter is not altered.
J_matJacobian matrix. If not given, numerical differentation is used.
weightsWeight vector that can be submitted to give different weights to different measurements. Currently works only with OptimizeMethod::TUKEY_LM.
Examples:
SampleOptimization.cpp.

Definition at line 123 of file Optimization.cpp.

Member Data Documentation

CvMat* alvar::Optimization::delta
private

Definition at line 56 of file Optimization.h.

CvMat* alvar::Optimization::diag
private

Definition at line 53 of file Optimization.h.

CvMat* alvar::Optimization::err
private

Definition at line 55 of file Optimization.h.

void* alvar::Optimization::estimate_param
private

Definition at line 49 of file Optimization.h.

CvMat* alvar::Optimization::J
private

Definition at line 50 of file Optimization.h.

CvMat* alvar::Optimization::JtJ
private

Definition at line 51 of file Optimization.h.

double alvar::Optimization::lambda
private

Definition at line 66 of file Optimization.h.

CvMat* alvar::Optimization::tmp
private

Definition at line 54 of file Optimization.h.

CvMat* alvar::Optimization::tmp_par
private

Definition at line 61 of file Optimization.h.

CvMat* alvar::Optimization::W
private

Definition at line 52 of file Optimization.h.

CvMat* alvar::Optimization::x_minus
private

Definition at line 58 of file Optimization.h.

CvMat* alvar::Optimization::x_plus
private

Definition at line 57 of file Optimization.h.

CvMat* alvar::Optimization::x_tmp1
private

Definition at line 59 of file Optimization.h.

CvMat* alvar::Optimization::x_tmp2
private

Definition at line 60 of file Optimization.h.


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


ar_track_alvar
Author(s): Scott Niekum
autogenerated on Mon Jun 10 2019 12:47:04