20 #include <boost/random.hpp> 35 std::vector<ASR::MultidimensionalGaussianPtr>
models;
49 boost::uniform_real<float> u(min, max);
50 boost::variate_generator<boost::mt19937&, boost::uniform_real<float> > gen(rng, u);
59 histogramm.push_back(0.0
f);
72 weights.push_back(weight);
74 histogramm.push_back(histogramm.at(histogramm.size()-1) + weight );
88 float sum = histogramm.at(histogramm.size()-1);
90 if (sum < .99f || sum > 1.01
f)
92 ROS_INFO(
"Sum of the gaussian weights not 1. Please normailze the weight of the distibutions!");
101 unsigned int index = 0;
104 while (histogramm.at(index) < xi)
114 if(index > models.size()) index = models.size();
117 models.at(index)->sampleRandomValues(x);
128 return models.at(index);
std::vector< ASR::MultidimensionalGaussianPtr > models
std::vector< float > weights
std::vector< float > histogramm
float gen_random_float(float min, float max)
boost::shared_ptr< GMM > GMM_Ptr
ASR::MultidimensionalGaussianPtr getModel(unsigned int index)
void sampleRandomValues(std::vector< float > &x)
void addGaussianModel(float weight, std::vector< float > mean, MatrixXf covariance)