vehicle_pose.h 4.77 KB
/*******************************************************************************************
* Version: car_pose_v0.0.0.20210519
* CopyRight: 中科视语(北京)科技有限公司
* UpdateDate: 20210519
* Content: 车辆姿态估计
********************************************************************************************/

#ifndef _VEHICLE_POSE_H_
#define _VEHICLE_POSE_H_

#ifdef _MSC_VER
#ifdef VEHICLE_POSE_EXPORTS
#define VEHICLE_POSE_API __declspec(dllexport)
#else
#define VEHICLE_POSE_API __declspec(dllimport)
#endif
#else
#define VEHICLE_POSE_API __attribute__ ((visibility ("default"))) //?
#endif	

#include "sy_common.h"

#define MAX_OBJ_COUNT 200

//#define _VEHICLE_DET_

#ifdef __cplusplus
extern "C"
{
#endif

#define POSE_COUNT 9
// #define LDMK_COUNT 20
#define LDMK_COUNT 32 //221104版本有32个关键点

#ifndef __VEHICLE_POSE_RESULT__
#define __VEHICLE_POSE_RESULT__
	typedef struct vehicle_pose_result
	{
		sy_point vehicle_ldmk[LDMK_COUNT];
		float vehicle_ldmk_score[LDMK_COUNT];
		float vehicle_pose[POSE_COUNT];
   
    double phi;
    double gamma;
    double theta;
	}vehicle_pose_result;
#endif

#ifndef __VEHICLE_POSE_PARAM__
#define __VEHICLE_POSE_PARAM__
	typedef struct vehicle_pose_param
	{
		// int mode;				/运行模式(DEVICE_GPU / DEVICE_CPU)
		int devId;					//运行卡号
		char* modelNames;
		float ldmk_thres;           //ldmk点的阈值
		// int engine;					//指定运行引擎(ENGINE_MCAFFE2 / ENGINE_TENSORRT)
		// int max_batch;				//指定trt批处理数量上限
		// char* serialize_file;		//指定trt缓存文件完整路径
		// char* auth_license;
		// vehicle_pose_param() :mode(DEVICE_GPU), gpuid(0), engine(ENGINE_TENSORRT), max_batch(20), auth_license("sy") {};
	}vehicle_pose_param;
#endif


#ifndef __VEHICLE_POSE_DRAW_PARAM__
#define __VEHICLE_POSE_DRAW_PARAM__
#define PIXEL_COUNT 3
	typedef struct vehicle_pose_draw_param
	{
		int ldmk[PIXEL_COUNT];         //绘制ldmk点 像素值
		int pose[PIXEL_COUNT];         //绘制点云 像素值

		char* result_image_path;     //图片保存路径,如"./result/car1.jpg"
		char* car_vertice_path;      //car_vertice路径
   
	}vehicle_pose_draw_param;
#endif


	/*************************************************************************
	* FUNCTION: car_pose_recg_init
	* PURPOSE: 车辆姿态估计初始化
	* PARAM:
	[in] handle					- 句柄
	[in] param					- 初始化参数
	* RETURN: 成功(0)或错误(<0)
	* NOTES:
	*************************************************************************/
	VEHICLE_POSE_API int vehicle_pose_init(void ** handle, vehicle_pose_param param);


	/*************************************************************************
	* FUNCTION: car_pose_recg_process
	* PURPOSE: 车辆姿态估计
	* PARAM:
	[in] tools					- 句柄
	[in] img_data				- 检测图像数据
	[out] result				- 检测结果
	* RETURN: 成功(0)或错误(<0)
	* NOTES:
	*************************************************************************/
	VEHICLE_POSE_API int vehicle_pose_process(void * handle, sy_img * img_data, vehicle_pose_result * result);


	/*************************************************************************
	* FUNCTION: car_pose_recg_batch
	* PURPOSE: 车辆姿态估计批处理
	* PARAM:
	[in] tools					- 句柄
	[in] img_data_array			- 检测图像数据数组
	[in] batch_size				- 检测图像批处理个数
	[out] result				- 检测结果数组
	* RETURN: 成功(0)或错误(<0)
	* NOTES:
	*************************************************************************/
	VEHICLE_POSE_API int vehicle_pose_batch(void * handle, sy_img *img_data_array, int batch_size, vehicle_pose_result * result);
	
  VEHICLE_POSE_API int vehicle_pose_batch_draw(void * handle, sy_img *img_data_array, int batch_size, vehicle_pose_result * result, vehicle_pose_draw_param *draw_param);

#ifdef _VEHICLE_DET_
 VEHICLE_POSE_API int vehicle_det_pose_process_path(void * handle, char* image_path, vehicle_pose_result *result, int *car_count, vehicle_pose_draw_param draw_param);
	VEHICLE_POSE_API int vehicle_det_pose_process(void * handle, sy_img img_data, vehicle_pose_result *result,int *car_count, vehicle_pose_draw_param draw_param);
 #endif
	/*************************************************************************
	* FUNCTION: car_pose_recg_release
	* PURPOSE: 资源释放
	* PARAM:
	[in] handle					 - 处理句柄
	* RETURN: NULL
	* NOTES:
	*************************************************************************/
	VEHICLE_POSE_API void vehicle_pose_release(void ** handle);


	/*************************************************************************
	* FUNCTION: car_pose_recg_get_version
	* PURPOSE: 版本返回
	* PARAM: NULL
	* RETURN: 版本号

	* NOTES:
	*************************************************************************/
	VEHICLE_POSE_API const char * vehicle_pose_get_version();


#ifdef __cplusplus
};
#endif
#endif