wangrong
2025-03-19 291afb9c81aae1d15d9e3edcea618d0a2e1fc5a6
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
 
#pragma once
#include <vector>
#include <memory>
#include "shapes/vp_rect.h"
 
 
namespace vp_objects {
    // target in frame detected by face detectors such as yunet.
    // note: we can define new target type like vp_frame_xxx_target... if need (see vp_frame_pose_target also)
    class vp_frame_face_target
    {
    private:
        /* data */
    public:
        vp_frame_face_target(int x, 
                            int y, 
                            int width, 
                            int height, 
                            float score, 
                            std::vector<std::pair<int, int>> key_points = std::vector<std::pair<int, int>>(), 
                            std::vector<float> embeddings = std::vector<float>());
        ~vp_frame_face_target();
 
        // x of top left
        int x;
        // y of top left
        int y;
        // width of rect
        int width;
        // height of rect
        int height;
 
        // confidence
        float score;
 
        // feature vector created by infer nodes such as vp_sface_feature_encoder_node.
        // embeddings can be used for face recognize or other reid works.
        std::vector<float> embeddings;
 
        // key points (5 points or more)
        std::vector<std::pair<int, int>> key_points;
 
        // track id filled by vp_track_node (child class) if it exists.
        int track_id = -1;
        // cache of track rects in the previous frames, filled by track node if it exists. 
        // we can draw / analyse depend on these track rects later.
        std::vector<vp_objects::vp_rect> tracks;
        
        // clone myself
        std::shared_ptr<vp_frame_face_target> clone();
 
        // rect area of target
        vp_rect get_rect() const;
    };
 
}