Mercurial > hg > nsaunier > traffic-intelligence
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 135:32d2722d4028 | 136:0f790de9437e |
|---|---|
| 1 #ifndef FEATURE_HPP | |
| 2 #define FEATURE_HPP | |
| 3 | |
| 4 #include "src/Trajectory.h" | |
| 5 | |
| 6 #include <boost/shared_ptr.hpp> | |
| 7 | |
| 8 template<typename T> class TrajectoryDBAccess; | |
| 9 | |
| 10 /** Class for feature data | |
| 11 positions, velocities and other statistics to evaluate their quality | |
| 12 before saving. */ | |
| 13 class FeatureTrajectory { | |
| 14 public: | |
| 15 FeatureTrajectory(const int& frameNum, const cv::Point2f& p); | |
| 16 | |
| 17 unsigned int length(void) const { return positions.size();} | |
| 18 | |
| 19 void setId(const unsigned int& id) { positions.setId(id);velocities.setId(id);} | |
| 20 | |
| 21 /// indicates whether the sum of the last nDisplacements displacements have been superior to minFeatureDisplacement | |
| 22 bool largeDisplacement(const unsigned int& nDisplacements, const float& minTotalFeatureDisplacement) const; | |
| 23 | |
| 24 //void shorten(void); | |
| 25 | |
| 26 void addPoint(const int& frameNum, const cv::Point2f& p); | |
| 27 | |
| 28 void write(TrajectoryDBAccess<cv::Point2f>& trajectoryDB) const; | |
| 29 | |
| 30 #ifdef USE_OPENCV | |
| 31 void draw(cv::Mat& img, const cv::Scalar& color) const; | |
| 32 #endif | |
| 33 | |
| 34 protected: | |
| 35 Trajectory<cv::Point2f> positions; | |
| 36 Trajectory<cv::Point2f> velocities; | |
| 37 | |
| 38 std::vector<float> displacementDistances; | |
| 39 | |
| 40 void computeMotionData(const int& frameNum); | |
| 41 | |
| 42 }; | |
| 43 | |
| 44 typedef boost::shared_ptr<FeatureTrajectory> FeatureTrajectoryPtr; | |
| 45 | |
| 46 // class MovingObject {} | |
| 47 // roadUserType, group of features | |
| 48 | |
| 49 #endif |
