Tree.hpp
Go to the documentation of this file.
1 
18 #pragma once
19 #include <boost/shared_ptr.hpp>
20 
21 #include "typedef.hpp"
22 #include "Cluster.hpp"
23 #include "common_type/Track.hpp"
25 #include "ImplicitShapeModel.hpp"
26 
27 #include "utility/LogHelper.hpp"
28 
29 namespace ISM
30 {
31 
32 class Tree
33 {
34  public:
35  Tree(TrackPtr reference) : reference(reference), height(0), weight(1)
36  {
37  this->reference = TrackPtr(new Track(*reference));
38  }
39 
40  Tree(const std::string &pattern, ObjectRelations topology, bool naive = false);
41  void addChild(const boost::shared_ptr<Tree>& child);
42  void setHeight(unsigned height);
43  unsigned getHeight();
44  void setWeight(unsigned weight);
45  unsigned getWeight();
46  void addVotes(const std::string& voterType, const std::vector<VoteSpecifierPtr>& votes);
47  std::vector<VoteSpecifierPtr> getVotesByType(const std::string& type);
49  IsmPtr getISM();
50  void setISM(IsmPtr ism);
51 
52  private:
53  Tree(std::string pattern, unsigned clusterId, const TrackPtr reference, std::vector<ClusterPtr>& clustersLeft, const std::vector<ClusterPtr>& allClusters, IsmPtr& ism, bool naive);
54 
55  void build(std::string pattern, unsigned clusterId, const TrackPtr reference, std::vector<ClusterPtr>& clustersLeft, const std::vector<ClusterPtr>& allClusters, IsmPtr& ism, bool naive);
56  TreePtr generateTree(const std::string& pattern, const TrackPtr& reference, std::vector<ClusterPtr> clusters, bool naive = false);
57  std::vector<VoteSpecifierPtr> generateISM(ISM::ObjectRelations);
58  std::vector<ClusterPtr> buildClusters(ISM::ObjectRelations) const;
59  std::pair<std::map<ISM::TrackPtr, int> , std::vector<std::pair<int, ISM::TrackPtr > > > getMostCommonObjects(const ISM::ObjectRelations& topology) const;
60  std::pair<TrackPtr, ClusterPtr> getReference(std::vector<std::pair<int, TrackPtr> >& objectTracks, const std::vector<ClusterPtr>& currentClusters, const ObjectRelations& topology) const;
61  static bool compareClusters(const ClusterPtr& one, const ClusterPtr& two);
62  template <typename T> static bool pairCompare(const std::pair<unsigned, T>& firstElem, const std::pair<unsigned, T>& secondElem);
63 
64 
67 
69  std::vector<boost::shared_ptr<Tree> > children;
70  unsigned height;
71  unsigned weight;
72  std::map<std::string, std::vector<VoteSpecifierPtr> > votesByVotersType;
74 
75 };
76 
77 }
TrackPtr getReference()
Definition: Tree.cpp:388
void setISM(IsmPtr ism)
Definition: Tree.cpp:398
TreePtr generateTree(const std::string &pattern, const TrackPtr &reference, std::vector< ClusterPtr > clusters, bool naive=false)
std::vector< boost::shared_ptr< Tree > > children
Definition: Tree.hpp:69
static const char * LOG_COLOR_GREEN
Definition: LogHelper.hpp:46
unsigned getHeight()
Definition: Tree.cpp:362
void build(std::string pattern, unsigned clusterId, const TrackPtr reference, std::vector< ClusterPtr > &clustersLeft, const std::vector< ClusterPtr > &allClusters, IsmPtr &ism, bool naive)
Definition: Tree.cpp:71
void addVotes(const std::string &voterType, const std::vector< VoteSpecifierPtr > &votes)
Definition: Tree.cpp:377
void addChild(const boost::shared_ptr< Tree > &child)
Definition: Tree.cpp:352
static bool pairCompare(const std::pair< unsigned, T > &firstElem, const std::pair< unsigned, T > &secondElem)
Definition: Tree.cpp:346
Tree(TrackPtr reference)
Definition: Tree.hpp:35
std::vector< VoteSpecifierPtr > generateISM(ISM::ObjectRelations)
std::vector< VoteSpecifierPtr > getVotesByType(const std::string &type)
Definition: Tree.cpp:383
IsmPtr getISM()
Definition: Tree.cpp:393
boost::shared_ptr< Cluster > ClusterPtr
Definition: Cluster.hpp:53
unsigned height
Definition: Tree.hpp:70
unsigned getWeight()
Definition: Tree.cpp:372
const char * LOG_COLOR_CLUSTER
Definition: Tree.hpp:66
static bool compareClusters(const ClusterPtr &one, const ClusterPtr &two)
Definition: Tree.cpp:341
std::map< unsigned int, ISM::ObjectRelationPtr, std::less< unsigned > > ObjectRelations
unsigned weight
Definition: Tree.hpp:71
boost::shared_ptr< ImplicitShapeModel > IsmPtr
TrackPtr reference
Definition: Tree.hpp:68
boost::shared_ptr< Tree > TreePtr
Definition: typedef.hpp:46
IsmPtr ism
Definition: Tree.hpp:73
const char * LOG_COLOR_TREE
Definition: Tree.hpp:65
void setHeight(unsigned height)
Definition: Tree.cpp:357
std::map< std::string, std::vector< VoteSpecifierPtr > > votesByVotersType
Definition: Tree.hpp:72
void setWeight(unsigned weight)
Definition: Tree.cpp:367
static const char * LOG_COLOR_MAGENTA
Definition: LogHelper.hpp:48
boost::shared_ptr< Track > TrackPtr
Definition: Track.hpp:55
std::pair< std::map< ISM::TrackPtr, int >, std::vector< std::pair< int, ISM::TrackPtr > > > getMostCommonObjects(const ISM::ObjectRelations &topology) const
Definition: Tree.cpp:242
this namespace contains all generally usable classes.
std::vector< ClusterPtr > buildClusters(ISM::ObjectRelations) const
Definition: Tree.cpp:181


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:41