hs_det_motor.h 3.07 KB
/*******************************************************************************************
* Version: head_shoulder_det_x64_v0.0.1
* CopyRight: 中科视语(北京)科技有限公司
* UpdateDate: 20230810
* Content:头肩检测_二轮车
********************************************************************************************/
#ifndef HSD_MOTOR_H_
#define HSD_MOTOR_H_

#ifdef _MSC_VER
#ifdef HSD_MOTOR_EXPORTS
#define HSD_MOTOR_API __declspec(dllexport)
#else
#define HSD_MOTOR_API __declspec(dllimport)
#endif
#else
#define HSD_MOTOR_API __attribute__ ((visibility ("default")))
#endif

#include "sy_common.h"

#define MAX_OBJ_COUNT 1000

#ifdef __cplusplus
extern "C"
{
#endif

	typedef struct hs_motor_info	//结果结构体
	{
		int left;
		int top;
		int right;
		int bottom;
		int index;
		double confidence;		//	置信度
	}hs_motor_info;

	typedef struct hs_motor_result
	{
		hs_motor_info objinfo[MAX_OBJ_COUNT];
		int objcount;
	};

	typedef struct hs_motor_param
	{
		int devId;		//运行卡号 GPU模式下有效
		char* modelNames;
		char* modelNames_b;
		float thresld;	//检测阈值 默认为0.3
		int max_batch;
		hs_motor_param() :devId(0), max_batch(8), thresld(0.4), modelNames(nullptr), modelNames_b(nullptr) {};
	}hs_motor_param;

	/*************************************************************************
	* FUNCTION: hst_init
	* PURPOSE: 初始化
	* PARAM:
	[in] handle		 -处理句柄
	[in] param		 -初始化参数
	* RETURN:	handle
	* NOTES:成功(0)或者错误代码(<0)
	*************************************************************************/
	HSD_MOTOR_API int hs_motor_init(void **handle, hs_motor_param param);
	HSD_MOTOR_API int hs_motor_process_batch(void * handle, sy_img *image_data_array, int batchsize, hs_motor_result *result);
	HSD_MOTOR_API int hs_motor_process_batchV2(void * handle, sy_img *image_data_array, int batchsize, hs_motor_result *result);
	/*************************************************************************
	* FUNCTION: hst_release
	* PURPOSE: 资源释放
	* PARAM:
	[in] handle		- 处理句柄
	* RETURN:	NULL
	* NOTES:
	*************************************************************************/
	HSD_MOTOR_API void hs_motor_release(void **handle);


	/*************************************************************************
	* FUNCTION: hst_process_gpu
	* PURPOSE: 
	* PARAM:
	[in] handle		- 处理句柄
	[in] rgb		- 图片数据(3通道BGR数据 cv::Mat格式)
	[in] width		- 图片宽度
	[in] height		- 图片高度
	[in] result		- 搜索结果,在外部申请足够内存
	* RETURN:	-1:图像错误; 其他:检测到的个数
	* NOTES:
	*************************************************************************/
	HSD_MOTOR_API int hs_motor_process(void * handle, sy_img image, hs_motor_result *result);

	/*************************************************************************
	* FUNCTION: hst_getversion
	* PURPOSE: 释放
	* PARAM:	NULL
	* RETURN:	版本号
	* NOTES:
	*************************************************************************/
	HSD_MOTOR_API const char * hs_motor_getversion();

#ifdef __cplusplus
};
#endif

#endif