#include #include #include #include #include #define BUFFER_SIZE 50 typedef std::pair InfraredImagePair; class InfraredManager { public: InfraredManager() = default; ~InfraredManager()= default; // init void init(std::string infraredStreamPath); // open the stream void openStream(); // a thread to get the infrared image static void getInfraredImageThread(InfraredManager* infraredManager); private: std::string m_infraredStreamPath; // infrared stream cv::VideoCapture m_infraredStream; // infrared stream width int m_infraredStreamWidth; // infrared stream height int m_infraredStreamHeight; // infrared stream fps int m_infraredStreamFps; // get the timestamp of the infrared image double m_infraredImageTimestamp; // a buffer to store the timestamp of the infrared image std::queue m_infraredImageTimestampBuffer; cv::Mat m_infraredImage; // a mutex std::mutex m_mutex; // a switch to control the thread bool m_getInfraredImageThreadSwitch; };