OcclusionTermEvaluator.cpp
Go to the documentation of this file.
1 
19 
21 
23  : TermEvaluator()
24  {
25  // Initialize pointer.
26  mTable.reset(new ProbabilityTable());
27  }
28 
30  {
31  }
32 
33  void OcclusionTermEvaluator::load(boost::property_tree::ptree& pPt)
34  {
35  // Load the probability table.
36  mTable.reset(new ProbabilityTable(pPt.get_child("occlusion")));
37  }
38 
40  {
41  // Here is no visualization required.
42  }
43 
44  double OcclusionTermEvaluator::calculateProbabilityForHypothesis(std::vector<ISM::Object> pEvidenceList, std::vector<unsigned int> pAssignments)
45  {
46  /**************************************************************************************************
47  * Build an entry of the conditional joint distribution P(h) bases on the given hypothesis
48  **************************************************************************************************/
49 
50  // The occlusion probability based on the given hypothesis.
51  // It will be calculated in this function.
52  double result = 1.0;
53 
54  // If no part was assigned to the root node, we don't need to continue (because the model doesn't allow cases like this).
55  if(pAssignments[0] > 0)
56  {
57  // The number of filled slots.
58  unsigned int numberOfFilledSlots = 0;
59 
60  // Evaluate all slots with associated objects. Multiply their probability to the hypothesis probability.
61  for(unsigned int slot = 0; slot < mTable->getNumberOfRows(); slot++)
62  {
63  // Get the information whether or not a part is associated with the slot.
64  unsigned int part = std::min(pAssignments[slot], (unsigned int) 1);
65 
66  // Get the probability for the given occlusion status of the given slot.
67  result *= mTable->getProbability(slot, part);
68 
69  // Used to calculate the number of filled slots.
70  if(pAssignments[slot] > 0)
71  numberOfFilledSlots++;
72  }
73  } else {
74  // A hypothesis without an assigned root object is invalid and will therefore be scored with the impossible event.
75  result = 0.0;
76  }
77 
78  // Return the probability for the given hypothesis.
79  return result;
80  }
81 
82  void OcclusionTermEvaluator::visualize(std::vector<ISM::Object> pEvidenceList)
83  {
84  // No visualization to update.
85  }
86 
88  {
89  return mTable->getNumberOfRows();
90  }
91 
92 }
double calculateProbabilityForHypothesis(std::vector< ISM::Object > pEvidenceList, std::vector< unsigned int > pAssignments)
void visualize(std::vector< ISM::Object > pEvidenceList)
void initializeVisualizer(boost::shared_ptr< Visualization::ProbabilisticPrimarySceneObjectVisualization > mSuperior)


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