timeStereoCamera.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 <time.h>
19 #include <iostream>
20 
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 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(point1, computed1, 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 }
Eigen::Vector3d Vector3
Definition: Vector.h:43
int n
Eigen::MatrixXd Matrix
Definition: base/Matrix.h:39
static Cal3_S2 K(500, 500, 0.1, 640/2, 480/2)
Definition: BFloat16.h:88
Rot3 is a 3D rotation represented as a rotation matrix if the preprocessor symbol GTSAM_USE_QUATERNIO...
Definition: Rot3.h:58
The most common 5DOF 3D->2D calibration, stereo version.
Definition: Cal3_S2Stereo.h:30
StereoPoint2 project(const Point3 &point) const
Project 3D point to StereoPoint2 (uL,uR,v)
std::shared_ptr< Cal3_S2Stereo > shared_ptr
Definition: Cal3_S2Stereo.h:38
static const Pose3 pose1(Rot3(), Point3(0, 1, 0.5))
traits
Definition: chartTesting.h:28
int main()
A Stereo Camera based on two Simple Cameras.
const Point3 point1(3.0, 4.0, 2.0)
Vector3 Point3
Definition: Point3.h:38
static const CalibratedCamera camera(kDefaultPose)


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:40:20