KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dynamics_moves.h
Go to the documentation of this file.
1 
2 /* $Id: dynamics_moves.h 18278 2014-11-25 01:42:10Z ksimek $ */
3 
4 /* =========================================================================== *
5 |
6 | Copyright (c) 1994-2008 by Kobus Barnard (author).
7 |
8 | Personal and educational use of this code is granted, provided that this
9 | header is kept intact, and that the authorship is not misrepresented, that
10 | its use is acknowledged in publications, and relevant papers are cited.
11 |
12 | For other use contact the author (kobus AT cs DOT arizona DOT edu).
13 |
14 | Please note that the code in this file has not necessarily been adequately
15 | tested. Naturally, there is no guarantee of performance, support, or fitness
16 | for any particular task. Nonetheless, I am interested in hearing about
17 | problems that you encounter.
18 |
19 | Author: Luca Del Pero
20 * =========================================================================== */
21 
22 #ifndef DYNAMICS_MOVES_INCLUDED
23 #define DYNAMICS_MOVES_INCLUDED
24 
26 #include <st_cpp/st_parapiped.h>
28 
29 namespace kjb {
30 
42 };
43 
45 {
46 public :
48  (
49  const kjb::Vector & ideltas,
50  const kjb::Vector & ietas,
51  double (*icompute_likelihood)(Parametric_parapiped & pp,Perspective_camera & c),
52  void (*get_pp_and_camera)(Parametric_parapiped & pp, Perspective_camera & c),
53  void (*log_results)(const Parametric_parapiped & pp, const Perspective_camera & c, double ll),
54  double ialpha = 0.99,
55  unsigned int ikick = 0,
56  bool sample_centre_x = true,
57  bool sample_centre_y = true,
58  bool sample_centre_z = true,
59  bool sample_width = true,
60  bool sample_height = true,
61  bool sample_length = true,
62  bool sample_yaw = true,
63  bool sample_focal_length = true,
64  bool sample_camera_pitch = true,
65  bool sample_camera_roll = true
66  );
67  void run(unsigned int iterations);
68 
69 
70 private:
71  void log_sample();
72  double compute_likelihood();
73  Parametric_parapiped local_pp;
74  Perspective_camera local_camera;
75 
76  boost::function2<double, Parametric_parapiped &, Perspective_camera &> likelihood;
77  boost::function2<void, Parametric_parapiped &, Perspective_camera &> get_parameters;
78  boost::function3<void, const Parametric_parapiped &, const Perspective_camera &, double> logger;
79 };
80 
82 {
83 public:
85  (
86  const kjb::Vector & ideltas,
87  const kjb::Vector & ietas,
88  double (*icompute_likelihood)(Parametric_parapiped & pp,Perspective_camera & c),
89  void (*get_pp_and_camera)(Parametric_parapiped & pp, Perspective_camera & c),
90  void (*log_results)(const Parametric_parapiped & pp, const Perspective_camera & c, double ll),
91  bool idirection1,
92  bool idirection2,
93  bool idirection3,
94  double ialpha = 0.99,
95  unsigned int ikick = 0,
96  bool sample_width = true,
97  bool sample_height = true,
98  bool sample_length = true
99  );
100  void run(unsigned int iterations);
101 
102 private:
103  void log_sample();
104  double compute_likelihood();
105  Parametric_parapiped local_pp;
106  Perspective_camera local_camera;
107 
108  bool direction1;
109  bool direction2;
110  bool direction3;
111 
112  void stretch_x(double x_value);
113  void stretch_y(double y_value);
114  void stretch_z(double z_value);
115 
116  boost::function2<double, Parametric_parapiped &, Perspective_camera &> likelihood;
117  boost::function2<void, Parametric_parapiped &, Perspective_camera &> get_parameters;
118  boost::function3<void, const Parametric_parapiped &, const Perspective_camera &, double> logger;
119 };
120 
122 {
123 public:
125  (
126  const kjb::Vector & ideltas,
127  const kjb::Vector & ietas,
128  double (*icompute_likelihood)(Parametric_parapiped & pp,Perspective_camera & c),
129  void (*get_pp_and_camera)(Parametric_parapiped & pp, Perspective_camera & c),
130  void (*log_results)(const Parametric_parapiped & pp, const Perspective_camera & c, double ll),
131  double ialpha = 0.99,
132  unsigned int ikick = 0
133  );
134  void run(unsigned int iterations);
135 
136 private:
137  void log_sample();
138  double compute_likelihood();
139  Parametric_parapiped local_pp;
140  Perspective_camera local_camera;
141 
142  void update_focal_with_position(double ifocal);
143 
144  boost::function2<double, Parametric_parapiped &, Perspective_camera &> likelihood;
145  boost::function2<void, Parametric_parapiped &, Perspective_camera &> get_parameters;
146  boost::function3<void, const Parametric_parapiped &, const Perspective_camera &, double> logger;
147 };
148 
150 {
151 public:
153  (
154  unsigned int axis,
155  bool direction,
156  double (*icompute_likelihood)(Parametric_parapiped & pp,Perspective_camera & c),
157  void (*get_pp_and_camera)(Parametric_parapiped & pp, Perspective_camera & c),
158  void (*log_results)(const Parametric_parapiped & pp, const Perspective_camera & c, double ll),
159  double ialpha = 0.99,
160  unsigned int ikick = 0
161  );
162  void run(unsigned int iterations = 1);
163 
164 private:
165  void log_sample();
166  double compute_likelihood();
167  Parametric_parapiped local_pp;
168  Perspective_camera local_camera;
169  unsigned int axis;
170  bool direction;
171 
172  boost::function2<double, Parametric_parapiped &, Perspective_camera &> likelihood;
173  boost::function2<void, Parametric_parapiped &, Perspective_camera &> get_parameters;
174  boost::function3<void, const Parametric_parapiped &, const Perspective_camera &, double> logger;
175 };
176 
177 }
178 
179 #endif
180 
181 
Definition: dynamics_moves.h:121
Definition: dynamics_moves.h:37
Definition: dynamics_moves.h:38
void run(unsigned int iterations)
Definition: dynamics_moves.cpp:321
Definition: dynamics_moves.h:39
Definition: dynamics_moves.h:41
Focal_scale_dynamics(const kjb::Vector &ideltas, const kjb::Vector &ietas, double(*icompute_likelihood)(Parametric_parapiped &pp, Perspective_camera &c), void(*get_pp_and_camera)(Parametric_parapiped &pp, Perspective_camera &c), void(*log_results)(const Parametric_parapiped &pp, const Perspective_camera &c, double ll), double ialpha=0.99, unsigned int ikick=0)
Definition: dynamics_moves.cpp:278
Definition: dynamics_moves.h:33
void run(unsigned int iterations)
Definition: dynamics_moves.cpp:158
This class implements vectors, in the linear-algebra sense, with real-valued elements.
Definition: m_vector.h:87
Definition: dynamics_moves.h:44
St_perspective_camera for modeling a perspective camera using the classic Forsyth and Ponce parametri...
Parapiped_camera_dynamics(const kjb::Vector &ideltas, const kjb::Vector &ietas, double(*icompute_likelihood)(Parametric_parapiped &pp, Perspective_camera &c), void(*get_pp_and_camera)(Parametric_parapiped &pp, Perspective_camera &c), void(*log_results)(const Parametric_parapiped &pp, const Perspective_camera &c, double ll), double ialpha=0.99, unsigned int ikick=0, bool sample_centre_x=true, bool sample_centre_y=true, bool sample_centre_z=true, bool sample_width=true, bool sample_height=true, bool sample_length=true, bool sample_yaw=true, bool sample_focal_length=true, bool sample_camera_pitch=true, bool sample_camera_roll=true)
Definition: dynamics_moves.cpp:29
St_perspective_camera for modeling a perspective camera using the classic Forsyth and Ponce parametri...
Definition: perspective_camera.h:93
Definition: dynamics_moves.h:34
Definition: likelihood_dynamics.h:38
Definition: dynamics_moves.h:40
Discrete_change_size(unsigned int axis, bool direction, double(*icompute_likelihood)(Parametric_parapiped &pp, Perspective_camera &c), void(*get_pp_and_camera)(Parametric_parapiped &pp, Perspective_camera &c), void(*log_results)(const Parametric_parapiped &pp, const Perspective_camera &c, double ll), double ialpha=0.99, unsigned int ikick=0)
Definition: dynamics_moves.cpp:338
Definition: dynamics_moves.h:81
void run(unsigned int iterations=1)
Definition: dynamics_moves.cpp:358
Definition: dynamics_moves.h:149
Definition: dynamics_moves.h:35
Parapiped_camera_dynamics_params
Definition: dynamics_moves.h:31
Definition: dynamics_moves.h:36
Definition: dynamics_moves.h:32
Parapiped_stretch_dynamics(const kjb::Vector &ideltas, const kjb::Vector &ietas, double(*icompute_likelihood)(Parametric_parapiped &pp, Perspective_camera &c), void(*get_pp_and_camera)(Parametric_parapiped &pp, Perspective_camera &c), void(*log_results)(const Parametric_parapiped &pp, const Perspective_camera &c, double ll), bool idirection1, bool idirection2, bool idirection3, double ialpha=0.99, unsigned int ikick=0, bool sample_width=true, bool sample_height=true, bool sample_length=true)
Definition: dynamics_moves.cpp:175
void run(unsigned int iterations)
Definition: dynamics_moves.cpp:261
Definition: st_parapiped.h:99