added unit tests

release/4.3a0
Kai Ni 2010-03-24 02:20:54 +00:00
parent 6c198809af
commit 81b6f5975b
1 changed files with 17 additions and 0 deletions

View File

@ -69,6 +69,23 @@ TEST( SimpleCamera, backproject)
CHECK(assert_equal( camera.backproject(Point2( 100, 100), 0.5), point4));
}
/* ************************************************************************* */
TEST( SimpleCamera, backproject2)
{
Point3 origin;
Rot3 rot(1., 0., 0., 0., 0., 1., 0., -1., 0.); // a camera looking down
SimpleCamera camera(K, Pose3(rot, origin));
Point3 actual = camera.backproject(Point2(), 1.);
Point3 expected(0., 1., 0.);
pair<Point2, bool> x = camera.projectSafe(expected);
CHECK(assert_equal(expected, actual));
CHECK(assert_equal(Point2(), x.first));
CHECK(x.second);
}
/* ************************************************************************* */
Point2 project2(const Pose3& pose, const Point3& point) {
return project(SimpleCamera(K,pose), point);