-
Notifications
You must be signed in to change notification settings - Fork 1
/
StereoCamera.h
81 lines (65 loc) · 2.01 KB
/
StereoCamera.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#ifndef __STEREO__CAMERA_H
#define __STEREO__CAMERA_H
#include "VideoSource.h"
#include <cmath>
#include "HelperFunctions.h"
#include <TooN/se3.h>
#include <TooN/TooN.h>
using namespace TooN;
#include <cvd/vector_image_ref.h>
#include <gvars3/gvars3.h>
#include <opencv/cv.h>
#include <opencv/highgui.h>
#include "constants.h"
#include "ATANCamera.h"
#include <TooN/LU.h>
#include <TooN/SVD.h>
class StereoCamera{
public:
StereoCamera(string sLeftName, string sRightName);
StereoCamera();
inline ATANCamera &Left(){ return mLeftCam; };
inline ATANCamera &Right(){ return mRightCam; };
inline SE3<> GetRelativePose(){ return RelativePose; }
Vector<3> UnProjectToWorld(Vector<2> v2A, Vector<2> v2B, const SE3<> &CameraPose);
Vector<3> UnProjectToWorldFromPixels(Vector<2> v2A, Vector<2> v2B, const SE3<> &CameraPose);
inline Vector<2> UnProjectToLeft(Vector<2> v2){
return mLeftCam.UnProject(v2);
}
inline Vector<2> UnProjectToLeft(CVD::ImageRef ir){
return mLeftCam.UnProject(vec(ir));
}
inline Vector<2> UnProjectToRight(Vector<2> v2){
return mRightCam.UnProject(v2);
}
inline Vector<2> UnProjectToRight(CVD::ImageRef ir){
return mRightCam.UnProject(vec(ir));
}
inline Vector<2> ProjectToLeft(Vector<2> v2){
return mLeftCam.Project(v2);
}
inline Vector<2> ProjectToLeft(CVD::ImageRef ir){
return mLeftCam.Project(vec(ir));
}
inline Vector<2> ProjectToRight(Vector<2> v2){
return mRightCam.Project(v2);
}
inline Vector<2> ProjectToRight(CVD::ImageRef ir){
return mRightCam.Project(vec(ir));
}
inline Vector<3> GetEpipolarLine(Vector<2> v2){
return FundamentalMatrix * unproject(v2);
}
inline Vector<3> GetEpipolarLine(CVD::ImageRef ir){
return GetEpipolarLine(vec(ir));
}
static const Vector<6> mvDefaultExtrinsicVector;
protected:
ATANCamera mLeftCam;
ATANCamera mRightCam;
GVars3::gvar3<Vector<6> >mgvvRelativePose_Vector;
SE3<> RelativePose;
Matrix<3> EssentialMatrix;
Matrix<3> FundamentalMatrix;
};
#endif