Mercurial > hg > nsaunier > traffic-intelligence
comparison include/Motion.hpp @ 191:0e60a306d324
added basic code to identify features and save them (crash)
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Thu, 08 Dec 2011 18:32:35 -0500 |
| parents | 36968a63efe1 |
| children | 38974d27dd2d |
comparison
equal
deleted
inserted
replaced
| 190:36968a63efe1 | 191:0e60a306d324 |
|---|---|
| 24 can be made generic for different list and blob */ | 24 can be made generic for different list and blob */ |
| 25 FeatureTrajectory(const int& id, TrajectoryDBAccessList<cv::Point2f>& trajectoryDB, const std::string& positionsTableName, const std::string& velocitiesTableName); | 25 FeatureTrajectory(const int& id, TrajectoryDBAccessList<cv::Point2f>& trajectoryDB, const std::string& positionsTableName, const std::string& velocitiesTableName); |
| 26 | 26 |
| 27 unsigned int length(void) const { return positions->size();} // cautious if not continuous: max-min+1 | 27 unsigned int length(void) const { return positions->size();} // cautious if not continuous: max-min+1 |
| 28 | 28 |
| 29 unsigned int getId(void) const { return positions->getId();} | |
| 29 void setId(const unsigned int& id) { positions->setId(id);velocities->setId(id);} | 30 void setId(const unsigned int& id) { positions->setId(id);velocities->setId(id);} |
| 30 | 31 |
| 31 void setLost(void) { lost = true;} | 32 void setLost(void) { lost = true;} |
| 32 bool isLost(void) { return lost;} | 33 bool isLost(void) { return lost;} |
| 33 | 34 |
| 90 // roadUserType, group of features | 91 // roadUserType, group of features |
| 91 | 92 |
| 92 /** Class to group features: Beymer et al. 99/Saunier and Sayed 06 | 93 /** Class to group features: Beymer et al. 99/Saunier and Sayed 06 |
| 93 \todo create various graph types with different parameters, that accept different feature distances or ways to connect and segment features */ | 94 \todo create various graph types with different parameters, that accept different feature distances or ways to connect and segment features */ |
| 94 class FeatureGraph { | 95 class FeatureGraph { |
| 95 public: | |
| 96 //FeatureGraph(float _minDistance, float _maxDistance) : minDistance (_minDistance), maxDistance(_maxDistance) {} | |
| 97 FeatureGraph(float _connectionDistance, float _segmentationDistance, unsigned int _minFeatureTime) : connectionDistance (_connectionDistance), segmentationDistance(_segmentationDistance), minFeatureTime(_minFeatureTime) {} | |
| 98 | |
| 99 void addFeature(const FeatureTrajectoryPtr& ft); | |
| 100 | |
| 101 // add vertex, includes adding links to current vertices | |
| 102 // find connected components, check if old enough, if so, remove | |
| 103 | |
| 104 /// Computes the connected components: features have to be older than lastInstant | |
| 105 void connectedComponents(const int& lastInstant); | |
| 106 | |
| 107 std::string informationString(void); | |
| 108 | |
| 109 protected: | 96 protected: |
| 110 struct FeatureConnection { | 97 struct FeatureConnection { |
| 111 float minDistance; | 98 float minDistance; |
| 112 float maxDistance; | 99 float maxDistance; |
| 113 }; | 100 }; |
| 116 FeatureTrajectoryPtr feature; | 103 FeatureTrajectoryPtr feature; |
| 117 }; | 104 }; |
| 118 | 105 |
| 119 typedef boost::adjacency_list<boost::listS, boost::vecS, boost::undirectedS, VertexInformation, FeatureConnection> UndirectedGraph; | 106 typedef boost::adjacency_list<boost::listS, boost::vecS, boost::undirectedS, VertexInformation, FeatureConnection> UndirectedGraph; |
| 120 | 107 |
| 108 public: | |
| 109 typedef UndirectedGraph::vertex_descriptor vertex_descriptor; | |
| 110 | |
| 111 //FeatureGraph(float _minDistance, float _maxDistance) : minDistance (_minDistance), maxDistance(_maxDistance) {} | |
| 112 FeatureGraph(float _connectionDistance, float _segmentationDistance, unsigned int _minFeatureTime, float _minNFeaturesPerGroup) : connectionDistance (_connectionDistance), segmentationDistance(_segmentationDistance), minFeatureTime(_minFeatureTime), minNFeaturesPerGroup(_minNFeaturesPerGroup) {} | |
| 113 | |
| 114 void addFeature(const FeatureTrajectoryPtr& ft); | |
| 115 | |
| 116 // add vertex, includes adding links to current vertices | |
| 117 // find connected components, check if old enough, if so, remove | |
| 118 | |
| 119 /// Computes the connected components: features have to be older than lastInstant | |
| 120 std::vector<std::vector<vertex_descriptor> > connectedComponents(const int& lastInstant); | |
| 121 | |
| 122 /** Performs some checks on groups of features and return their lists of ids if correct | |
| 123 Removes the vertices from the graph | |
| 124 */ | |
| 125 std::vector<std::vector<unsigned int> > getFeatureGroups(const std::vector<std::vector<vertex_descriptor> >& objectHypotheses); | |
| 126 | |
| 127 std::string informationString(void); | |
| 128 | |
| 129 protected: | |
| 121 float connectionDistance; | 130 float connectionDistance; |
| 122 float segmentationDistance; | 131 float segmentationDistance; |
| 123 unsigned int minFeatureTime; | 132 unsigned int minFeatureTime; |
| 133 float minNFeaturesPerGroup; | |
| 124 // float minDistance; | 134 // float minDistance; |
| 125 // float maxDistance; | 135 // float maxDistance; |
| 126 | 136 |
| 127 UndirectedGraph graph; | 137 UndirectedGraph graph; |
| 128 | 138 |
