1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- #include <opencv2/opencv.hpp>
- #include <opencv2/core.hpp>
- #include <opencv2/videoio.hpp>
- #include <queue>
- #include <mutex>
- #define BUFFER_SIZE 50
- typedef std::pair<cv::Mat, double> 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<InfraredImagePair> m_infraredImageTimestampBuffer;
- cv::Mat m_infraredImage;
- // a mutex
- std::mutex m_mutex;
- // a switch to control the thread
- bool m_getInfraredImageThreadSwitch;
- };
-
|