123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- #ifndef TwoViewReconstruction_H
- #define TwoViewReconstruction_H
- #include <opencv2/opencv.hpp>
- #include <Eigen/Core>
- #include <unordered_set>
- #include <sophus/se3.hpp>
- namespace ORB_SLAM3
- {
- class TwoViewReconstruction
- {
- typedef std::pair<int,int> Match;
- public:
- EIGEN_MAKE_ALIGNED_OPERATOR_NEW
-
- TwoViewReconstruction(const Eigen::Matrix3f& k, float sigma = 1.0, int iterations = 200);
-
-
- bool Reconstruct(const std::vector<cv::KeyPoint>& vKeys1, const std::vector<cv::KeyPoint>& vKeys2, const std::vector<int> &vMatches12,
- Sophus::SE3f &T21, std::vector<cv::Point3f> &vP3D, std::vector<bool> &vbTriangulated);
- private:
- void FindHomography(std::vector<bool> &vbMatchesInliers, float &score, Eigen::Matrix3f &H21);
- void FindFundamental(std::vector<bool> &vbInliers, float &score, Eigen::Matrix3f &F21);
- Eigen::Matrix3f ComputeH21(const std::vector<cv::Point2f> &vP1, const std::vector<cv::Point2f> &vP2);
- Eigen::Matrix3f ComputeF21(const std::vector<cv::Point2f> &vP1, const std::vector<cv::Point2f> &vP2);
- float CheckHomography(const Eigen::Matrix3f &H21, const Eigen::Matrix3f &H12, std::vector<bool> &vbMatchesInliers, float sigma);
- float CheckFundamental(const Eigen::Matrix3f &F21, std::vector<bool> &vbMatchesInliers, float sigma);
- bool ReconstructF(std::vector<bool> &vbMatchesInliers, Eigen::Matrix3f &F21, Eigen::Matrix3f &K,
- Sophus::SE3f &T21, std::vector<cv::Point3f> &vP3D, std::vector<bool> &vbTriangulated, float minParallax, int minTriangulated);
- bool ReconstructH(std::vector<bool> &vbMatchesInliers, Eigen::Matrix3f &H21, Eigen::Matrix3f &K,
- Sophus::SE3f &T21, std::vector<cv::Point3f> &vP3D,std:: vector<bool> &vbTriangulated, float minParallax, int minTriangulated);
- void Normalize(const std::vector<cv::KeyPoint> &vKeys, std::vector<cv::Point2f> &vNormalizedPoints, Eigen::Matrix3f &T);
- int CheckRT(const Eigen::Matrix3f &R, const Eigen::Vector3f &t, const std::vector<cv::KeyPoint> &vKeys1, const std::vector<cv::KeyPoint> &vKeys2,
- const std::vector<Match> &vMatches12, std::vector<bool> &vbMatchesInliers,
- const Eigen::Matrix3f &K, std::vector<cv::Point3f> &vP3D, float th2, std::vector<bool> &vbGood, float ¶llax);
- void DecomposeE(const Eigen::Matrix3f &E, Eigen::Matrix3f &R1, Eigen::Matrix3f &R2, Eigen::Vector3f &t);
-
- std::vector<cv::KeyPoint> mvKeys1;
-
- std::vector<cv::KeyPoint> mvKeys2;
-
- std::vector<Match> mvMatches12;
- std::vector<bool> mvbMatched1;
-
- Eigen::Matrix3f mK;
-
- float mSigma, mSigma2;
-
- int mMaxIterations;
-
- std::vector<std::vector<size_t> > mvSets;
- };
- }
- #endif
|