#ifndef COMMON_H_ #define COMMON_H_ #include #include "header.h" #include "opencv2/opencv.hpp" #include "opencv2/highgui/highgui.hpp" #include "MyAtomic.hpp" #include "../FFNvDecoder/DxDecoderWrap.h" #define IMG_CHANNELS 3 #define SCALE_OUT 10 //判断目标框初始位置时,在最小距离的基础上适当外扩 #define MAX_OBJ_COUNT 100 struct OBJ_KEY { int videoID; int objID; bool operator< (OBJ_KEY const& _A) const { if (videoID < _A.videoID) return true; if (videoID == _A.videoID) return objID < _A.objID; return false; } bool operator== (OBJ_KEY const& _A) const { if (videoID == _A.videoID && objID == _A.objID) return true; else return false; } }; struct FRAME_KEY { int videoID; unsigned int objID; bool operator< (FRAME_KEY const& _A) const { if (videoID < _A.videoID) return true; if (videoID == _A.videoID) return objID < _A.objID; return false; } bool operator== (FRAME_KEY const& _A) const { if (videoID == _A.videoID && objID == _A.objID) return true; else return false; } }; using SNAPSHOT_CALLBACK = std::function; using REALTIME_CALLBACK = std::function; using FINISH_CALLBACK = std::function; using OBJECT_INFO_CALLBACK = std::function; struct VideoHeightWidth{ double height; double width; }; enum TaskState { PLAY, PAUSE, FINISH, DECODEERROR //解码线程可能报错,报错之后直接结束掉该路解码 }; struct Task{ int taskID; const char *taskFileSource; TaskState taskState; DxDecoderWrap *taskTcuvid; DxGPUFrame task_algorithm_data; //����¿�ܲ���resize�Ĵ���������ʱ��backup��ԭͼ��С��ͼƬ�ͽ��㷨������� bool taskHasBackup; VideoHeightWidth taskHeightWidth; MyAtomic taskFrameCount; MyAtomic taskLastFrameCount; int taskTotalFrameCount; SNAPSHOT_CALLBACK taskObjCallbackFunc; REALTIME_CALLBACK taskRealTimeCallbackFunc; cv::Mat frameImage; char* folderNameLittle; char* folderName; char* folderNameFace; sy_rect task_min_boxsize[DETECTTYPE]; }; typedef struct VPT_ObjInfo //����ṹ�� { int left; int top; int right; int bottom; int center_x; int center_y; int index; // ����/�������֧��10�� long id; // Ŀ��ΨһID��ͬһIDΪͬһĿ�� int num; // ��ID�����µĵ�num֡ double confidence; // ���Ŷ� int snap_flag; }VPT_ObjInfo; typedef struct VPT_Result { int objCount; VPT_ObjInfo obj[MAX_OBJ_COUNT]; }VPT_Result; #endif