#ifndef HXVIDEODEVICE_H #define HXVIDEODEVICE_H #include #include #include #include #include #include "HxTaskDispatch.h" #include using namespace cv; using namespace std; #if ALGORITHM_ENABLE #include "rkrga/rga.h" #include "rkrga/im2d.hpp" #endif class VideoDevice : public QThread { Q_OBJECT public: VideoDevice(void); void set(int type, QString address); void set(int type, QString address, BsdWarnRegion region); void set(bool status); QString snap(void); QString build_image(int id); QString build_video(int id); void test(void); private: vector compress(Mat frame, int quality); QString snap(Mat frame); QString snap(vector data); void video_frame_queue_check(); void read_frame(); protected: void run() override; private: int MvGetFrameBlkInfo(VideoFrameDataInfo *pImageDataInfo); int MvReleaseFrameBlkInfo(VideoFrameDataInfo *pImageDataInfo); int MvConvertImage(VideoFrameDataInfo *pSrcImageDataInfo, VideoFrameDataInfo *pDstImageDataInfo); private: int type; int frame_id; int frame_fps; QString address; bool detection_status = true; QMap> video_frames_string; QMutex frame_mutex; Mat video_frame; VideoCapture video_capture; VideoFrameDataInfo detect_frame_buffer; VideoFrameDataInfo bgr_frame_buffer; }; #endif // HXVIDEODEVICE_H