learner/foreground/ocm/ocm/shape/GaussianKernel.cpp
Go to the documentation of this file.
1 
19 
21 
22 namespace PSMLearner {
23 
25  {
26  }
27 
29  {
30  }
31 
33  {
34  mVisualizer->appendKernel(boost::shared_ptr<Eigen::Vector3d>(new Eigen::Vector3d(mMean->block<3,1>(0,0))),
35  boost::shared_ptr<Eigen::Matrix3d>(new Eigen::Matrix3d(mCovariance->block<3,3>(0,0))));
36  }
37 
39  {
40  bool result = true;
41 
42  // Compare size of mean vectors.
43  result &= (mMean->size() == pKernel.mMean->size());
44 
45  // Compare the mean vectors.
46  for(int i = 0; i < mMean->size(); i++)
47  result &= ((*mMean)(i) == (*pKernel.mMean)(i));
48 
49  // Compare size of covariance matrices..
50  result &= (mCovariance->rows() == pKernel.mCovariance->rows());
51  result &= (mCovariance->cols() == pKernel.mCovariance->cols());
52 
53  // Compare the covariance matrices.
54  for(int i = 0; i < mCovariance->rows(); i++)
55  for(int j = 0; j < mCovariance->cols(); j++)
56  result &= ((*mCovariance)(i,j) == (*pKernel.mCovariance)(i,j));
57 
58  // If both kernels are equal, this should be still true.
59  return result;
60  }
61 
62  void GaussianKernel::save(boost::property_tree::ptree& pPt)
63  {
64  // Create a seperate tree for this kernel.
65  boost::property_tree::ptree subtree;
66 
67  // Write weight to XML.
68  subtree.add("<xmlattr>.weight", mWeight);
69 
70  // Serialize mean vector and write it to XML.
71  std::string meanString;
73  subtree.add("<xmlattr>.mean", meanString);
74 
75  // Serialize covariance matrix and write it to XML.
76  std::string covarianceString;
78  subtree.add("<xmlattr>.covariance", covarianceString);
79 
80  // Add subtree to main tree.
81  pPt.add_child("kernel", subtree);
82  }
83 
84 }
85 
86 }
void initializeVisualizer(boost::shared_ptr< Visualization::ProbabilisticSecondarySceneObjectVisualization > mSuperior)
static void convertMatrixToString(boost::shared_ptr< Eigen::MatrixXd > &mat, std::string &str)
static void convertVectorToString(std::vector< double > &vec, std::string &str)


asr_psm
Author(s): Braun Kai, Gehrung Joachim, Heizmann Heinrich, Meißner Pascal
autogenerated on Fri Nov 15 2019 03:57:54