BaseRater.hpp
Go to the documentation of this file.
1 
18 #pragma once
19 
20 #include "typedef.hpp"
21 #include "common_type/Object.hpp"
22 #include "recognizer/VotedPose.hpp"
23 #include "RatingData.hpp"
25 
26 namespace ISM {
31 class BaseRater
32 {
33 
34  typedef GeometryHelper GH;
35 
36 public:
37  //This is what we "actually" do here: const double maxDistanceInsideBin = sqrt(3.0) * bin_size / 2;
38  BaseRater(double bin_size, double maxAngleDeviation) : maxSquaredDistance(0.75 * bin_size * bin_size),
39  maxAngleDeviation(maxAngleDeviation),
40  projectedPose(PosePtr(new Pose())),
42  { }
43 
44  //Methods are inlined for performance reasons.
45 
47  {
48  //Predict position of source object for current vote, using originForFitting.
49  GH::getSourcePoint(refPose,
50  votedPose->vote->refToObjectQuat,
51  votedPose->vote->radius,
53 
54  //Calculate distance between positions of real source object and predicted source object.
55  double backProjectionSquaredDistance = GH::getSquaredDistanceBetweenPoints(votedPose->source->
56  pose->point,
58  //Now also predict the orientation, not only the position.
59  GH::getSourcePose(refPose, projectedPoint, votedPose->vote->refToObjectPoseQuat, projectedPose);
60 
61  //Calculate angle between orientation of real source object and predicted source object.
62  double angleDeviation = GH::getAngleBetweenQuats(votedPose->source->pose->quat, projectedPose->quat);
63 
64  //Numerical stuff.
65  if (GH::checkIfDoubleNaN(backProjectionSquaredDistance))
66  backProjectionSquaredDistance = 0.0;
67  if (GH::checkIfDoubleNaN(angleDeviation))
68  angleDeviation = 0.0;
69 
70  //cache data for further processing
71  data->angleDeviation = angleDeviation;
72  data->backProjectionSquaredDistance = backProjectionSquaredDistance;
73 
74  //Reject all votes whose deviation form originForFitting exceed given thresholds. They cannot be regarded as supporting originForFitting.
75  return (backProjectionSquaredDistance <= maxSquaredDistance && angleDeviation < maxAngleDeviation);
76 
77  }
78 
79  //Separated pure calculation of ratings from printing for performance reasons.
80  virtual double rateAtBackProjectionLevel(VotedPosePtr& votedPose, RatingDataPtr data) = 0;
81  virtual void printRatingAtBackProjectionLevel(VotedPosePtr& votedPose, PosePtr& refPose, RatingDataPtr data) = 0;
82 
83 protected:
84  const double maxSquaredDistance;
85  const double maxAngleDeviation;
88 
89 };
90 
91 typedef boost::shared_ptr<BaseRater> RaterPtr;
92 }
static double getAngleBetweenQuats(const QuaternionPtr &q1, const QuaternionPtr &q2)
const double maxAngleDeviation
Definition: BaseRater.hpp:85
bool isVoteSupportingReference(VotedPosePtr &votedPose, PosePtr &refPose, RatingDataPtr data)
Definition: BaseRater.hpp:46
boost::shared_ptr< Point > PointPtr
Definition: Point.hpp:45
BaseRater(double bin_size, double maxAngleDeviation)
Definition: BaseRater.hpp:38
boost::shared_ptr< RatingData > RatingDataPtr
Definition: RatingData.hpp:38
virtual double rateAtBackProjectionLevel(VotedPosePtr &votedPose, RatingDataPtr data)=0
boost::shared_ptr< BaseRater > RaterPtr
Definition: BaseRater.hpp:91
const double maxSquaredDistance
Definition: BaseRater.hpp:84
boost::shared_ptr< VotedPose > VotedPosePtr
Definition: typedef.hpp:31
static double getSquaredDistanceBetweenPoints(const PointPtr &p1, const PointPtr &p2)
PointPtr projectedPoint
Definition: BaseRater.hpp:87
virtual void printRatingAtBackProjectionLevel(VotedPosePtr &votedPose, PosePtr &refPose, RatingDataPtr data)=0
static bool checkIfDoubleNaN(double &c)
boost::shared_ptr< Pose > PosePtr
Definition: Pose.hpp:79
PosePtr projectedPose
Definition: BaseRater.hpp:86
static PointPtr getSourcePoint(const PosePtr &refPose, const QuaternionPtr &refToObjectQuat, double radius)
static PosePtr getSourcePose(const PosePtr &reference, const PointPtr &sourcePoint, const QuaternionPtr &refToObjectPoseQuat)
this namespace contains all generally usable classes.
GeometryHelper GH
Definition: BaseRater.hpp:34


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