Mercurial Hosting > traffic-intelligence
comparison include/Motion.hpp @ 176:9323427aa0a3
changed positions and velocities to shared pointers and renamed methods
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Thu, 27 Oct 2011 13:56:46 -0400 |
parents | 50964af05a80 |
children | ae2286b1a3fd |
comparison
equal
deleted
inserted
replaced
175:a234a5e818f3 | 176:9323427aa0a3 |
---|---|
6 #include <boost/shared_ptr.hpp> | 6 #include <boost/shared_ptr.hpp> |
7 #include <boost/graph/adjacency_list.hpp> | 7 #include <boost/graph/adjacency_list.hpp> |
8 | 8 |
9 template<typename T> class TrajectoryDBAccess; | 9 template<typename T> class TrajectoryDBAccess; |
10 | 10 |
11 typedef boost::shared_ptr<TrajectoryPoint2f> TrajectoryPoint2fPtr; | |
12 | |
11 /** Class for feature data | 13 /** Class for feature data |
12 positions, velocities and other statistics to evaluate their quality | 14 positions, velocities and other statistics to evaluate their quality |
13 before saving. */ | 15 before saving. */ |
14 class FeatureTrajectory { | 16 class FeatureTrajectory { |
15 public: | 17 public: |
16 FeatureTrajectory(const int& frameNum, const cv::Point2f& p, const cv::Mat& homography); | 18 FeatureTrajectory(const int& frameNum, const cv::Point2f& p, const cv::Mat& homography); |
17 | 19 |
18 unsigned int length(void) const { return positions.size();} | 20 unsigned int length(void) const { return positions->size();} |
19 | 21 |
20 void setId(const unsigned int& id) { positions.setId(id);velocities.setId(id);} | 22 void setId(const unsigned int& id) { positions->setId(id);velocities->setId(id);} |
21 | 23 |
22 void setLost(void) { lost = true;} | 24 void setLost(void) { lost = true;} |
23 bool isLost(void) { return lost;} | 25 bool isLost(void) { return lost;} |
24 | 26 |
25 /// indicates whether the sum of the last nDisplacements displacements has been inferior to minFeatureDisplacement | 27 /// indicates whether the sum of the last nDisplacements displacements has been inferior to minFeatureDisplacement |
26 bool smallDisplacement(const unsigned int& nDisplacements, const float& minTotalFeatureDisplacement) const; | 28 bool isDisplacementSmall(const unsigned int& nDisplacements, const float& minTotalFeatureDisplacement) const; |
27 | 29 |
28 /// indicates whether the last two displacements are smooth (limited acceleration and angle) | 30 /// indicates whether the last two displacements are smooth (limited acceleration and angle) |
29 bool motionSmooth(const int& accelerationBound, const int& deviationBound) const; | 31 bool isMotionSmooth(const int& accelerationBound, const int& deviationBound) const; |
30 | 32 |
31 void addPoint(const int& frameNum, const cv::Point2f& p, const cv::Mat& homography); | 33 void addPoint(const int& frameNum, const cv::Point2f& p, const cv::Mat& homography); |
32 | 34 |
33 void shorten(void); | 35 void shorten(void); |
34 | 36 |
38 void draw(cv::Mat& img, const cv::Mat& homography, const cv::Scalar& color) const; | 40 void draw(cv::Mat& img, const cv::Mat& homography, const cv::Scalar& color) const; |
39 #endif | 41 #endif |
40 | 42 |
41 protected: | 43 protected: |
42 bool lost; | 44 bool lost; |
43 Trajectory<cv::Point2f> positions; | 45 TrajectoryPoint2fPtr positions; |
44 /** one fewer velocity than position | 46 /** one fewer velocity than position |
45 v_n = p_n+1 - p_n*/ | 47 v_n = p_n+1 - p_n*/ |
46 Trajectory<cv::Point2f> velocities; | 48 TrajectoryPoint2fPtr velocities; |
47 | 49 |
48 /// norms of velocities for feature constraints, one fewer positions than positions | 50 /// norms of velocities for feature constraints, one fewer positions than positions |
49 std::vector<float> displacementDistances; | 51 std::vector<float> displacementDistances; |
50 | 52 |
51 void computeMotionData(const int& frameNum); | 53 void computeMotionData(const int& frameNum); |