1/* ----------------------------------------------------------------------------
2
3 * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4 * Atlanta, Georgia 30332-0415
5 * All Rights Reserved
6 * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7
8 * See LICENSE for the license information
9
10 * -------------------------------------------------------------------------- */
11
12/**
13 * @file timeStereoCamera.cpp
14 * @brief time StereoCamera derivatives
15 * @author Frank Dellaert
16 */
17
18#include <time.h>
19#include <iostream>
20
21#include <gtsam/geometry/StereoCamera.h>
22
23using namespace std;
24using namespace gtsam;
25
26int main()
27{
28 int n = 100000;
29
30 const Pose3 pose1(Rot3(Vector3(1, -1, -1).asDiagonal()), Point3(0, 0, 0.5));
31
32 const Cal3_S2Stereo::shared_ptr K(new Cal3_S2Stereo(1500, 1500, 0, 320, 240, 0.5));
33 const StereoCamera camera(pose1, K);
34 const Point3 point1(-0.08,-0.08, 0.0);
35
36 Matrix computed1, computed2;
37 long timeLog = clock();
38 for(int i = 0; i < n; i++)
39 camera.project(point: point1, H1: computed1, H2: computed2);
40 long timeLog2 = clock();
41 double seconds = (double)(timeLog2-timeLog)/CLOCKS_PER_SEC;
42 cout << ((double)n/seconds) << " calls/second" << endl;
43 cout << ((double)seconds*1000000/n) << " musecs/call" << endl;
44
45 return 0;
46}
47