Mercurial Hosting > traffic-intelligence
diff include/testutils.hpp @ 196:aeab0b88c9b6
began testing of FeatureGraph
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Tue, 20 Dec 2011 00:31:37 -0500 |
parents | |
children | f7ddfc4aeb1e |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/testutils.hpp Tue Dec 20 00:31:37 2011 -0500 @@ -0,0 +1,21 @@ +#ifndef TEST_UTILS_HPP +#define TEST_UTILS_HPP + +#include "Motion.hpp" + +#include "opencv2/core/core.hpp" + +#include <boost/shared_ptr.hpp> + +inline boost::shared_ptr<FeatureTrajectory> createFeatureTrajectory(const int& firstInstant, const int& lastInstant, const cv::Point2f& firstPosition, const cv::Point2f& velocity) { + cv::Mat emptyHomography; + boost::shared_ptr<FeatureTrajectory> t = boost::shared_ptr<FeatureTrajectory>(new FeatureTrajectory(firstInstant, firstPosition, emptyHomography)); + cv::Point2f p = firstPosition; + for (int i=firstInstant+1; i<=lastInstant; ++i) { + p = p+velocity; + t->addPoint(i, p, emptyHomography); + } + return t; +} + +#endif