Mercurial Hosting > traffic-intelligence
annotate include/testutils.hpp @ 1211:a095d4fbb2ea
work in progress
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Tue, 02 May 2023 07:12:26 -0400 |
parents | 045d05cef9d0 |
children |
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 |
654
045d05cef9d0
updating to c++11 capabilities
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
201
diff
changeset
|
8 inline std::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
|
9 cv::Mat emptyHomography; |
654
045d05cef9d0
updating to c++11 capabilities
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
201
diff
changeset
|
10 std::shared_ptr<FeatureTrajectory> t = std::shared_ptr<FeatureTrajectory>(new FeatureTrajectory(firstInstant, firstPosition, emptyHomography)); |
196
aeab0b88c9b6
began testing of FeatureGraph
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
11 cv::Point2f p = firstPosition; |
201
f7ddfc4aeb1e
added tests for graphs
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
196
diff
changeset
|
12 for (unsigned int i=firstInstant+1; i<=lastInstant; ++i) { |
196
aeab0b88c9b6
began testing of FeatureGraph
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
13 p = p+velocity; |
aeab0b88c9b6
began testing of FeatureGraph
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
14 t->addPoint(i, p, emptyHomography); |
aeab0b88c9b6
began testing of FeatureGraph
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
15 } |
201
f7ddfc4aeb1e
added tests for graphs
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
196
diff
changeset
|
16 t->setId(id); |
196
aeab0b88c9b6
began testing of FeatureGraph
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
17 return t; |
aeab0b88c9b6
began testing of FeatureGraph
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
18 } |
aeab0b88c9b6
began testing of FeatureGraph
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
19 |
aeab0b88c9b6
began testing of FeatureGraph
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
20 #endif |