Blame view

src/VPT-1/ObjCls.h 2.06 KB
e30d6793   Zou XiKun   v0.0.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
  #include "VPTProcess.h"// detector
  #include "utools.h"
  #include "proto.h"
  #include <queue>
  
  #include "sort/Sort.h" //tracker
  #include "MD5/mID.h"
  //#define MULTICHANNEL 20	//支持的最多路数
  #define THRESHOLD 0.6
  
  //struct objDetector{
  //    void* detector;
  //    //Sort tracker[MULTICHANNEL];
  //    VPTProcess_PARAM param;
  //    int channels;//值为opencvCV_8UC1 或者 CV_8UC3
  //};
  
  struct TaskTracker
  {
      int TaskID;
      double ratioWidth;
      double ratioHeight;
      Sort tracker;
  };
  vector<TaskTracker> taskTrackers;
  
  
  class CMemoryRecord
  {
      public:
          unsigned char * ptr;
          CMemoryRecord(int w,int h)
          {
              cudaMalloc((void **) & ptr, w*h*3*sizeof(unsigned char));
          }
          virtual ~CMemoryRecord(){
              cudaFree(ptr);
              ptr=NULL;
          }
  
  };
  #if 0
  class CMemoryPool
  {
      public:
          int m_w,m_h;
          std::queue<CMemoryRecord*> filled_records;
          std::queue<CMemoryRecord*> unfilled_records;
          CMemoryPool(int w,int h,int num)
          {
                  m_w = w;m_h=h;
              for(int i=0;i<num;i++)         
              {
                  CMemoryRecord * ptr= new CMemoryRecord(w,h);
                  unfilled_records.push_back(ptr);
              }
          }
  
          sy_img  GetSyImg()
          {
                  sy_img record;
                  CMemoryRecord * ptr = unfilled_records.front();
                  record.set_data(w,h, ptr->ptr);
                  unfilled_records.pop();
                  filled_records.push(ptr);
                  return record;
          }
  
  
          virtual ~CMemoryPool()
          {
              for(int i=0;i<filled_records.size();i++)         
              {
                  CMemoryRecord * ptr=filled_records[i ];
                  delete [] ptr;
                  std::queue<CMemoryRecord*>().swap( filled_records );
  
              }
              for(int i=0;i<filled_records.size();i++)         
              {
                  CMemoryRecord * ptr=filled_records[i ];
                  delete [] ptr;
                  std::queue<CMemoryRecord*>().swap( filled_records );
              }
          }
  };
  #endif