annotate include/testutils.hpp @ 201:f7ddfc4aeb1e

added tests for graphs
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Mon, 05 Mar 2012 01:52:56 -0500
parents aeab0b88c9b6
children 045d05cef9d0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
196
aeab0b88c9b6 began testing of FeatureGraph
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff changeset
1 #ifndef TEST_UTILS_HPP
aeab0b88c9b6 began testing of FeatureGraph
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff changeset
2 #define TEST_UTILS_HPP
aeab0b88c9b6 began testing of FeatureGraph
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff changeset
3
aeab0b88c9b6 began testing of FeatureGraph
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff changeset
4 #include "Motion.hpp"
aeab0b88c9b6 began testing of FeatureGraph
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff changeset
5
aeab0b88c9b6 began testing of FeatureGraph
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff changeset
6 #include "opencv2/core/core.hpp"
aeab0b88c9b6 began testing of FeatureGraph
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff changeset
7
aeab0b88c9b6 began testing of FeatureGraph
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff changeset
8 #include <boost/shared_ptr.hpp>
aeab0b88c9b6 began testing of FeatureGraph
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff changeset
9
201
f7ddfc4aeb1e added tests for graphs
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 196
diff changeset
10 inline boost::shared_ptr<FeatureTrajectory> createFeatureTrajectory(const unsigned int& id, const unsigned int& firstInstant, const unsigned int& lastInstant, const cv::Point2f& firstPosition, const cv::Point2f& velocity) {
196
aeab0b88c9b6 began testing of FeatureGraph
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff changeset
11 cv::Mat emptyHomography;
aeab0b88c9b6 began testing of FeatureGraph
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff changeset
12 boost::shared_ptr<FeatureTrajectory> t = boost::shared_ptr<FeatureTrajectory>(new FeatureTrajectory(firstInstant, firstPosition, emptyHomography));
aeab0b88c9b6 began testing of FeatureGraph
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff changeset
13 cv::Point2f p = firstPosition;
201
f7ddfc4aeb1e added tests for graphs
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 196
diff changeset
14 for (unsigned int i=firstInstant+1; i<=lastInstant; ++i) {
196
aeab0b88c9b6 began testing of FeatureGraph
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff changeset
15 p = p+velocity;
aeab0b88c9b6 began testing of FeatureGraph
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff changeset
16 t->addPoint(i, p, emptyHomography);
aeab0b88c9b6 began testing of FeatureGraph
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff changeset
17 }
201
f7ddfc4aeb1e added tests for graphs
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 196
diff changeset
18 t->setId(id);
196
aeab0b88c9b6 began testing of FeatureGraph
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff changeset
19 return t;
aeab0b88c9b6 began testing of FeatureGraph
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff changeset
20 }
aeab0b88c9b6 began testing of FeatureGraph
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff changeset
21
aeab0b88c9b6 began testing of FeatureGraph
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff changeset
22 #endif