Mercurial > hg > nsaunier > traffic-intelligence
comparison include/Motion.hpp @ 200:0a27fa343257
added one test and cleaned the first and last instant mess
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Fri, 02 Mar 2012 19:32:54 -0500 |
| parents | aeab0b88c9b6 |
| children | f7ddfc4aeb1e |
comparison
equal
deleted
inserted
replaced
| 199:ca9d9104afba | 200:0a27fa343257 |
|---|---|
| 14 /** Class for feature data | 14 /** Class for feature data |
| 15 positions, velocities and other statistics to evaluate their quality | 15 positions, velocities and other statistics to evaluate their quality |
| 16 before saving. */ | 16 before saving. */ |
| 17 class FeatureTrajectory { | 17 class FeatureTrajectory { |
| 18 public: | 18 public: |
| 19 FeatureTrajectory(const int& frameNum, const cv::Point2f& p, const cv::Mat& homography); | 19 FeatureTrajectory(const unsigned int& frameNum, const cv::Point2f& p, const cv::Mat& homography); |
| 20 | 20 |
| 21 FeatureTrajectory(TrajectoryPoint2fPtr& _positions, TrajectoryPoint2fPtr& _velocities); | 21 FeatureTrajectory(TrajectoryPoint2fPtr& _positions, TrajectoryPoint2fPtr& _velocities); |
| 22 | 22 |
| 23 /** loads from database | 23 /** loads from database |
| 24 can be made generic for different list and blob */ | 24 can be made generic for different list and blob */ |
| 26 | 26 |
| 27 unsigned int length(void) const { return positions->size();} // cautious if not continuous: max-min+1 | 27 unsigned int length(void) const { return positions->size();} // cautious if not continuous: max-min+1 |
| 28 | 28 |
| 29 unsigned int getId(void) const { return positions->getId();} | 29 unsigned int getId(void) const { return positions->getId();} |
| 30 void setId(const unsigned int& id) { positions->setId(id);velocities->setId(id);} | 30 void setId(const unsigned int& id) { positions->setId(id);velocities->setId(id);} |
| 31 | |
| 32 void setLost(void) { lost = true;} | |
| 33 bool isLost(void) { return lost;} | |
| 34 | 31 |
| 35 unsigned int getFirstInstant(void) {return firstInstant;} | 32 unsigned int getFirstInstant(void) {return firstInstant;} |
| 36 unsigned int getLastInstant(void) {return lastInstant;} | 33 unsigned int getLastInstant(void) {return lastInstant;} |
| 37 | 34 |
| 38 //TrajectoryPoint2fPtr& getPositions(void) { return positions;} | 35 //TrajectoryPoint2fPtr& getPositions(void) { return positions;} |
| 45 bool isMotionSmooth(const int& accelerationBound, const int& deviationBound) const; | 42 bool isMotionSmooth(const int& accelerationBound, const int& deviationBound) const; |
| 46 | 43 |
| 47 /// computes the distance according to the Beymer et al. algorithm | 44 /// computes the distance according to the Beymer et al. algorithm |
| 48 bool minMaxSimilarity(const FeatureTrajectory& ft, const int& firstInstant, const int& lastInstant, const float& connectionDistance, const float& segmentationDistance); | 45 bool minMaxSimilarity(const FeatureTrajectory& ft, const int& firstInstant, const int& lastInstant, const float& connectionDistance, const float& segmentationDistance); |
| 49 | 46 |
| 50 void addPoint(const int& frameNum, const cv::Point2f& p, const cv::Mat& homography); | 47 void addPoint(const unsigned int& frameNum, const cv::Point2f& p, const cv::Mat& homography); |
| 51 | 48 |
| 52 void shorten(void); | 49 void shorten(void); |
| 53 | 50 |
| 54 void write(TrajectoryDBAccess<cv::Point2f>& trajectoryDB, const std::string& positionsTableName, const std::string& velocitiesTableName) const; | 51 void write(TrajectoryDBAccess<cv::Point2f>& trajectoryDB, const std::string& positionsTableName, const std::string& velocitiesTableName) const; |
| 55 | 52 |
| 58 #endif | 55 #endif |
| 59 | 56 |
| 60 friend std::stringstream& operator<<(std::stringstream& out, const FeatureTrajectory& ft); | 57 friend std::stringstream& operator<<(std::stringstream& out, const FeatureTrajectory& ft); |
| 61 | 58 |
| 62 protected: | 59 protected: |
| 63 bool lost; /// \todo remove | |
| 64 /// first frame number | 60 /// first frame number |
| 65 unsigned int firstInstant; | 61 unsigned int firstInstant; |
| 66 /// last frame number | 62 /// last frame number |
| 67 unsigned int lastInstant; | 63 unsigned int lastInstant; |
| 68 | 64 |
