/** * This file is part of ORB-SLAM3 * * Copyright (C) 2017-2020 Carlos Campos, Richard Elvira, Juan J. Gómez Rodríguez, José M.M. Montiel and Juan D. Tardós, University of Zaragoza. * Copyright (C) 2014-2016 Raúl Mur-Artal, José M.M. Montiel and Juan D. Tardós, University of Zaragoza. * * ORB-SLAM3 is free software: you can redistribute it and/or modify it under the terms of the GNU General Public * License as published by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * ORB-SLAM3 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with ORB-SLAM3. * If not, see . */ #ifndef VIEWERAR_H #define VIEWERAR_H #include #include #include #include #include"../../../include/System.h" namespace ORB_SLAM3 { class Plane { public: Plane(const std::vector &vMPs, const cv::Mat &Tcw); Plane(const float &nx, const float &ny, const float &nz, const float &ox, const float &oy, const float &oz); void Recompute(); //normal cv::Mat n; //origin cv::Mat o; //arbitrary orientation along normal float rang; //transformation from world to the plane cv::Mat Tpw; pangolin::OpenGlMatrix glTpw; //MapPoints that define the plane std::vector mvMPs; //camera pose when the plane was first observed (to compute normal direction) cv::Mat mTcw, XC; }; class ViewerAR { public: ViewerAR(); void SetFPS(const float fps){ mFPS = fps; mT=1e3/fps; } void SetSLAM(ORB_SLAM3::System* pSystem){ mpSystem = pSystem; } // Main thread function. void Run(); void SetCameraCalibration(const float &fx_, const float &fy_, const float &cx_, const float &cy_){ fx = fx_; fy = fy_; cx = cx_; cy = cy_; } void SetImagePose(const cv::Mat &im, const cv::Mat &Tcw, const int &status, const std::vector &vKeys, const std::vector &vMPs); void GetImagePose(cv::Mat &im, cv::Mat &Tcw, int &status, std::vector &vKeys, std::vector &vMPs); private: //SLAM ORB_SLAM3::System* mpSystem; void PrintStatus(const int &status, const bool &bLocMode, cv::Mat &im); void AddTextToImage(const std::string &s, cv::Mat &im, const int r=0, const int g=0, const int b=0); void LoadCameraPose(const cv::Mat &Tcw); void DrawImageTexture(pangolin::GlTexture &imageTexture, cv::Mat &im); void DrawCube(const float &size, const float x=0, const float y=0, const float z=0); void DrawPlane(int ndivs, float ndivsize); void DrawPlane(Plane* pPlane, int ndivs, float ndivsize); void DrawTrackedPoints(const std::vector &vKeys, const std::vector &vMPs, cv::Mat &im); Plane* DetectPlane(const cv::Mat Tcw, const std::vector &vMPs, const int iterations=50); // frame rate float mFPS, mT; float fx,fy,cx,cy; // Last processed image and computed pose by the SLAM std::mutex mMutexPoseImage; cv::Mat mTcw; cv::Mat mImage; int mStatus; std::vector mvKeys; std::vector mvMPs; }; } #endif // VIEWERAR_H