![]() |
My Project
|
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 | |
| enum | OptimizeMethod { GAUSSNEWTON , LEVENBERGMARQUARDT , TUKEY_LM } |
| Selection between the algorithm used in optimization. Following should be noticed: More... | |
| typedef void(* | EstimateCallback) (cv::Mat &state, cv::Mat &projection, void *param) |
| Pointer to the function that projects the state of the system to the measurements. More... | |
Public Member Functions | |
| Optimization (int n_params, int n_meas) | |
| Constructor. More... | |
| cv::Mat | GetErr () |
| Returns the current residual vector. More... | |
| void | CalcJacobian (cv::Mat &x, cv::Mat &J, EstimateCallback Estimate) |
| Numerically differentiates and calculates the Jacobian around x. More... | |
| double | Optimize (cv::Mat ¶meters, cv::Mat &measurements, double stop, int max_iter, EstimateCallback Estimate, void *param=0, OptimizeMethod method=LEVENBERGMARQUARDT, const cv::Mat ¶meters_mask=cv::Mat(), const cv::Mat &J_mat=cv::Mat(), const cv::Mat &weights=cv::Mat()) |
| Runs the optimization loop with selected parameters. More... | |
Non-linear optimization routines. There are three methods implemented that include Gauss-Newton, Levenberg-Marquardt and Tukey m-estimator.
Definition at line 44 of file Optimization.h.
| typedef void(* EstimateCallback) (cv::Mat &state, cv::Mat &projection, void *param) |
Pointer to the function that projects the state of the system to the measurements.
| state | System parameters, e.g. camera parameterization in optical tracking. |
| projection | The system state projection is stored here. E.g image measurements in optical tracking. |
| param | Additional parameters to the function. E.g. some constant parameters that are not optimized. |
Definition at line 97 of file Optimization.h.
| enum OptimizeMethod |
Selection between the algorithm used in optimization. Following should be noticed:
Definition at line 71 of file Optimization.h.
| Optimization | ( | int | n_params, |
| int | n_meas | ||
| ) |
Constructor.
| n_params | Number of parameters to be optimized. |
| n_meas | Number of measurements that are observed. |
| void CalcJacobian | ( | cv::Mat & | x, |
| cv::Mat & | J, | ||
| EstimateCallback | Estimate | ||
| ) |
Numerically differentiates and calculates the Jacobian around x.
| x | The set of parameters around which the Jacobian is evaluated. |
| J | Resulting Jacobian matrix is stored here. |
| Estimate | The function to be differentiated. |
|
inline |
Returns the current residual vector.
Definition at line 86 of file Optimization.h.
| double Optimize | ( | cv::Mat & | parameters, |
| cv::Mat & | measurements, | ||
| double | stop, | ||
| int | max_iter, | ||
| EstimateCallback | Estimate, | ||
| void * | param = 0, |
||
| OptimizeMethod | method = LEVENBERGMARQUARDT, |
||
| const cv::Mat & | parameters_mask = cv::Mat(), |
||
| const cv::Mat & | J_mat = cv::Mat(), |
||
| const cv::Mat & | weights = cv::Mat() |
||
| ) |
Runs the optimization loop with selected parameters.
| parameters | Vector of parameters to be optimized. Initial values should be set. |
| measurements | Vector of measurements that are observed. |
| stop | Optimization loop ends as the stop limit is reached. Criteria is calculated as |
| max_iter | Maximum number of iteration loops that are evaluated if stop is not reached. |
| Estimate | Pointer to the function that maps the state to the measurements. See EstimateCallback. |
| method | One of the three possible optimization methods. |
| parameters_mask | Vector that defines the parameters that are optimized. If vector element is 0, corresponding parameter is not altered. |
| J_mat | Jacobian matrix. If not given, numerical differentation is used. |
| weights | Weight vector that can be submitted to give different weights to different measurements. Currently works only with OptimizeMethod::TUKEY_LM. |