RecognitionResult.cpp
Go to the documentation of this file.
1 
18 #include "RecognitionResult.hpp"
19 
20 namespace ISM {
21 
23  {
24 
25  if (this->numberOfCombinations > 0)
26  {
27  return this->numberOfCombinations;
28  }
29 
30  /* compute number of combinations with the information from the child nodes */
31  u_int64_t combiProduct = 1;
32  for (SummarizedVotedPosePtr& summarizedVote : this->summarizedVotes)
33  {
34  /* leaf? */
35  if (summarizedVote.first->source->type.find("_sub") == std::string::npos)
36  {
37  combiProduct *= summarizedVote.second.first;
38  continue;
39  }
40 
41  /* sub-tree */
42  u_int64_t combiSum = (this->subPatterns.size() > 0) ? 0 : 1;
43  for(RecognitionResultPtr sub : this->subPatterns)
44  {
45  if(sub->patternName == summarizedVote.first->source->type)
46  {
47  combiSum += sub->getNumberOfCombinations();
48  }
49  }
50  combiProduct *= summarizedVote.second.first * combiSum;
51  }
52 
53  this->numberOfCombinations = combiProduct;
54  return this->numberOfCombinations;
55  }
56 
57  std::ostream& operator<<(std::ostream &strm, ISM::RecognitionResult &r) {
58  strm << "recognition result: [pattern: " << r.patternName << "; confidence: " << r.confidence << "; combinations: " << r.getNumberOfCombinations() << "; " << r.referencePose << ";"
59  << r.recognizedSet;
60  size_t s = r.subPatterns.size();
61  if (s > 0) {
62  strm << ";sub patterns: [";
63  size_t c = 1;
64  for (RecognitionResultPtr& subPattern : r.subPatterns) {
65  strm << subPattern;
66  if (c < s) {
67  strm << ",";
68  }
69  strm<<"\n";
70  c++;
71  }
72  strm << "]";
73  }
74  return strm << "]";
75  }
76 
77  std::ostream& operator<<(std::ostream &strm, ISM::RecognitionResultPtr &r) {
78  return strm << (*r);
79  }
80 
81  bool operator==(const RecognitionResultPtr& recogRes1, const RecognitionResultPtr& recogRes2)
82  {
83  return *recogRes1 == *recogRes2;
84  }
85 
86  bool operator==(const RecognitionResult& recogRes1, const RecognitionResult& recogRes2)
87  {
88  return recogRes1.patternName == recogRes2.patternName &&
89  recogRes1.referencePose == recogRes2.referencePose &&
90  std::fabs(recogRes1.confidence - recogRes2.confidence) < RecognitionResult::epsilon;
91  }
92 
93 }
std::vector< RecognitionResultPtr > subPatterns
SummarizedVotedPosePtrs summarizedVotes
static constexpr double epsilon
std::ostream & operator<<(std::ostream &strm, const ISM::ObjectRelation &r)
boost::shared_ptr< RecognitionResult > RecognitionResultPtr
bool operator==(const PointPtr &p1, const PointPtr &p2)
Definition: Point.cpp:39
std::pair< VotedPosePtr, CountWeightPair > SummarizedVotedPosePtr
Definition: typedef.hpp:74
PosePtr referencePose
Pose of ism reference in this object configuration.
this namespace contains all generally usable classes.
ObjectSetPtr recognizedSet
Objects that have been assigned to scene instance. That match scene model.


asr_lib_ism
Author(s): Hanselmann Fabian, Heller Florian, Heizmann Heinrich, Kübler Marcel, Mehlhaus Jonas, Meißner Pascal, Qattan Mohamad, Reckling Reno, Stroh Daniel
autogenerated on Wed Jan 8 2020 04:02:40