ms_region_surveilance.h 2.76 KB
/*************************************************************************
* Version: 区域监控SDK_v1.0.0
* CopyRight: 中科视语(北京)科技有限公司
* UpdateDate:20200213
* Content: 区域监控
*************************************************************************/

#ifdef _MSC_VER
#ifdef MSREGIONSURVEILANCE_EXPORTS
#define MSREGIONSURVEILANCE_API __declspec(dllexport)
#else
#define MSREGIONSURVEILANCE_API __declspec(dllimport)
#endif
#else
#define MSREGIONSURVEILANCE_API __attribute__ ((visibility ("default")))
#endif



#include "header.h"
#ifndef _MSREGIONSURVEILANCE_H__
#define _MSREGIONSURVEILANCE_H__

#define m_BOUNDING_BOX_MIN 50
#define m_BOUNDING_BOX_MAX 500
#define m_BOUNDING_BOX_RATEMIN 0.001
#define m_BOUNDING_BOX_RATEMAX 100
#define MAXROINUM 10                      // 最大ROI数
#define	ALARMTYPENUM 6                      // 报警类型数量
#define MACDETECTOBJNUM 100

#ifndef __RS_PARAM__
#define __RS_PARAM__
#ifdef __cplusplus
extern "C"
{
#endif
	typedef struct rs_param
	{
		int gpuid;				//指定显卡id
		//其余算法参数 如长短边等

		sy_img image;
		int channel_deal;
		bool filt_flag;
		int min_area;
		int max_area;

		rs_param() : gpuid(0), min_area(0), max_area(1000000){};
	}rs_param;
#endif

#ifndef __RS_INFO__
#define __RS_INFO__
	typedef struct ms_object_info {
		sy_point  curPos;				    // 当前坐标
		ms_trace  trace;						// 轨迹及报警状态
		int       unique_id;					// 当前目标的特点ID
		sy_rect   tar_box;					// 目标外接矩形
		bool      pb_alarm_state[MAXROINUM];   // 对应区域是否报警
		int       pb_alarm_type[MAXROINUM][ALARMTYPENUM];    // 对应区域是哪种报警
		int       index;                      // 类别 0 行人 ,1 物
	}ms_object_info;
#endif

#ifndef __RS_RESULT__
#define __RS_RESULT__
	typedef struct rs_result
	{
		int obj_count;  
		ms_object_info obj_infos[MACDETECTOBJNUM];
	}rs_result;
#endif

	// 模型初始化 返回0 正确,非0错误
	MSREGIONSURVEILANCE_API int rs_init(void **handle, rs_param param);

	// ROI区域初始化 返回0 正确,非0错误
	MSREGIONSURVEILANCE_API int rs_init_region(void *handle, int num_roi, region_info* region_infos, bool iflog);

	// 初始化背景 返回0 正确,非0错误
	MSREGIONSURVEILANCE_API int rs_init_background(void *handle, sy_img img_data);

	// 每一帧图像检测 返回0 正确,非0错误
	MSREGIONSURVEILANCE_API int rs_detect(void *handle, sy_img img_data, int num_roi, region_info* region_infos, rs_result *result);

	//计算方向和箭头绘制的两个端点 返回0 正确,非0错误
	MSREGIONSURVEILANCE_API int rs_get_arrowdir(void *handle, sy_point p_roi0, sy_point p_roi1, sy_point dir);

	//资源释放
	MSREGIONSURVEILANCE_API void rs_release(void **handle);

#ifdef __cplusplus
}
#endif

#endif