派生自 development/c++

pansen
2019-03-07 979bc003bce710bf300bc2bd87a8278585678763
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
//
// Created by pans on 5/2/18.
//
 
#ifndef VIDEOSTRUCTURE_FACEDATA_HPP
#define VIDEOSTRUCTURE_FACEDATA_HPP
 
#include <vector>
 
struct FaceImageN {
    int width;
    int height;
    int stride;
    unsigned char *data;
};
struct FaceFeaWithScore {
    int left;
    int top;
    int width;
    int height;
    std::vector<unsigned char> feature;
    float score;
};
 
typedef std::vector<FaceFeaWithScore> Features;
 
struct FaceResult {
    long id;
    std::string uuid;
    std::string tableName;
    float confidence;
    std::string face_img_url;
    std::string idCard;
    std::string alarmRet;
};
 
struct DbAction {
    long id;
    std::string tableName;
    std::string face_img_url;   //#todo 以图搜图多底库数据同步
    long actionNo; // 1 add; 2, remove
};
 
//        sequence<DbAction> DbActions;
 
typedef std::vector<FaceResult> FaceResults;
typedef std::map<float, FaceResult, std::greater<float>> mapFaceResults;
 
 
namespace {
 
 
    typedef std::vector<unsigned char> Feature;
    typedef std::vector<unsigned char> Data;
 
    struct POINT {
        int x;
        int y;
    };
 
    struct RECT {
        int left;
        int top;
        int right;
        int bottom;
    };
 
    struct FaceAngle {
        int yaw;
        int pitch;
        int roll;
        float confidence;
    };
 
    struct ThftResult {
        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]
    };
 
    struct FacePos {
        RECT rcFace;
        POINT ptLeftEye;
        POINT ptRightEye;
        POINT ptMouth;
        POINT ptNose;
        FaceAngle fAngle;
        int nQuality;
        ThftResult property;
        Data pFacialData;
    };
 
    typedef std::vector<FacePos> Faces;
 
    long getTimeLong() {
        time_t tt;
        time(&tt);
        tt = tt + 8 * 3600;  // transform the time zone
        return tt;
    }
}
 
namespace FaceToolData {
    enum RectSize {
        horizontal = 10,
        vertical = 10
    };
 
    class CompareData {
    public:
        virtual ~CompareData() {}
    };
 
 
    class FeatureData : public CompareData {
    public:
        FeatureData(int size) : feature(size) {}
 
        Feature feature;
        int num;
        float threshold;
        std::string tableNameList;
    };
 
    struct CompareResult {
        std::string id;
        std::string face_img_url;
        std::string table_Name;
        float score;
    };
}
 
#endif //VIDEOSTRUCTURE_FACEDATA_HPP