diff include/Motion.hpp @ 136:0f790de9437e

renamed Feature to Motion files and added code to test blob db
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Thu, 18 Aug 2011 22:25:21 -0400
parents include/Feature.hpp@32d2722d4028
children c1b260b48d2a
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/include/Motion.hpp	Thu Aug 18 22:25:21 2011 -0400
@@ -0,0 +1,49 @@
+#ifndef FEATURE_HPP
+#define FEATURE_HPP
+
+#include "src/Trajectory.h"
+
+#include <boost/shared_ptr.hpp>
+
+template<typename T> class TrajectoryDBAccess;
+
+/** Class for feature data
+    positions, velocities and other statistics to evaluate their quality
+    before saving. */
+class FeatureTrajectory {
+public:
+  FeatureTrajectory(const int& frameNum, const cv::Point2f& p);
+
+  unsigned int length(void) const { return positions.size();}
+
+  void setId(const unsigned int& id) { positions.setId(id);velocities.setId(id);}
+
+  /// indicates whether the sum of the last nDisplacements displacements have been superior to minFeatureDisplacement
+  bool largeDisplacement(const unsigned int& nDisplacements, const float& minTotalFeatureDisplacement) const;
+
+  //void shorten(void);
+
+  void addPoint(const int& frameNum, const cv::Point2f& p);
+
+  void write(TrajectoryDBAccess<cv::Point2f>& trajectoryDB) const;
+
+#ifdef USE_OPENCV
+  void draw(cv::Mat& img, const cv::Scalar& color) const;
+#endif
+
+protected:
+  Trajectory<cv::Point2f> positions;
+  Trajectory<cv::Point2f> velocities;
+  
+  std::vector<float> displacementDistances;
+
+  void computeMotionData(const int& frameNum);
+
+};
+
+typedef boost::shared_ptr<FeatureTrajectory> FeatureTrajectoryPtr;
+
+// class MovingObject {}
+// roadUserType, group of features
+
+#endif