VPTProcess.h
5.31 KB
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/*******************************************************************************************
* Version: VPT_x64_V2.0.0_20170705
* CopyRight: �п�Ժ�Զ����о���ģʽʶ��ʵ����ͼ����Ƶ��
* UpdateDate: 20170705
* Content: �˳��������
********************************************************************************************/
#pragma once
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
#include "utools.h"
#include <vector>
using namespace std;
#define VTTYPECOUNT 10 //֧�ֵ���������
#define MAX_OBJ_COUNT 100
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;
typedef struct VPTProcess_PARAM
{
int mode; //����ģʽ(DEVICE_GPU / DEVICE_CPU)
int gpuid; //ָ���Կ�id
float threshold;
int max_batch;
int engine; //ָ����������(ENGINE_MCAFFE2 / ENGINE_TENSORRT)
char* preprocess_param;
char* serialize_file;
char* auth_license;
VPTProcess_PARAM() :mode(DEVICE_GPU), gpuid(0), threshold(0.6), max_batch(20) {};
}VPTProcess_PARAM;
/*************************************************************************
* FUNCTION: VPT_Init
* PURPOSE: ��ʼ��
* PARAM:
[in] vparam ����
* RETURN: handle
* NOTES:
*************************************************************************/
int VPT_Init(void *&handle, VPTProcess_PARAM vparam);
/*************************************************************************
* FUNCTION: VPT_Process
* PURPOSE: �˳��������
* PARAM:
[in] handle - �������
[in] rgb - ͼƬ���ݣ�3ͨ��BGR���� cv::Mat��ʽ��
[in] width - ͼƬ����
[in] height - ͼƬ�߶�
[in] result - ������������ⲿ�����㹻�ڴ�
[out] traffic - ��ͨ��������ṹ�� �ڴ����ⲿ���룬��С���ʼ��ʱ��������߸�����ͬ������ΪNULLʱ������
* RETURN: -1��ͼ����� ���������ĸ���
* NOTES:
*************************************************************************/
int VPT_Process(void * handle, unsigned char ** bgr, int batchsize, VPT_Result * result);
/*************************************************************************
* FUNCTION: VPT_Process
* PURPOSE: �˳��������
* PARAM:
[in] handle - �������
[in] rgb - ͼƬ���ݣ�3ͨ��BGR���� cv::Mat��ʽ��
[in] width - ͼƬ����
[in] height - ͼƬ�߶�
[in] result - ������������ⲿ�����㹻�ڴ�
[in] deleteObjectID - ɾ���Ĺ켣ID��
[out] traffic - ��ͨ��������ṹ�� �ڴ����ⲿ���룬��С���ʼ��ʱ��������߸�����ͬ������ΪNULLʱ������
* RETURN: -1��ͼ����� ���������ĸ���
* NOTES:
*************************************************************************/
//startBatch ��batchΪ�˼����Դ棬���д��� - add by lm
//int VPT_Process_GPU(void * handle, float * bgr, int width, int height, int startBatch, int batchsize, VPT_Result * result, vector<vector<int>>& deleteObjectID);
int VPT_Process_GPU(void * handle, sy_img * batch_img, int startBatch, int batchsize, vector<unsigned long long> vec_frameIndex, vector<VPT_Result>& result, vector<vector<int>>& deleteObjectID, vector<vector<VPT_Result>>& unUsedResult);
/*************************************************************************
* FUNCTION: VPT_ProcessImage
* PURPOSE: �˳�����-ͼƬ
* PARAM:
[in] handle - �������
[in] rgb - ͼƬ���ݣ�3ͨ��BGR���� cv::Mat��ʽ��
[in] width - ͼƬ����
[in] height - ͼƬ�߶�
[in] result - ������������ⲿ�����㹻�ڴ�
* RETURN: -1��ͼ����� ���������ĸ���
* NOTES:
*************************************************************************/
int VPT_ProcessImage(void * handle, unsigned char ** bgr, int batchsize, VPT_Result * result);
/*************************************************************************
* FUNCTION: VPT_Release
* PURPOSE: ��Դ�ͷ�
* PARAM:
[in] handle - �������
* RETURN: NULL
* NOTES:
*************************************************************************/
void VPT_Release(void * handle);
void AddTaskTracker(void * handle, const int taskID, const double rWidth, const double rHeight);
void FinishTaskTracker(void * handle, const int taskID);
void PauseTaskTracker(void * handle, const int taskID);
void RestartTaskTraker(void * handle, const int taskID);
void DrawTracker(void * handle, const int taskID, cv::Mat *img);