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 
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 }
gtsam::Matrix
Eigen::MatrixXd Matrix
Definition: base/Matrix.h:39
gtsam::Vector3
Eigen::Vector3d Vector3
Definition: Vector.h:43
CalibratedCamera.h
Calibrated camera for which only pose is unknown.
Point2.h
2D Point
n
int n
Definition: BiCGSTAB_simple.cpp:1
gtsam::Rot3
Rot3 is a 3D rotation represented as a rotation matrix if the preprocessor symbol GTSAM_USE_QUATERNIO...
Definition: Rot3.h:58
gtsam::Pose3
Definition: Pose3.h:37
gtsam::CalibratedCamera
Definition: CalibratedCamera.h:251
gtsam
traits
Definition: SFMdata.h:40
pose1
static const Pose3 pose1(Rot3(), Point3(0, 1, 0.5))
std
Definition: BFloat16.h:88
main
int main()
Definition: timeCalibratedCamera.cpp:26
gtsam::Point3
Vector3 Point3
Definition: Point3.h:38
point1
const Point3 point1(3.0, 4.0, 2.0)
camera
static const CalibratedCamera camera(kDefaultPose)
i
int i
Definition: BiCGSTAB_step_by_step.cpp:9
gtsam::CalibratedCamera::project
Point2 project(const Point3 &point, OptionalJacobian< 2, 6 > Dcamera={}, OptionalJacobian< 2, 3 > Dpoint={}) const
Definition: CalibratedCamera.cpp:188


gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:42:06