libdetfea.h 2.21 KB
#pragma once
#ifndef _DETFEA_LIB_H_
#define _DETFEA_LIB_H_

#include <vector>
 
#include "opencv2/opencv.hpp"

#define		DETFEA_CLS_TOP_N 10
#define		DETFEA_FEAT_DIM 160

#define		DETFEA_ALL_OK						0x00000000			//
#define		DETFEA_HANDLE_NULL					0x10050001			// 输入句柄为空
#define		DETFEA_INPUT_IMAGE_EMPTY			0x10050002			// 输入图像为空
#define		DETFEA_OUTPUT_NULL					0x10050003			// 输入的输出结构体为空


typedef struct _DETFEA_INPUT_
{
	cv::Mat img;

}DETFEA_INPUT;


typedef struct _DETFEA_SINGLE_OUTPUT_
{
	float x1;
	float y1;
	float x2;
	float y2;
	float prob;
	int id;
	int label;
	float feat[DETFEA_FEAT_DIM];
}DETFEA_SINGLE_OUTPUT;

typedef struct _DETFEA_OUTPUT_
{
	std::vector < DETFEA_SINGLE_OUTPUT> output_list;
}DETFEA_OUTPUT;


// 定义算法的识别设备
typedef enum _DETFEA_DEVICE_
{
	DETFEA_CPU = 0x0000,  // CPU
	DETFEA_GPU = 0x0001,  // GPU
}DETFEA_DEVICE;



/***************************************************************************************************
* 功  能: 初始化
* 参  数:
*         const char*				model_path		- I       模型路径(这个可以设为NULL,表示用内置的模型)
*         DETFEA_DEVICE				device_name		- I       设备类型
*         void**					detfea_handle	- O       句柄
* 返回值: 错误码
***************************************************************************************************/
int DETFEA_Init(const char* model_path1,
				const char* model_path2,
				DETFEA_DEVICE device_type,
				void** handle);


/***************************************************************************************************
* 功  能: 识别
* 参  数:
*         DETFEA_INPUT		in_img				- I			输入图片
*         DETFEA_OUTPUT*		detfea_output		- O			返回识别结果
*         void*					handle				- I			句柄
* 返回值: 错误码
***************************************************************************************************/
int DETFEA_Process(DETFEA_INPUT in_img, DETFEA_OUTPUT* detfea_output, void* handle);


/***************************************************************************************************
* 功  能: 释放句柄
* 参  数:
*         void**			handle	- I			句柄
* 返回值: 错误码
***************************************************************************************************/
int DETFEA_Release(void** handle);



#endif