Mercurial Hosting > traffic-intelligence
view include/Motion.hpp @ 141:6f10a227486c
modifications to get nframes option working on the command line
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Wed, 24 Aug 2011 01:34:27 -0400 |
parents | 47329bd16cc0 |
children | a3532db00c28 |
line wrap: on
line source
#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 has been inferior to minFeatureDisplacement bool smallDisplacement(const unsigned int& nDisplacements, const float& minTotalFeatureDisplacement) const; /// indicates whether the last two displacements are smooth (limited acceleration and angle) bool motionSmooth(const int& accelerationBound, const int& deviationBound) const; void addPoint(const int& frameNum, const cv::Point2f& p); void shorten(void); 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; /** one fewer velocity than position v_n = p_n+1 - p_n*/ Trajectory<cv::Point2f> velocities; /// norms of velocities for feature constraints, one fewer positions than positions std::vector<float> displacementDistances; void computeMotionData(const int& frameNum); }; typedef boost::shared_ptr<FeatureTrajectory> FeatureTrajectoryPtr; // class MovingObject {} // roadUserType, group of features #endif