NDEVR
API Documentation
TwoViewReconstruction.h
1#pragma once
2#include "Base/Headers/Buffer.hpp"
3#include <opencv2/opencv.hpp>
4#include <opencv2/core/core.hpp>
5#include <opencv2/imgproc/imgproc.hpp>
6#include <opencv2/features2d/features2d.hpp>
7#include <OrbSLAM/Thirdparty/Sophus/sophus/se3.hpp>
8#include <Eigen/Core>
9#include "Base/Headers/Buffer.hpp"
10namespace NDEVR
11{
12
19 {
20 typedef std::pair<uint04, uint04> Match;
21
22 public:
23 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
29 TwoViewReconstruction(const Eigen::Matrix3f& k, float sigma = 1.0, uint04 iterations = 200U);
30
40 bool Reconstruct(const PrimitiveAlignedBuffer<cv::KeyPoint, 32>& vKeys1, const PrimitiveAlignedBuffer<cv::KeyPoint, 32>& vKeys2, const Buffer<uint04>& vMatches12,
41 Sophus::SE3f& T21, Buffer<cv::Point3f>& vP3D, Buffer<bool>& vbTriangulated);
42
43 private:
44
45 void FindHomography(Buffer<bool>& vbMatchesInliers, float& score, Eigen::Matrix3f& H21);
46 void FindFundamental(Buffer<bool>& vbInliers, float& score, Eigen::Matrix3f& F21);
47
48 Eigen::Matrix3f ComputeH21(const Buffer<cv::Point2f>& vP1, const Buffer<cv::Point2f>& vP2);
49 Eigen::Matrix3f ComputeF21(const Buffer<cv::Point2f>& vP1, const Buffer<cv::Point2f>& vP2);
50
51 float CheckHomography(const Eigen::Matrix3f& H21, const Eigen::Matrix3f& H12, Buffer<bool>& vbMatchesInliers, float sigma);
52
53 float CheckFundamental(const Eigen::Matrix3f& F21, Buffer<bool>& vbMatchesInliers, float sigma);
54
55 bool ReconstructF(Buffer<bool>& vbMatchesInliers, Eigen::Matrix3f& F21, Eigen::Matrix3f& K,
56 Sophus::SE3f& T21, Buffer<cv::Point3f>& vP3D, Buffer<bool>& vbTriangulated, float minParallax, uint04 minTriangulated);
57
58 bool ReconstructH(Buffer<bool>& vbMatchesInliers, Eigen::Matrix3f& H21, Eigen::Matrix3f& K,
59 Sophus::SE3f& T21, Buffer<cv::Point3f>& vP3D, Buffer<bool>& vbTriangulated, float minParallax, uint04 minTriangulated);
60
61 void Normalize(const PrimitiveAlignedBuffer<cv::KeyPoint, 32>& vKeys, Buffer<cv::Point2f>& vNormalizedPoints, Eigen::Matrix3f& T);
62
63
64 uint04 CheckRT(const Eigen::Matrix3f& R, const Eigen::Vector3f& t, const PrimitiveAlignedBuffer<cv::KeyPoint, 32>& vKeys1, const PrimitiveAlignedBuffer<cv::KeyPoint, 32>& vKeys2,
65 const Buffer<Match>& vMatches12, Buffer<bool>& vbMatchesInliers,
66 const Eigen::Matrix3f& K, Buffer<cv::Point3f>& vP3D, float th2, Buffer<bool>& vbGood, float& parallax);
67
68 void DecomposeE(const Eigen::Matrix3f& E, Eigen::Matrix3f& R1, Eigen::Matrix3f& R2, Eigen::Vector3f& t);
69
70
71 // Keypoints from Reference Frame (Frame 1)
72 PrimitiveAlignedBuffer<cv::KeyPoint, 32> mvKeys1;
73
74 // Keypoints from Current Frame (Frame 2)
75 PrimitiveAlignedBuffer<cv::KeyPoint, 32> mvKeys2;
76
77 // Current Matches from Reference to Current
78 Buffer<Match> mvMatches12;
79 Buffer<bool> mvbMatched1;
80
81 // Calibration
82 Eigen::Matrix3f mK;
83
84 // Standard Deviation and Variance
85 float mSigma, mSigma2;
86
87 // Ransac max iterations
88 uint04 mMaxIterations;
89
90 // Ransac sets
91 Buffer<Buffer<uint04> > mvSets;
92
93 };
94
95}
The equivelent of std::vector but with a bit more control.
Definition Buffer.hpp:58
EIGEN_MAKE_ALIGNED_OPERATOR_NEW TwoViewReconstruction(const Eigen::Matrix3f &k, float sigma=1.0, uint04 iterations=200U)
Constructs the two-view reconstruction with a calibration matrix.
bool Reconstruct(const PrimitiveAlignedBuffer< cv::KeyPoint, 32 > &vKeys1, const PrimitiveAlignedBuffer< cv::KeyPoint, 32 > &vKeys2, const Buffer< uint04 > &vMatches12, Sophus::SE3f &T21, Buffer< cv::Point3f > &vP3D, Buffer< bool > &vbTriangulated)
Reconstructs geometry from two views.
The primary namespace for the NDEVR SDK.
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...