21 #ifndef LS_MINIMIZER2_H
22 #define LS_MINIMIZER2_H
62 c_min = -std::numeric_limits<flt_t>::max();
87 template <
int nb_data,
int nb_obs>
97 memcpy(
y, b, nb_obs*
sizeof(
flt_t));
103 f(state,
data, nb_data, b, J, user_data);
107 for (
int i=0; i<nb_obs; i++) {
108 flt_t d = computed_b[i] -
y[i];
225 alloc_matrices(max_obs);
229 void set_default_values(
void);
232 void alloc_matrices(
int maximum_scalar_measure_number);
233 void free_matrices();
239 bool outliers_in_residual=
true);
241 bool build_J(
flt_t * state);
242 bool build_J_and_eps(
flt_t * state);
243 bool build_J_and_stuff(
flt_t * state);
244 flt_t compute_residual(
flt_t * state,
bool display =
false);
248 flt_t build_eps_return_inlier_residual(
flt_t * state,
flt_t current_best_residual = std::numeric_limits<flt_t>::max());
251 void show_state(
int vl,
flt_t * state,
flt_t r);
253 void set_current_c_s(
flt_t k = -1.);
255 flt_t * new_state, * best_state, * scales;
258 flt_t default_squared_c;
261 typedef std::vector<observation *> observation_vector;
264 observation_vector observations;
266 CvMat * J, *newJ, * eps, * eps_previous;
267 CvMat * Jt, * JtJ, * Jteps, * ds, * Jds, * aug_JtJ;
271 void set_new_state(
const flt_t *new_state);
277 void * user_data[10];
291 CvMat * dl_delta_diff, * dl_delta_dl, * dl_delta_sd, * dl_delta_gn;
292 CvMat * JtJdelta, * JJteps;
295 bool line_search(CvMat * dir,
flt_t lambda_min,
flt_t lambda_max,
flt_t current_residual,
flt_t & new_residual,
flt_t & new_lambda);
296 CvMat * ct_delta_gn, * ct_delta_sd;
297 int ct_max_iterations;
298 flt_t ct_k_rough, ct_k_fine, ct_lambda0;
301 bool pick_random_indices(
int *idx,
int nb,
int max_index);
304 bool inside_julien_method;
310 flt_t * ground_truth_state;
313 #endif // LS_MINIMIZER_H