Video Analysis底层库拆分,sdk的go封装
chenshijun
2020-09-09 0541661d3e4a063d4e68b33e4d6dbb71d3b58638
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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
#ifndef _c_wrapper_c_structure_h_
#define _c_wrapper_c_structure_h_
 
#include <string.h>
 
typedef struct _cPOINT {
    int x;
    int y;
} cPOINT;
 
typedef struct _cRECT {
    int left;
    int top;
    int right;
    int bottom;
} cRECT;
 
typedef struct _cIMAGE{
    unsigned char *data;
    int width;
    int height;
    int channel;
} cIMAGE;
 
typedef struct _cFaceAngle {
    int yaw;
    int pitch;
    int roll;
    float confidence;
} cFaceAngle;
 
typedef struct _cThftResult {
    int gender;//1-male,0-female
    int age;//range[0-100]
    int race; //[1-white,2-yellow,3-black]
    int beauty_level;//range[0-100]
    int smile_level;//range[0-100]
} cThftResult;
 
typedef struct _cFacePos {
    cRECT rcFace;
    cPOINT ptLeftEye;
    cPOINT ptRightEye;
    cPOINT ptMouth;
    cPOINT ptNose;
    cFaceAngle fAngle;
    int nQuality;
    
    unsigned char pFacialData[512];
} cFacePos;
 
typedef struct _cFaceInfo{
    cRECT rcFace;
    cPOINT ptLeftEye;
    cPOINT ptRightEye;
    cPOINT ptMouth;
    cPOINT ptNose;
    cFaceAngle fAngle;
    int nQuality;
    
    unsigned char pFacialData[8*1024];
    long        nFaceID;//face tracking id
} cFaceInfo;
 
typedef struct _cThfqParam{
    int brightness_min;//0-100,太暗阈值,建议25.越小越可能把过暗的人脸当作正常人脸,此参数会影响THFQ_Result::brightness
    int brightness_max;//0-100,太亮阈值,建议75.越大越可能把的过亮人脸当作正常人脸,此参数会影响THFQ_Result::brightness
}cThfqParam;
 
typedef struct _cThfqResult{
    int brightness;//人脸亮度,只有3种可能的值:[-1->太暗,0->正常,1->太亮],亮度结果会受亮度阈值参数brightness_min和brightness_max影响
    int occlusion;//人脸遮挡度,范围值为0-100,越大表示人脸遮挡程度越高
    int hat;//带帽子,范围为0-100,越大表示越可能有佩戴帽子,建议判别阈值为50
    int blur;//人脸模糊度,范围值为0-100,越大表示图像越模糊,建议人脸模糊度判别阈值为70
    int glasses;//带眼镜,范围为0-100,越大表示越可能有戴眼镜,建议判别阈值为70
}cThfqResult;
 
 
typedef struct _cObjInfo
{
    cRECT rcObj;
    int typ;
    float prob;
} cObjInfo;
 
typedef struct _cPlateIDCfg {
    int nFastMemorySize;            // 单位 K
    int nMemorySize;                // 单位 M
    int nMinPlateWidth;                // 检测的最小车牌宽度,以像素为单位
    int nMaxPlateWidth;                // 检测的最大车牌宽度,以像素为单位
    int nMaxImageWidth;                // 最大图像宽度
    int nMaxImageHeight;            // 最大图像高度
 
    unsigned char bIsFieldImage;    // 是否是场图像
    unsigned char bMovingImage;        // 识别运动or静止图像
    unsigned char nOrderOpt;        // 输出顺序选项 0-置信度 1-自上而下 2-自下而上
    unsigned char bLeanCorrection;    // 是否启用车牌旋转功能,默认开启
    unsigned char nImproveSpeed;    // 0: 识别率优先 1:识别速度优先
    unsigned char bCarLogo;            // 0: 不检测车标 1: 检测车标
    unsigned char bLotDetect;        // 0: 不检测车位 1: 检测车位
    unsigned char bShadow;            // 0: 针对无阴影的车牌 1:针对有阴影的车牌,默认开启
    unsigned char bShieldRailing;    // 0: 屏蔽栏杆干扰, 1:不屏蔽栏杆干扰
    unsigned char bCarModel;        // 0: 不识别车型, 1: 识别车型
    unsigned char bLocateTh;        // 车牌定位阈值
    unsigned char bOCRTh;           // 车牌识别阈值
 
    unsigned char bIndividual;        // 个性化车牌开启
    unsigned char bTwoRowYellow;    // 双层黄色车牌开启
    unsigned char bArmPolice;        // 单层武警车牌开启
    unsigned char bArmPolice2;        // 双层武警车牌开启
    unsigned char bTwoRowArmy;        // 双层军队车牌开启
    unsigned char bTractor;            // 农用车车牌开启
    unsigned char bEmbassy;            // 使馆车牌开启
    unsigned char bChangNei;        // 厂内车牌开启
    unsigned char bMinHang;            // 民航车牌开启
    unsigned char bConsulate;        // 领事馆车牌开启
    unsigned char bNewEnergy;        // 新能源车牌开启
    unsigned char bOnlyTwoRowYellow;// 只识别双层黄牌开启
    unsigned char bOnlyLocation;    // 只定位车牌开启
}cPlateIDCfg;
 
