24 #include <opencv2/core/core.hpp> 25 #include <opencv2/highgui/highgui.hpp> 35 mIm = cv::Mat(480,640,CV_8UC3, cv::Scalar(0,0,0));
41 vector<cv::KeyPoint> vIniKeys;
43 vector<cv::KeyPoint> vCurrentKeys;
44 vector<bool> vbVO, vbMap;
49 unique_lock<mutex> lock(
mMutex);
80 for(
unsigned int i=0; i<vMatches.size(); i++)
84 cv::line(im,vIniKeys[i].pt,vCurrentKeys[vMatches[i]].pt,
94 const int n = vCurrentKeys.size();
97 if(vbVO[i] || vbMap[i])
100 pt1.x=vCurrentKeys[i].pt.x-r;
101 pt1.y=vCurrentKeys[i].pt.y-r;
102 pt2.x=vCurrentKeys[i].pt.x+r;
103 pt2.y=vCurrentKeys[i].pt.y+r;
108 cv::rectangle(im,pt1,pt2,cv::Scalar(0,255,0));
109 cv::circle(im,vCurrentKeys[i].pt,2,cv::Scalar(0,255,0),-1);
114 cv::rectangle(im,pt1,pt2,cv::Scalar(255,0,0));
115 cv::circle(im,vCurrentKeys[i].pt,2,cv::Scalar(255,0,0),-1);
133 s <<
" WAITING FOR IMAGES";
135 s <<
" TRYING TO INITIALIZE ";
141 s <<
"LOCALIZATION | ";
144 s <<
"KFs: " << nKFs <<
", MPs: " << nMPs <<
", Matches: " <<
mnTracked;
150 s <<
" TRACK LOST. TRYING TO RELOCALIZE ";
154 s <<
" LOADING ORB VOCABULARY. PLEASE WAIT...";
158 cv::Size textSize = cv::getTextSize(s.str(),cv::FONT_HERSHEY_PLAIN,1,1,&baseline);
160 imText = cv::Mat(im.rows+textSize.height+10,im.cols,im.type());
161 im.copyTo(imText.rowRange(0,im.rows).colRange(0,im.cols));
162 imText.rowRange(im.rows,imText.rows) = cv::Mat::zeros(textSize.height+10,im.cols,im.type());
163 cv::putText(imText,s.str(),cv::Point(5,imText.rows-5),cv::FONT_HERSHEY_PLAIN,1,cv::Scalar(255,255,255),1,8);
169 unique_lock<mutex> lock(
mMutex);
173 mvbVO = vector<bool>(
N,
false);
174 mvbMap = vector<bool>(
N,
false);
std::vector< MapPoint * > mvpMapPoints
vector< cv::KeyPoint > mvIniKeys
std::vector< int > mvIniMatches
std::vector< bool > mvbOutlier
long unsigned KeyFramesInMap()
vector< cv::KeyPoint > mvCurrentKeys
CvImagePtr cvtColor(const CvImageConstPtr &source, const std::string &encoding)
long unsigned int MapPointsInMap()
vector< int > mvIniMatches
std::vector< cv::KeyPoint > mvKeys
eTrackingState mLastProcessedState
void Update(Tracking *pTracker)
void DrawTextInfo(cv::Mat &im, int nState, cv::Mat &imText)