Blame view

vpt/src/VPT/sort/SnapShot.h 1.96 KB
144cd8c4   Hu Chunming   v6.0.0 替换模型
1
2
3
4
5
6
7
8
9
10
11
  #ifndef __SNAPSHOT_H__

  #define __SNAPSHOT_H__

  #include "../VPT.h"

  #include <map>

  #include <opencv2/opencv.hpp>

  #include <bitset>

  #include <boost/thread/thread.hpp>

  

  

  //using namespace cv;

  

6ca63d90   Hu Chunming   提交v4.0.0
12
  const int SCALE_OUT = 10; //判断目标框初始位置时,在最小距离的基础上适当外扩

144cd8c4   Hu Chunming   v6.0.0 替换模型
13
14
15
16
  const int EDGESIZE = 4;

  

  typedef struct OBJECT_SNAPSHOT_INFO

  {

6ca63d90   Hu Chunming   提交v4.0.0
17
18
19
20
21
  	VIDEO_OBJECT_SNAPSHOT    objInfo;  //快照基本信息(保存的最优信息)

  	//unsigned char*         objImg;   //快照图像信息(保存最优图像)

  	cv::Mat                  objImg;   //快照图像信息(保存最优图像),我先用Mat方便,之后看是否改为char*

  	int                      area;     //改快照上一帧的面积(为了去除突变的快照)

  	bitset<EDGESIZE>         flags;    //标志位,标记快照框应该如何判断,left:0  top:1  right:2  bottom:3

144cd8c4   Hu Chunming   v6.0.0 替换模型
22
23
24
25
26
  

  	vector<int>              voteIndex;

  

  }OBJECT_SNAPSHOT_INFO;

  

144cd8c4   Hu Chunming   v6.0.0 替换模型
27
28
29
30
31
32
33
34
35
36
37
38
39
  

  class SnapShot

  {

  public:

  	SnapShot(char* ResDir, VIDEO_OBJECT_SNAPSHOT_CALLBACK VideoObjSnapshotCallBack, SNAPSHOT_PARAMETER *ssParam);

  	~SnapShot();

  

  	void ResetSnapShot();

  

  	void SnapshotProcess(VPT_Result *result, cv::Mat img, vector<int> deleteTrackers, int frameCount);

  	void AddSnapshot(VPT_ObjInfo object, cv::Mat img, int frameCount);

  	void UpdateSnapshot(VPT_ObjInfo object, cv::Mat img, int frameCount);

  	void SaveSnapshot(vector<int> deleteTrackers);

144cd8c4   Hu Chunming   v6.0.0 替换模型
40
    

6ca63d90   Hu Chunming   提交v4.0.0
41
  	//辅助函数

144cd8c4   Hu Chunming   v6.0.0 替换模型
42
43
44
45
  	bool LegalArea(int maxArea, int lastArea, int left, int top, int right, int bottom);

  	bool LegalPos(bitset<EDGESIZE> flags, int left, int top, int right, int bottom, int imgHeight, int imgWidth);

  

  

6ca63d90   Hu Chunming   提交v4.0.0
46
  	bool saveSnapshot;  //控制是否开启快照功能

144cd8c4   Hu Chunming   v6.0.0 替换模型
47
48
49
50
  

  public:

  	char mResDir[260];

  	map<int, OBJECT_SNAPSHOT_INFO> snapshots;

144cd8c4   Hu Chunming   v6.0.0 替换模型
51
52
53
54
55
56
57
58
59
60
61
  	VIDEO_OBJECT_SNAPSHOT_CALLBACK mVideoObjSnapshotCallBack;

  

  	bool checkBoxSize, checkDistance;

  	MRECT minBoxSize[DETECTTYPE];

  	int minDistance[EDGES];

  

  	boost::mutex threadMutex;

  	boost::thread ProcessThread;

  	vector<int> deleteID;

  	vector<int> tempDeleteID;

  	bool beginSaveSnapshot;

144cd8c4   Hu Chunming   v6.0.0 替换模型
62
  

6ca63d90   Hu Chunming   提交v4.0.0
63
  	int saveTimes;

144cd8c4   Hu Chunming   v6.0.0 替换模型
64
65
66
  };

  #endif // __SNAPSHOT_H__