DFace SDK  1.8.0
common.h
1 
2 /*****************************************************************************
3 * DFace pro SDK library
4 * Copyright (C) 2018 杭州小孔成像科技有限公司(dface.tech).
5 * @file common.h
6 * @brief 公共头文件
7 *
8 *
9 * @author kuaikuai.kim(dface.tech)
10 * @email customer@dface.tech
11 * @version 1.3.0
12 * @date 2018-05-02
13 * @license no free
14 *
15 *----------------------------------------------------------------------------
16 * Remark : Description
17 *----------------------------------------------------------------------------
18 * Change History :
19 * <Date> | <Version> | <Author> | <Description>
20 *----------------------------------------------------------------------------
21 * 2018/05/02 | 1.3.0 | kuaikuai kim |
22 *----------------------------------------------------------------------------
23 *
24 *****************************************************************************/
25 
26 #ifndef DFACE_COMMON_H
27 #define DFACE_COMMON_H
28 
29 #include <stdio.h>
30 #include <vector>
31 #include "dface/def.h"
32 #include "dface/config.h"
33 #include "dface/types.h"
34 #include "dface/mat.h"
35 #include "dface/mat_pixel.h"
36 #define ERROR_CODE_WRONG_EXTRACT_MAT_SIZE 1002
37 
38 
39 namespace dface {
40  using namespace std;
41 
42 
48  class DFACE_EXPORTS Bbox {
49  public:
50  Bbox();
54  float score;
58  int x1;
62  int y1;
66  int x2;
70  int y2;
74  float area;
80  float ppoint[10];
84  float regreCoord[4];
85 
90  int boxArea();
91  };
92 
93 
94  typedef DFACE_EXPORTS Point_<int> Point2i;
95  typedef DFACE_EXPORTS Point_<long> Point2l;
96  typedef DFACE_EXPORTS Point_<float> Point2f;
97  typedef DFACE_EXPORTS Point_<double> Point2d;
101  typedef Point2i Point;
102 
103 
104  typedef DFACE_EXPORTS Size_<int> Size2i;
105  typedef DFACE_EXPORTS Size_<long> Size2l;
106  typedef DFACE_EXPORTS Size_<float> Size2f;
107  typedef DFACE_EXPORTS Size_<double> Size2d;
111  typedef DFACE_EXPORTS Size2i Size;
112 
113  typedef DFACE_EXPORTS Rect_<int> Rect2i;
114  typedef DFACE_EXPORTS Rect_<float> Rect2f;
115  typedef DFACE_EXPORTS Rect_<double> Rect2d;
119  typedef DFACE_EXPORTS Rect2i Rect;
120 
121 
122 
130  static inline void bbox2Rect(dface::Bbox &in_bbox, dface::Rect &out_rect){
131  out_rect.x = in_bbox.x1;
132  out_rect.y = in_bbox.y1;
133  out_rect.width = in_bbox.x2 - in_bbox.x1;
134  out_rect.height = in_bbox.y2 - in_bbox.y1;
135  }
136 
137 
145  static inline void bbox2Rects(std::vector<dface::Bbox> &in_bboxs, std::vector<dface::Rect> &out_rects){
146  for(int i=0; i<in_bboxs.size(); ++i){
147  dface::Rect rect;
148  bbox2Rect(in_bboxs.at(i), rect);
149  out_rects.push_back(rect);
150  }
151  }
152 
153 
154  inline Bbox::Bbox() {};
155  inline int Bbox::boxArea() {
156  return (x2 - x1) * (y2 - y1);
157  }
158 
159 
160 }
161 
162 
163 
164 
165 
166 #endif //DFACE_COMMON_H
float area
人脸框面积
Definition: common.h:74
Definition: common.h:39
int x2
人脸框右下角x坐标值
Definition: common.h:66
Bbox 检测到的人脸边框信息类 图片左上角坐标为(0,0), x值向右增加,y值向下增加
Definition: common.h:48
int y1
人脸框左上角y坐标值
Definition: common.h:62
int y2
人脸框右下角y坐标值
Definition: common.h:70
Size 大小表示模板类
Definition: types.h:48
int boxArea()
Definition: common.h:155
Rect 矩形表示模板类,常用于人脸边框, 整数型矩形参考dface::Rect(typdef Rect_<int> Rect) ...
Definition: types.h:75
Point 点表示模板类, 整数型点参考dface::Point(typdef Point_<int> Point)
Definition: types.h:15
int x1
人脸框左上角x坐标值
Definition: common.h:58
float score
判断为人脸的分值
Definition: common.h:54