VPTProcess.h 2.53 KB
/*******************************************************************************************
* Version: VPT_x64_V2.0.0_20170705
* CopyRight: 中科院自动化研究所模式识别实验室图像视频组
* UpdateDate: 20170705
* Content: 人车物监测跟踪
********************************************************************************************/
#pragma once
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
#include "utools.h"
#include "stl_aiplatform_header.h"
#include <vector>
#include "sort/Sort.h"

using namespace std;

// #define THRESHOLD 0.6
#define THRESHOLD 0.45

struct TaskTracker
{
	string TaskID;
	double ratioWidth;
	double ratioHeight;
	Sort tracker;
};


typedef struct VPTProcess_PARAM
{
	int gpuid;              //指定显卡id
	float threshold;
	int max_batch;

	char* serialize_file;
	char* auth_license;
	VPTProcess_PARAM() : 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);


/**
 * @brief 人车物检测跟踪
 *
 * @param handle [in]
 * @param batch_img [in]
 * @param batchsize [in]
 * @param result [in]
 * @param deleteObjectID [in]
 * @param unUsedResult [in]
 * @param class_label_count [in/out]
 * @return int -1:图像错误; 其他:检测到的个数
 */
int VPT_Process_GPU(void * handle,  sy_img * batch_img, int batchsize, vector<onelevel_det_result>& result, vector<vector<int>>& deleteObjectID,
				    vector<vector<onelevel_det_result>>& unUsedResult);


int VPT_Process_GPU2(void * handle, sy_img * batch_img, vector<string>& tasklist,
					vector<onelevel_det_result>& result, vector<vector<int>>& deleteObjectID, vector<vector<onelevel_det_result>>& unUsedResult);


/*************************************************************************
* FUNCTION: VPT_Release
* PURPOSE: 资源释放
* PARAM:
[in] handle		- 处理句柄
* RETURN:	NULL
* NOTES:
*************************************************************************/
void VPT_Release(void * handle);



void AddTaskTracker(void * handle, const string taskID, double rWidth =1, double rHeight=1);
bool FinishTaskTracker(void * handle, const string taskID);
void PauseTaskTracker(void * handle, const string taskID);
void RestartTaskTracker(void * handle, const string taskID);
void DrawTracker(void * handle, const int taskID, cv::Mat *img);