Mercurial Hosting > traffic-intelligence
comparison c/test_feature.cpp @ 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 | f0f800b95765 |
comparison
equal
deleted
inserted
replaced
200:0a27fa343257 | 201:f7ddfc4aeb1e |
---|---|
1 #define BOOST_TEST_MODULE traffic intelligence | 1 #define BOOST_TEST_MODULE traffic intelligence |
2 | |
3 #include "Motion.hpp" | |
4 #include "testutils.hpp" | |
5 | |
6 #include "opencv2/core/core.hpp" | |
2 | 7 |
3 #include <boost/test/unit_test.hpp> | 8 #include <boost/test/unit_test.hpp> |
4 #include <boost/test/floating_point_comparison.hpp> | 9 #include <boost/test/floating_point_comparison.hpp> |
5 | 10 |
6 using namespace std; | 11 using namespace std; |
12 using namespace cv; | |
7 | 13 |
8 BOOST_AUTO_TEST_SUITE(test_feature) | 14 BOOST_AUTO_TEST_SUITE(test_feature) |
9 | 15 |
10 BOOST_AUTO_TEST_CASE(feature_stationary) { | 16 BOOST_AUTO_TEST_CASE(feature_similarity) { |
11 int i=5; | 17 FeatureTrajectoryPtr ft1 = createFeatureTrajectory(1, 10, 20, Point2f(1,1), Point2f(0, 1)); |
12 BOOST_CHECK_EQUAL(i, 5); | 18 FeatureTrajectoryPtr ft2 = createFeatureTrajectory(2, 10, 20, Point2f(2,1), Point2f(0, 1)); |
19 | |
20 BOOST_CHECK(!ft1->minMaxSimilarity(*ft2, 10, 20, 0.5, 0.1)); | |
21 BOOST_CHECK(ft1->minMaxSimilarity(*ft2, 10, 20, 1, 0.1)); | |
22 | |
23 ft2 = createFeatureTrajectory(2, 10, 19, Point2f(1,1), Point2f(0, 1)); | |
24 Mat homography; | |
25 ft2->addPoint(20, Point2f(1,11.5), homography); | |
26 | |
27 BOOST_CHECK(!ft1->minMaxSimilarity(*ft2, 10, 20, 0, 0.4)); | |
28 BOOST_CHECK(ft1->minMaxSimilarity(*ft2, 10, 20, 0, 0.5)); | |
13 } | 29 } |
14 | 30 |
15 BOOST_AUTO_TEST_SUITE_END() | 31 BOOST_AUTO_TEST_SUITE_END() |