road_seg.h 3.32 KB
/*************************************************************************
* Version: road_seg_v0.0.0.20230313
* CopyRight : 中国科学院自动化所模式识别实验室图像视频组
* UpdateDate:
* Content : 道路分割
*************************************************************************/
#ifndef ROADSEG_H_
#define ROADSEG_H_

#if _MSC_VER
#ifdef ROADSEG_EXPORTS
#define ROADSEG_API __declspec(dllexport)
#else
#define ROADSEG_API __declspec(dllimport)
#endif
#else
#define ROADSEG_API __attribute__ ((visibility ("default")))
#endif

#include "sy_common.h"

#ifdef __cplusplus
extern "C"
{
#endif

#ifndef __RS_LANE__
#define __RS_LANE__
typedef struct rs_lane {
    sy_point points[180];    	// 车道线上的点坐标数组
    int num_points;       		// 车道线上点的数量
    float start_x;           	// 起始点x坐标
    float start_y;           	// 起始点y坐标
    float cls;       			// 车道线类别 1-实线 2-虚线
    float conf;        			// 车道线置信度
}rs_lane;
#endif 

#ifndef __rs_RESULT__
#define __rs_RESULT__ 
	typedef struct rs_result
	{
		rs_lane reg_array[20];	 
		int lane_count;               
		unsigned char *seg_array;	
		unsigned char *direct_seg;	
	}rs_result;
#endif 

#ifndef __rs_PARAM__
#define __rs_PARAM__
	typedef struct rs_param
	{
		int devId;		//运行卡号 
		char* modelNames;
		float thresld;	//检测阈值 默认为0.3
	}rs_param;
#endif

	/*************************************************************************
	* FUNCTION: rs_init
	* PURPOSE: 载入模型
	* PARAM:
	[in] handle			- 句柄
	[in] params			- 参数
	* RETURN:	成功(0)或者错误代码
	* NOTES:
	*************************************************************************/
	ROADSEG_API int rs_init(void ** handle, rs_param param);

	/*************************************************************************
	* FUNCTION: rs_process
	* PURPOSE: 车颜色识别
	* PARAM:
	[in] handle			- 检测句柄
	[in] img_data		- 图像数据
	[in] result			- 结果 内存在外部申请
	* RETURN:	成功(0) 或 错误代码(< 0)
	* NOTES:
	*************************************************************************/
	ROADSEG_API int rs_process(void *handle, sy_img img_data, rs_result result);

	/*************************************************************************
	* FUNCTION: rs_batch
	* PURPOSE: 车颜色识别 batch
	* PARAM:
	[in] handle			- 检测句柄
	[in] img_data_array	- 图像数据
	[in] batch_size		- 图像数目
	[in] result			- 结果 内存在外部申请
	* RETURN:	成功(0) 或 错误代码(< 0)
	* NOTES:
	*************************************************************************/
	ROADSEG_API int rs_batch(void *handle, sy_img* img_data_array, int batch_size, rs_result* result);


	/*************************************************************************
	* FUNCTION: rs_release
	* PURPOSE: 释放
	* PARAM:
	[in] handle			- handle
	* RETURN:	NULL
	* NOTES:
	*************************************************************************/
	ROADSEG_API void rs_release(void ** handle);


	/*************************************************************************
	* FUNCTION: rs_get_version
	* PURPOSE:
	* PARAM:	NULL
	* RETURN:	版本号
	* NOTES:
	*************************************************************************/
	ROADSEG_API const char * rs_get_version();

#ifdef __cplusplus
};
#endif

#endif