| 123456789101112131415161718192021222324252627282930313233 |
- #pragma once
- #include <opencv2/opencv.hpp>
- #include <opencv2/dnn.hpp>
- //这个Worker只负责从摄像头读取图像数据,不负责进行任何处理
- class CVideoCapture
- {
- public:
- CVideoCapture();
- ~CVideoCapture();
- static CVideoCapture * GetInstance()
- {
- static CVideoCapture instance;
- return &instance;
- }
- void InitVideoCapture();
- bool GetFrame(cv::Mat& frame);
- private:
- int findAvailableCamera();
- private:
- bool m_is_video_capture_open = false;
- cv::VideoCapture m_cap;
- std::mutex m_init_mutex;
- };
|