diff include/Motion.hpp @ 614:5e09583275a4

Merged Nicolas/trafficintelligence into default
author Mohamed Gomaa <eng.m.gom3a@gmail.com>
date Fri, 05 Dec 2014 12:13:53 -0500
parents b6ad86ee7033
children 045d05cef9d0
line wrap: on
line diff
--- a/include/Motion.hpp	Thu Apr 18 15:29:33 2013 -0400
+++ b/include/Motion.hpp	Fri Dec 05 12:13:53 2014 -0500
@@ -5,6 +5,7 @@
 #include <boost/shared_ptr.hpp>
 #include <boost/graph/adjacency_list.hpp>
 
+
 template<typename T> class TrajectoryDBAccess;
 template<typename T> class TrajectoryDBAccessList;
 
@@ -13,7 +14,8 @@
 /** Class for feature data
     positions, velocities and other statistics to evaluate their quality
     before saving. */
-class FeatureTrajectory {
+class FeatureTrajectory 
+{
 public:
   FeatureTrajectory(const unsigned int& frameNum, const cv::Point2f& p, const cv::Mat& homography);
 
@@ -47,13 +49,15 @@
 
   void shorten(void);
 
+  void movingAverage(const unsigned int& nFramesSmoothing);
+
   void write(TrajectoryDBAccess<cv::Point2f>& trajectoryDB, const std::string& positionsTableName, const std::string& velocitiesTableName) const;
 
 #ifdef USE_OPENCV
   void draw(cv::Mat& img, const cv::Mat& homography, const cv::Scalar& color) const;
 #endif
 
-  friend std::stringstream& operator<<(std::stringstream& out, const FeatureTrajectory& ft);
+  friend std::ostream& operator<<(std::ostream& out, const FeatureTrajectory& ft);
 
 protected:
   /// first frame number
@@ -63,7 +67,7 @@
 
   TrajectoryPoint2fPtr positions;
   /** one fewer velocity than position
-      v_n = p_n+1 - p_n*/
+      v_n = p_n - p_n-1*/
   TrajectoryPoint2fPtr velocities;
   
   /// norms of velocities for feature constraints, one fewer positions than positions
@@ -75,10 +79,12 @@
 typedef boost::shared_ptr<FeatureTrajectory> FeatureTrajectoryPtr;
 
 // inlined
-inline std::stringstream& operator<<(std::stringstream& out, const FeatureTrajectory& ft) {
+inline std::ostream& operator<<(std::ostream& out, const FeatureTrajectory& ft) 
+{
   out << *(ft.positions);
   out << "\n";
   out << *(ft.velocities);
+
   return out;
 }
 
@@ -116,7 +122,7 @@
 
   /** Performs some checks on groups of features and return their lists of ids if correct
       Removes the vertices from the graph */
-  std::vector<std::vector<unsigned int> > getFeatureGroups(void);
+  void getFeatureGroups(std::vector<std::vector<FeatureTrajectoryPtr> >& featureGroups);
 
   std::string informationString(void) const;