Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef SKELETON_POSE_ESTIMATOR_H
00017 #define SKELETON_POSE_ESTIMATOR_H
00018
00019 #include "skeleton_state.h"
00020 #include "angle_state.h"
00021 #include <vector>
00022 #include "auxil.h"
00023 #include <omp.h>
00024
00025 template <class state_type>
00026 void mean (const std::vector<double> &weights, std::vector<state_type*> states,
00027 state_type &result)
00028 {
00029 solver_type::vector_type &ret_theta = result.get_theta ();
00030 const int theta_size = states [0]->theta_size ();
00031 ret_theta.resize (theta_size);
00032
00033 const int num_states = states.size ();
00034 for (int k = 0; k < theta_size; k++)
00035 {
00036 ret_theta [k] = 0;
00037 for (int p = 0; p < num_states; p++)
00038 ret_theta [k] += weights [p] * states [p]->get_theta (k);
00039 }
00040
00041 vector3 root (0, 0, 0);
00042 for (int p = 0; p < num_states; p++)
00043 root += weights [p] * states [p]->get_root ();
00044 result.set_root (root);
00045 }
00046
00047 template <class state_type>
00048 void max (const std::vector<double> &weights, std::vector<state_type*> states,
00049 state_type &result)
00050 {
00051 const int idx = find_max_idx (weights);
00052 result = *states [idx];
00053 }
00054
00055 #endif // SKELETON_POSE_ESTIMATOR_H