#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;
	bool dump_debug_crop_image=false;  // �Ƿ��dump debugͼ
	unsigned long int pts=0;           // ����ʱ���������dumpͼʱ������ͬ������ͼƬ
}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_OPENCL = 0x0001,  
	DETFEA_VULKAN = 0x0002,  
	DETFEA_OPENGL = 0x0003,   
}DETFEA_DEVICE;

typedef struct _DETFAE_INIT_INFO_
{
	int  precision_level = 0;   //  Precision_Normal = 0, Precision_High=1, Precision_Low=2
	int  mem_level = 0;         //  Memory_Normal = 0, Memory_High=1, Memory_Low=2
	int  pow_level = 0;         //  Power_Normal = 0, Power_High=1, Power_Low=2
	const char* model_path1 = NULL;
	const char* model_path2 = NULL;
	const char* cache_dir1 = NULL;
	const char* cache_dir2 = NULL;
	DETFEA_DEVICE device_type;
}DETFAE_INIT_INFO;

/***************************************************************************************************
* ��  ��: ��ʼ��
* ��  ��:
*         const char*				model_path		- I       ģ��·��(���������ΪNULL����ʾ�����õ�ģ��)
*         DETFEA_DEVICE				device_name		- I       �豸����
*         void**					detfea_handle	- O       ���
* ����ֵ: ������
***************************************************************************************************/
int DETFAE_Init(DETFAE_INIT_INFO init_info,void** detfea_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);


/***************************************************************************************************
* ��  ��: ����/��ȡIOU��ֵ(ֵԽ�󣬿�Խ��)
* ��  ��:
*         float		value				- I			ֵ
*         void*		handle				- I			���
* ����ֵ: ������
***************************************************************************************************/
int DETFEA_SetDetIOUThres(float value,  void* handle);
int DETFEA_GetDetIOUThres(float &value, void* handle);


/***************************************************************************************************
* ��  ��: ����/��ȡ���Ŷ���ֵ(ֵԽ�󣬿�Խ��)
* ��  ��:
*         float		value				- I			ֵ
*         void*		handle				- I			���
* ����ֵ: ������
***************************************************************************************************/
int DETFEA_SetDetConfThres(float value, void* handle);
int DETFEA_GetDetConfThres(float& value, void* handle);

#endif