timeCalibratedCamera.cpp
Go to the documentation of this file.
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 
18 #include <gtsam/geometry/Point2.h>
20 #include <ctime>
21 #include <iostream>
22 
23 using namespace std;
24 using namespace gtsam;
25 
26 int 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 CalibratedCamera camera(pose1);
33  const Point3 point1(-0.08,-0.08, 0.0);
34 
35  // Aug 8, iMac 3.06GHz Core i3
36  // 371153 calls/second
37  // 2.69431 musecs/call
38  // AFTER collapse:
39  // 1.10733e+06 calls/second
40  // 0.90307 musecs/call
41  {
42  Matrix computed1, computed2;
43  long timeLog = clock();
44  for(int i = 0; i < n; i++)
45  camera.project(point1, computed1, computed2);
46  long timeLog2 = clock();
47  double seconds = (double)(timeLog2-timeLog)/CLOCKS_PER_SEC;
48  cout << ((double)n/seconds) << " calls/second" << endl;
49  cout << ((double)seconds*1000000/n) << " musecs/call" << endl;
50  }
51 
52  return 0;
53 }
Eigen::Vector3d Vector3
Definition: Vector.h:43
int n
Eigen::MatrixXd Matrix
Definition: base/Matrix.h:43
Definition: Half.h:150
Point2 project(const Point3 &point, OptionalJacobian< 2, 6 > Dcamera=boost::none, OptionalJacobian< 2, 3 > Dpoint=boost::none) const
static const Pose3 pose1(Rot3(), Point3(0, 1, 0.5))
Calibrated camera for which only pose is unknown.
traits
Definition: chartTesting.h:28
const Point3 point1(3.0, 4.0, 2.0)
Vector3 Point3
Definition: Point3.h:35
static const CalibratedCamera camera(kDefaultPose)
2D Point
int main()


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:50:29