27 for (
TrackPtr& first : tracks->tracks) {
29 int bestStaticBreaks = 0;
30 int bestCommonPositions = 0;
31 double bestAvgDistance = 0;
33 for (
TrackPtr& second : tracks->tracks) {
34 if (first == second) {
51 int commonPositions = 0;
53 double averageDistance = 0;
55 for (
size_t i = 0; i < first->objects.size(); i++) {
56 ObjectPtr firstObject = first->objects[i];
57 ObjectPtr secondObject = second->objects[i];
58 if (!firstObject || !secondObject) {
63 firstObject->pose->point,
64 secondObject->pose->point
69 averageDistance /= (double)commonPositions;
71 double maxDeviation = averageDistance * 0.1;
73 for (
size_t i = 0; i < first->objects.size(); i++) {
74 ObjectPtr firstObject = first->objects[i];
75 ObjectPtr secondObject = second->objects[i];
76 if (!firstObject || !secondObject) {
87 vote->objectToRefQuat,
92 firstObject->pose->point,
96 if (distance > maxDeviation) {
103 (
double)staticBreaks < ((
double)commonPositions) * 0.05 &&
104 commonPositions > (
double)first->objects.size() * 0.5 &&
105 (!currentBest || staticBreaks < bestStaticBreaks ||
106 (staticBreaks == bestStaticBreaks && bestAvgDistance > averageDistance))
108 currentBest = second;
109 bestStaticBreaks = staticBreaks;
110 bestCommonPositions = commonPositions;
111 bestAvgDistance = averageDistance;
116 double conf = 1 - (double)bestStaticBreaks / (
double)bestCommonPositions;
119 cluster.push_back(first);
120 cluster.push_back(currentBest);
static VoteSpecifierPtr createVoteSpecifier(const PosePtr &sourcePose, const PosePtr &refPose)
boost::shared_ptr< Point > PointPtr
static PointPtr applyQuatAndRadiusToPose(const PosePtr &pose, const QuaternionPtr &quat, double radius)
static double getDistanceBetweenPoints(const PointPtr &p1, const PointPtr &p2)
boost::shared_ptr< VoteSpecifier > VoteSpecifierPtr
boost::shared_ptr< Tracks > TracksPtr
boost::shared_ptr< Track > TrackPtr
StaticRelationHeuristic(const TracksPtr &tracks)
this namespace contains all generally usable classes.
boost::shared_ptr< Object > ObjectPtr