Mercurial Hosting > traffic-intelligence
diff include/Motion.hpp @ 163:cde87a07eb58
added graph structures
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Tue, 27 Sep 2011 01:38:05 -0400 |
parents | 0089fb29cd26 |
children | 50964af05a80 |
line wrap: on
line diff
--- a/include/Motion.hpp Tue Sep 27 00:34:03 2011 -0400 +++ b/include/Motion.hpp Tue Sep 27 01:38:05 2011 -0400 @@ -4,6 +4,7 @@ #include "src/Trajectory.h" #include <boost/shared_ptr.hpp> +#include <boost/graph/adjacency_list.hpp> template<typename T> class TrajectoryDBAccess; @@ -18,6 +19,9 @@ void setId(const unsigned int& id) { positions.setId(id);velocities.setId(id);} + void setLost(void) { lost = true;} + bool isLost(void) { return lost;} + /// indicates whether the sum of the last nDisplacements displacements has been inferior to minFeatureDisplacement bool smallDisplacement(const unsigned int& nDisplacements, const float& minTotalFeatureDisplacement) const; @@ -35,6 +39,7 @@ #endif protected: + bool lost; Trajectory<cv::Point2f> positions; /** one fewer velocity than position v_n = p_n+1 - p_n*/ @@ -52,4 +57,32 @@ // class MovingObject {} // roadUserType, group of features +/// Class to group features +class FeatureGraph { +public: + FeatureGraph(float _minDistance, float _maxDistance) : minDistance (_minDistance), maxDistance(_maxDistance) {} + +protected: + struct FeatureConnection { + float minDistance; + float maxDistance; + }; + + struct VertexInformation { + boost::shared_ptr<FeatureTrajectory> feature; + }; + + typedef boost::adjacency_list <boost::listS, boost::listS, boost::undirectedS, VertexInformation, FeatureConnection> UndirectedGraph; + + float minDistance; + float maxDistance; + + UndirectedGraph graph; + + std::vector<UndirectedGraph::vertex_descriptor> currentVertices, lostVertices; +}; + +// inlined implementations +// inline FeatureGraph::FeatureGraph(float _minDistance, float _maxDistance) + #endif