typedef struct _cPlateIDResult {
    char license[16];    // 车牌字符串
    char color[8];        // 车牌颜色
 
    int nColor;            // 车牌颜色
    int nType;            // 车牌类型
    int nConfidence;    // 整牌可信度
    int nBright;        // 亮度评价
    int nDirection;        // 车牌运动方向,0 unknown, 1 left, 2 right, 3 up, 4 down 
    
    cRECT rcLocation;                    // 车牌坐标
    const unsigned char *pbyBits;        // 识别结果对应的图片的缓冲区
    int nTime;                            // 识别耗时
    unsigned char nCarBright;            // 车的亮度
    unsigned char nCarColor;            // 车的颜色
    unsigned char nCarLogo;             // 车标类型
    unsigned char nCarType;                // 车辆类型
    unsigned char *pbyPlateBin;         // 车牌二值化结果(按bit存储)
    unsigned short nBinPlateWidth;      // 二值化结果中车牌宽度
    unsigned short nBinPlateHeight;     // 二值化结果中车牌高度
    char reserved[70];                    // 保留
    cRECT rcLogoLocation;                // 车标坐标
    unsigned short nCarModel;           // 车辆类型
    unsigned short nCarModelConfidence;    // 车型可信度    
}cPlateIDResult;
 
typedef struct _cPlateIDCloudSDKCfg {
    int iImageMode;         //0:为帧模式 1:为场模式
    int iRecMode;           //识别模式,0:单张图片识别,1:视频检测+识别,2:视频多帧融合识别(注:1模式比2模式快,但识别率和捕获率比2低)
                              
    int iMinPlateWidth;     //识别最小车牌宽度
    int iMaxPlateWidth;     //识别最大车牌宽度
    
    int iImageWidth;        //图片宽度 
    int iImageHeight;       //图片高度
 
    int iMinHorAngle; 
    int iMaxHorAngle;       //水平矫正角度范围,支持最大角度为[-30°,30°]
    int iMinVerAngle;
    int iMaxVerAngle;       //垂直矫正角度范围,支持最大角度为[-30°,30°]
 
    //此些项针对车型识别有用,其余无用
    float fExpLeftRightR;   //车脸左右扩充(车牌的宽度)倍数 参考值为1.6
    float fExpTopR;         //车脸上部扩充(车牌的高度)倍数 参考值为6.0
    float fExpBottomR;      //车脸下部扩充(车牌的高度)倍数 参考值为1.5
}cPlateIDCloudSDKCfg;
 
typedef struct _cPlateIDCloudSDKResult {
    char number[20];     //识别结果
    cRECT PlateRect;    //车牌位置
    int x[4];
    int y[4];
    int iConfidence;    //车牌置信度
    int ePlateType;     //车牌类型
    int iMoveDir;       //车辆运动方向 0:朝近运动,1:朝远运动,-1:未知
    int eVColor1;       //车身主颜色
    int eVColor2;       //车身次颜色
    int eVehicleBright; //车辆深浅色
    unsigned char *pResultBits; //视频识别模式中抓拍的图片,视频模式识别下有效,需要开辟
    
    int iFramNo;        //视频模式下帧号
    int sTime[7];       //视频识别模式中抓拍此张图的时间
    
    //针对车脸识别应用此项,其余无用
    unsigned char  *pVehicleFaceImage; //对应的车脸的图片,需要提前开辟内存,开辟个最大内存就可以,宽高可以都为1000
    int iVehicleFaceWidth;             //车脸宽度
    int iVehicleFaceHeight;            //车脸高度
    int iGrayFaceFlag;                 //车脸是否为灰度图
 
    cRECT charLocation[20];     //车牌字符的位置(基于大图)
    int charConfidence[20];     //字符识别置信度
    int iCharNum;               //车牌字符数目
}cPlateIDCloudSDKResult;
 
typedef struct _cPlateInfo
{
    int ePlateColor;
    int  ePlateType;
    char platenumber[20];         //车牌号码
    int iPlateConfidence;
    int iCharNum;
    int iCharConfidence[20];
}cPlateInfo;
 
typedef struct _cVehicleITSResult {
    int iPlateFlag;         //是否识别到车牌
    cPlateInfo plateInfo;    //车牌信息
    cRECT plateRect;        //车牌位置
    cRECT tempVehicleRect;  //车辆位置
 
    char tempVehicleType[1024];     //车辆类型--总名称  jeep-大切诺基-2004
    char tempVehicleBrand[1024];    //车辆品牌       jeep
    char tempVehicleSub[1024];      //车辆子型号     大切诺基
    char tempVehicleType1[1024];    //车辆类型   轿车 货车  客车  面包车
 
    float fVDConf;                  //车辆检测置信度
 
    float fConfdence;               //车辆类型置信度
    int iVehicleSubModel;           //车型名称索引
    int eVehicleBright;             //车辆深浅色
    int eVehicleColor1;             //车身主颜色
    int eVehicleColor2;             //车身辅颜色
 
    unsigned char*pCaptureImage; //视频模式识别下抓拍的图片数据
    int iImageWidth;             //视频模式下抓拍图像宽度
    int iImageHeight;            //视频模式下抓拍图像高度
 
}cVehicleITSResult;
 
#endif