Optimization.h
Go to the documentation of this file.
1 /*
2  * This file is part of ALVAR, A Library for Virtual and Augmented Reality.
3  *
4  * Copyright 2007-2012 VTT Technical Research Centre of Finland
5  *
6  * Contact: VTT Augmented Reality Team <alvar.info@vtt.fi>
7  * <http://www.vtt.fi/multimedia/alvar.html>
8  *
9  * ALVAR is free software; you can redistribute it and/or modify it under the
10  * terms of the GNU Lesser General Public License as published by the Free
11  * Software Foundation; either version 2.1 of the License, or (at your option)
12  * any later version.
13  *
14  * This library is distributed in the hope that it will be useful, but WITHOUT
15  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
17  * for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public License
20  * along with ALVAR; if not, see
21  * <http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html>.
22  */
23 
24 #ifndef OPTIMIZATION_H
25 #define OPTIMIZATION_H
26 
27 #include "Alvar.h"
28 #include <cxcore.h>
29 //#include <float.h>
30 
31 
38 namespace alvar {
39 
45 {
46 
47 private:
48 
50  CvMat *J;
51  CvMat *JtJ;
52  CvMat *W;
53  CvMat *diag;
54  CvMat *tmp;
55  CvMat *err;
56  CvMat *delta;
57  CvMat *x_plus;
58  CvMat *x_minus;
59  CvMat *x_tmp1;
60  CvMat *x_tmp2;
61  CvMat *tmp_par;
62 
63  double CalcTukeyWeight(double residual, double c);
64  double CalcTukeyWeightSimple(double residual, double c);
65 
66  double lambda;
67 
68 public:
69 
75  {
78  TUKEY_LM
79  };
80 
86  Optimization(int n_params, int n_meas);
87  ~Optimization();
88 
93  CvMat *GetErr() { return err; }
94 
101  typedef void (*EstimateCallback)(CvMat* state, CvMat *projection, void *param);
102 
109  void CalcJacobian(CvMat* x, CvMat* J, EstimateCallback Estimate);
110 
123  double Optimize(CvMat* parameters,
124  CvMat* measurements,
125  double stop,
126  int max_iter,
127  EstimateCallback Estimate,
128  void *param = 0,
129  OptimizeMethod method = LEVENBERGMARQUARDT,
130  CvMat* parameters_mask = 0,
131  CvMat* J_mat = 0,
132  CvMat* weights = 0);
133 
134 };
135 
136 } // namespace alvar
137 
138 #endif
Main ALVAR namespace.
Definition: Alvar.h:174
bool param(const std::string &param_name, T &param_val, const T &default_val)
void Estimate(CvMat *state, CvMat *projection, void *param)
Non-linear optimization routines. There are three methods implemented that include Gauss-Newton...
Definition: Optimization.h:44
OptimizeMethod
Selection between the algorithm used in optimization. Following should be noticed: ...
Definition: Optimization.h:74
#define ALVAR_EXPORT
Definition: Alvar.h:168
This file defines library export definitions, version numbers and build information.
CvMat * GetErr()
Returns the current residual vector.
Definition: Optimization.h:93


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