# HG changeset patch # User Nicolas Saunier # Date 1317101885 14400 # Node ID cde87a07eb58a4c69c0962d9058b4a1e2e8567c4 # Parent 61fd5aff418c43d8c03b3916cc9353be1e688604 added graph structures diff -r 61fd5aff418c -r cde87a07eb58 c/Motion.cpp --- a/c/Motion.cpp Tue Sep 27 00:34:03 2011 -0400 +++ b/c/Motion.cpp Tue Sep 27 01:38:05 2011 -0400 @@ -9,7 +9,10 @@ using namespace std; using namespace cv; -FeatureTrajectory::FeatureTrajectory(const int& frameNum, const cv::Point2f& p, const Mat& homography) { +/******************** FeatureTrajectory ********************/ + +FeatureTrajectory::FeatureTrajectory(const int& frameNum, const cv::Point2f& p, const Mat& homography) + : lost(false) { addPoint(frameNum, p, homography); } @@ -95,3 +98,5 @@ displacementDistances.push_back(dist); } } + +/******************** FeatureGraph ********************/ diff -r 61fd5aff418c -r cde87a07eb58 c/feature-based-tracking.cpp --- a/c/feature-based-tracking.cpp Tue Sep 27 00:34:03 2011 -0400 +++ b/c/feature-based-tracking.cpp Tue Sep 27 01:38:05 2011 -0400 @@ -141,6 +141,8 @@ vector lostFeatures; vector featurePointMatches; + + FeatureGraph graph(params.mmConnectionDistance, params.mmSegmentationDistance); int key = '?'; unsigned int savedFeatureId=0; diff -r 61fd5aff418c -r cde87a07eb58 include/Motion.hpp --- 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 +#include template 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 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 feature; + }; + + typedef boost::adjacency_list UndirectedGraph; + + float minDistance; + float maxDistance; + + UndirectedGraph graph; + + std::vector currentVertices, lostVertices; +}; + +// inlined implementations +// inline FeatureGraph::FeatureGraph(float _minDistance, float _maxDistance) + #endif