派生自 Algorithm/baseDetector

Scheaven
2021-06-03 168af40fe9a3cc81c6ee16b3e81f154780c36bdb
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
//
// Created by Scheaven on 2020/4/20.
//
 
#ifndef INC_01_CPP_SORT_RESULT_UTIL_H
#define INC_01_CPP_SORT_RESULT_UTIL_H
#include "../config.h"
 
// 返回结果的结构体
struct RESULT_STRUCT
{
public:
    int human_id;
    float confidence;
    cv::Rect rect;
};
 
typedef std::vector<RESULT_STRUCT> FRAME_RESULT; // 返回一张画面中的结果信息
 
// ---SDK----.
 
// 结果传递过来待检测数据的形式
typedef struct _TImage{
    // Image (BGR), data
    unsigned char *data;
    // Image width
    int width;
    // Image height
    int height;
    // Image channel
    int channel;
}TImage;
 
typedef struct _TRect{
    int left;
    int top;
    int right;
    int bottom;
}TRect;
 
// 获取sdk运行结果, 单个的结果元素,如一张图片内检测到多个目标,每个目标是一个Target
typedef struct _Target{
    // target id 追踪
    uint64_t        id;
    // 检测置信度
    int             confidence;
    // target位置坐标
    TRect           rect;
    // sdk类型,如人脸等
    char            type[64];
    // target提取的特征值
    char*           feature;
    int           feature_size;
    // target的一些属性, 如年龄,种族,颜色等
    char*           attribute;
    int           attribute_size;
}Target;
 
 
// 本次运行sdk的结果汇总, 是最后要传出的结构体
typedef struct _TResult{
    Target *targets;
    int count;
}TResult;
 
 
 
 
// 获取sdk运行结果, 单个的结果元素,如一张图片内检测到多个目标,每个目标是一个Target
typedef struct _TestTarget{
    // target id 追踪
    uint64_t        id;
    uint64_t        faceID;
 
    bool            hasFace;
    // 检测置信度
    int             confidence;
    // target位置坐标
    TRect           rect;
 
    TRect           faceRect;
    // sdk类型,如人脸等
    char            type[64];
    // target提取的特征值
    char*           feature;
    int           feature_size;
    // target的一些属性, 如年龄,种族,颜色等
    char*           attribute;
    int           attribute_size;
}TestTarget;
 
 
// 本次运行sdk的结果汇总, 是最后要传出的结构体
typedef struct _TestResult{
    TestTarget *targets;
    int count;
}TestResult;
 
float cul_overlap_area(int Ax, int Ay, int Bx, int By, int Cx, int Cy, int Dx, int Dy); //计算两个框的重叠率
 
 
 
#endif //INC_01_CPP_SORT_UTIL_H