-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelative_pose_estimate.cpp
More file actions
57 lines (45 loc) · 1008 Bytes
/
relative_pose_estimate.cpp
File metadata and controls
57 lines (45 loc) · 1008 Bytes
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
#include "relative_pose_estimate.h"
#include "opencv2/core/eigen.hpp"
RelativePoseEstimate::RelativePoseEstimate()
: R_{}
, t_{}
, inliers_{}
, num_passed_{0}
{
}
RelativePoseEstimate::RelativePoseEstimate(const cv::Matx33d& R, const cv::Vec3d& t, const FrameToFrameCorrespondences& inliers, int num_passed)
: R_{R}
, t_{t}
, inliers_{inliers}
, num_passed_{num_passed}
{
Eigen::Matrix3d R_eig;
cv::cv2eigen(R_, R_eig);
Eigen::Vector3d t_eig;
cv::cv2eigen(t_, t_eig);
pose_ = Sophus::SE3d{R_eig, t_eig};
}
bool RelativePoseEstimate::isFound() const
{
return num_passed_ > 0;
}
const Sophus::SE3d& RelativePoseEstimate::pose() const
{
return pose_;
}
const cv::Matx33d& RelativePoseEstimate::R() const
{
return R_;
}
const cv::Vec3d& RelativePoseEstimate::t() const
{
return t_;
}
const FrameToFrameCorrespondences& RelativePoseEstimate::inliers() const
{
return inliers_;
}
int RelativePoseEstimate::numPassed() const
{
return num_passed_;
}