123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- #ifndef INITIALIZER_H
- #define INITIALIZER_H
- #include<opencv2/opencv.hpp>
- #include "Frame.h"
- #include <unordered_set>
- namespace ORB_SLAM3
- {
- class Map;
- class Initializer
- {
- typedef pair<int,int> Match;
- public:
-
- Initializer(const Frame &ReferenceFrame, float sigma = 1.0, int iterations = 200);
-
-
- bool Initialize(const Frame &CurrentFrame, const vector<int> &vMatches12, cv::Mat &R21,
- cv::Mat &t21, vector<cv::Point3f> &vP3D, vector<bool> &vbTriangulated);
- private:
- void FindHomography(vector<bool> &vbMatchesInliers, float &score, cv::Mat &H21);
- void FindFundamental(vector<bool> &vbInliers, float &score, cv::Mat &F21);
- cv::Mat ComputeH21(const vector<cv::Point2f> &vP1, const vector<cv::Point2f> &vP2);
- cv::Mat ComputeF21(const vector<cv::Point2f> &vP1, const vector<cv::Point2f> &vP2);
- float CheckHomography(const cv::Mat &H21, const cv::Mat &H12, vector<bool> &vbMatchesInliers, float sigma);
- float CheckFundamental(const cv::Mat &F21, vector<bool> &vbMatchesInliers, float sigma);
- bool ReconstructF(vector<bool> &vbMatchesInliers, cv::Mat &F21, cv::Mat &K,
- cv::Mat &R21, cv::Mat &t21, vector<cv::Point3f> &vP3D, vector<bool> &vbTriangulated, float minParallax, int minTriangulated);
- bool ReconstructH(vector<bool> &vbMatchesInliers, cv::Mat &H21, cv::Mat &K,
- cv::Mat &R21, cv::Mat &t21, vector<cv::Point3f> &vP3D, 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 vector<cv::KeyPoint> &vKeys, vector<cv::Point2f> &vNormalizedPoints, cv::Mat &T);
-
- int CheckRT(const cv::Mat &R, const cv::Mat &t, const vector<cv::KeyPoint> &vKeys1, const vector<cv::KeyPoint> &vKeys2,
- const vector<Match> &vMatches12, vector<bool> &vbInliers,
- const cv::Mat &K, vector<cv::Point3f> &vP3D, float th2, vector<bool> &vbGood, float ¶llax);
- void DecomposeE(const cv::Mat &E, cv::Mat &R1, cv::Mat &R2, cv::Mat &t);
-
- vector<cv::KeyPoint> mvKeys1;
-
- vector<cv::KeyPoint> mvKeys2;
-
- vector<Match> mvMatches12;
- vector<bool> mvbMatched1;
-
- cv::Mat mK;
-
- float mSigma, mSigma2;
-
- int mMaxIterations;
-
- vector<vector<size_t> > mvSets;
- GeometricCamera* mpCamera;
- };
- }
- #endif
|