123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- #ifndef TwoViewReconstruction_H
- #define TwoViewReconstruction_H
- #include<opencv2/opencv.hpp>
- #include <unordered_set>
- namespace ORB_SLAM3
- {
- class TwoViewReconstruction
- {
- typedef std::pair<int,int> Match;
- public:
-
- TwoViewReconstruction(cv::Mat& 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,
- cv::Mat &R21, cv::Mat &t21, std::vector<cv::Point3f> &vP3D, std::vector<bool> &vbTriangulated);
- private:
- void FindHomography(std::vector<bool> &vbMatchesInliers, float &score, cv::Mat &H21);
- void FindFundamental(std::vector<bool> &vbInliers, float &score, cv::Mat &F21);
- cv::Mat ComputeH21(const std::vector<cv::Point2f> &vP1, const std::vector<cv::Point2f> &vP2);
- cv::Mat ComputeF21(const std::vector<cv::Point2f> &vP1, const std::vector<cv::Point2f> &vP2);
- float CheckHomography(const cv::Mat &H21, const cv::Mat &H12, std::vector<bool> &vbMatchesInliers, float sigma);
- float CheckFundamental(const cv::Mat &F21, std::vector<bool> &vbMatchesInliers, float sigma);
- bool ReconstructF(std::vector<bool> &vbMatchesInliers, cv::Mat &F21, cv::Mat &K,
- cv::Mat &R21, cv::Mat &t21, std::vector<cv::Point3f> &vP3D, std::vector<bool> &vbTriangulated, float minParallax, int minTriangulated);
- bool ReconstructH(std::vector<bool> &vbMatchesInliers, cv::Mat &H21, cv::Mat &K,
- cv::Mat &R21, cv::Mat &t21, std::vector<cv::Point3f> &vP3D,std:: vector<bool> &vbTriangulated, float minParallax, int minTriangulated);
- void Triangulate(const cv::KeyPoint &kp1, const cv::KeyPoint &kp2, const cv::Mat &P1, const cv::Mat &P2, cv::Mat &x3D);
- void Normalize(const std::vector<cv::KeyPoint> &vKeys, std::vector<cv::Point2f> &vNormalizedPoints, cv::Mat &T);
- int CheckRT(const cv::Mat &R, const cv::Mat &t, const std::vector<cv::KeyPoint> &vKeys1, const std::vector<cv::KeyPoint> &vKeys2,
- const std::vector<Match> &vMatches12, std::vector<bool> &vbInliers,
- const cv::Mat &K, std::vector<cv::Point3f> &vP3D, float th2, std::vector<bool> &vbGood, float ¶llax);
- void DecomposeE(const cv::Mat &E, cv::Mat &R1, cv::Mat &R2, cv::Mat &t);
-
- std::vector<cv::KeyPoint> mvKeys1;
-
- std::vector<cv::KeyPoint> mvKeys2;
-
- std::vector<Match> mvMatches12;
- std::vector<bool> mvbMatched1;
-
- cv::Mat mK;
-
- float mSigma, mSigma2;
-
- int mMaxIterations;
-
- std::vector<std::vector<size_t> > mvSets;
- };
- }
- #endif
|