Blame view

src/MSRegionSurveilance/ms_region_surveilance.h 2.76 KB
8805b950   Liu Meng   物品遗留效果优化
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
  /*************************************************************************
  * Version: 区域监控SDK_v1.0.0
  * CopyRight: 中科视语(北京)科技有限公司
  * UpdateDate20200213
  * 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