vehicle_plate_dr.h
5.85 KB
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
/*************************************************************************
* Version: vehicle_plate_detection_and_recognition_v0.2.3.20191120
* CopyRight:中科视语(北京)科技有限公司
* UpdateDate:20191120
* Content:车牌检测识别*************************************************************************/
#ifndef VEHICLEPLATEDR_H_
#define VEHICLEPLATEDR_H_
#if _MSC_VER
#ifdef VEHICLEPLATEDR_EXPORTS
#define VEHICLEPLATEDR_API __declspec(dllexport)
#else
#define VEHICLEPLATEDR_API __declspec(dllimport)
#endif
#else
#define VEHICLEPLATEDR_API __attribute__ ((visibility ("default")))
#endif
#include "sy_common.h"
#ifdef __cplusplus
extern "C"
{
#endif
#define PLATENUM 8 //车牌号码位数
#define MAXPLATECOUNT 20 //支持最多20个车牌的检测
//车牌类型
#define SINGLETYPE_BLUE 0 //单排蓝色
#define SINGLETYPE_YELLOW 1 //单排黄色
#define SINGLETYPE_WHITE 2 //单排白色
#define SINGLETYPE_BLACK 3 //单排黑色
#define DOUBLETYPE_YELLOW 4 //双排黄色
#define DOUBLETYPE_WHITE 5 //双排白色
#define NEWENERGYTYPE_YELLOWGREEN 6 //新能源黄绿色
#define NEWENERGYTYPE_WHITEGRA 7 //新能源白绿色
//车牌号码
#ifndef VPLATENUM_RESULT_
#define VPLATENUM_RESULT_
typedef struct vplate_num
{
char character[4];
float maxprob;
int index;
}vplate_num;
#endif
#ifndef VP_RESULT_
#define VP_RESULT_
typedef struct vplate_result
{
sy_rect rect;
float detect_score;
vplate_num recg[PLATENUM];
float num_score;
int type; //车牌类型。只做车牌检测,车牌类型为:0-单层车牌,1-双层车牌;做车牌检测识别,0-单排蓝色 1-单排黄色 2-单排白色 3-单排黑色 4-双排黄色 5-双排白色 6-新能源黄绿色 7-新能源白绿色
int state; //车牌状态:0-无车牌,1-车牌,2-遮挡车牌
float state_score;//车牌状态置信度
sy_point rr_point[4];//斜框
}vplate_result;
#endif
#ifndef VPS_RESULT_
#define VPS_RESULT_
typedef struct vplates_result
{
vplate_result vehicle_plate_infos[MAXPLATECOUNT];
int count;
}vplates_result;
#endif
#ifndef __VPD_PARAM__
#define __VPD_PARAM__
typedef struct vpd_param
{
float thresld; //检测阈值 建议阈值 0.3
int devId; //指定显卡id
char* modelNames;
// int mode; //运行模式(DEVICE_GPU / DEVICE_CPU)
// int engine; //指定运行引擎 (ENGINE_MCAFFE2 / ENGINE_TENSORRT)
// int max_batch; //指定trt框架最大batch数
// char* serialize_file;
// vpd_param() : thresld(0.3), gpuid(0), mode(DEVICE_GPU), engine(ENGINE_TENSORRT),max_batch(10),serialize_file("VPDR") {};
}vpd_param;
#endif
#ifndef __VPR_PARAM__
#define __VPR_PARAM__
typedef struct vpr_param
{
// int gpuid;
// int mode;
char* cls_modelNames; //号牌分类
char* reg_modelNames; //号牌识别
// int engine; //指定运行引擎 (ENGINE_MCAFFE2 / ENGINE_TENSORRT)
// int max_batch; //指定trt框架最大batch数
// char* serialize_file;
// vpr_param() :gpuid(0), mode(DEVICE_GPU), engine(ENGINE_TENSORRT),max_batch(10),serialize_file("VPRecg") {};
}vpr_param;
#endif
/*************************************************************************
* FUNCTION: vpdr_init
* PURPOSE: 初始化句柄
* PARAM:
[in] handle - 句柄
[in] params - 参数
* RETURN: 成功或者错误代码
*************************************************************************/
VEHICLEPLATEDR_API int vpdr_init(void ** handle, vpd_param dparam, vpr_param rparam);
/*************************************************************************
* * FUNCTION: vpd_process
* * PURPOSE: 车牌检测
* PARAM:
* [in] handle - 检测句柄
* [in] img_data - 图像数据
* [in] result - 结果 内存在外部申请
* RETURN: 成功 或者 错误代码
* * NOTES:
* *************************************************************************/
VEHICLEPLATEDR_API int vpd_process(void * handle, sy_img img_data, vplates_result * result);
VEHICLEPLATEDR_API int vpd_batch(void *handle, sy_img* img_data, int batch_size, vplates_result *result);
/*************************************************************************
* FUNCTION: vpr_process
* PURPOSE: 车牌识别(识别接口只支持正的单层车牌或矫正裁剪成单层的双层车牌)
* PARAM:
[in] handle - 检测句柄
[in] img_data - 图像数据
[in] result - 结果 内存在外部申请
* RETURN: 成功 或者 错误代码
* NOTES:
*************************************************************************/
VEHICLEPLATEDR_API int vpr_process(void * handle, sy_img img_data, vplate_result * result);
VEHICLEPLATEDR_API int vpr_batch(void *handle, sy_img* img_data, int batch_size, vplate_result * result);
/*************************************************************************
* FUNCTION: vpdr_process
* PURPOSE: 车牌检测识别
* PARAM:
[in] handle - 检测句柄
[in] img_data - 图像数据
[in] result - 结果 内存在外部申请
* RETURN: 成功 或者 错误代码
* NOTES:
*************************************************************************/
VEHICLEPLATEDR_API int vpdr_process(void *handle, sy_img img_data, vplates_result * result);
VEHICLEPLATEDR_API int vpdr_batch(void *handle, sy_img* img_data, int batch_size, vplates_result *result);
/*************************************************************************
* FUNCTION: vpdr_release
* PURPOSE: 释放
* PARAM:
[in] handle - handle
* RETURN: NULL
* NOTES:
*************************************************************************/
VEHICLEPLATEDR_API void vpdr_release(void ** handle);
/*************************************************************************
* FUNCTION: vpdr_get_version
* PURPOSE:
* PARAM: NULL
* RETURN: 版本号
* NOTES:
*************************************************************************/
VEHICLEPLATEDR_API const char * vpdr_get_version();
#ifdef __cplusplus
};
#endif
#endif