diff options
author | Martin Miller | 2017-03-27 12:55:09 -0500 |
---|---|---|
committer | Martin Miller | 2017-03-27 12:55:09 -0500 |
commit | b08113d11d181cbcca9103d8f67c60b9905ec972 (patch) | |
tree | e9daad9b0c303ef951f02b2a9288f98fd8a516bf /tests/test_camera.cpp | |
parent | d119b2c7ca16b8375abfeb5c1efd8e98047be5ad (diff) | |
download | refslam-b08113d11d181cbcca9103d8f67c60b9905ec972.zip refslam-b08113d11d181cbcca9103d8f67c60b9905ec972.tar.gz |
Add test_camera
Diffstat (limited to 'tests/test_camera.cpp')
-rw-r--r-- | tests/test_camera.cpp | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/tests/test_camera.cpp b/tests/test_camera.cpp new file mode 100644 index 0000000..f864f20 --- /dev/null +++ b/tests/test_camera.cpp @@ -0,0 +1,54 @@ +/* + * ===================================================================================== + * + * Filename: test_camera.cpp + * + * Description: Tests the methods of the Camera class + * + * Version: 1.0 + * Created: 03/27/2017 12:19:51 PM + * Revision: none + * Compiler: gcc + * + * Author: Martin Miller (MHM), miller7@illinois.edu + * Organization: Aerospace Robotics and Controls Lab (ARC) + * + * ===================================================================================== + */ + + +#include <iostream> +#include "camera.h" +#define TOL 1e-12 + +using std::cout; +using std::cerr; +using std::endl; +using namespace Eigen; + +int main(int argc, char **argv) +{ + Camera cam("left.yml"); + MatrixXd k; + k = cam.K(); + assert(k.cols()==3); + assert(k.rows()==3); + + k = cam.K4(); + assert(k.cols()==4); + assert(k.rows()==4); + + Vector3d xi,xb; + // Feature 114 0000009362.bmp.txt + // from pyslam: [[ 0.9237706 ] [-0.36529118] [-0.11493579]] + Vector3d xb0; + xb0 << 0.9237706, -0.36529118, -0.11493579; + xi << 236,216,1; + xb = cam.img2body(xi); + xb -= xb0; + assert(abs(xb[0])<TOL); + assert(abs(xb[1])<TOL); + assert(abs(xb[2])<TOL); + return 0; +} + |