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
 
 
#include "vp_rect.h"
 
namespace vp_objects {
        
    vp_rect::vp_rect(int x, int y, int width, int height): 
        x(x), 
        y(y), 
        width(width), 
        height(height) {
 
    }
    
    vp_rect::vp_rect(vp_point left_top, vp_size wh):
        x(left_top.x), y(left_top.y), width(wh.width), height(wh.height) {
 
    }
 
 
    vp_rect::~vp_rect() {
 
    }
    
    vp_point vp_rect::center() {
        return vp_point(x + width / 2, y + height / 2);
    }
 
    float vp_rect::iou_with(const vp_rect & rect) {
        return 1.0;
    }
 
    bool vp_rect::contains(const vp_point & p) {
        return true;
    }
 
    vp_point vp_rect::track_point() {
        // by default the center point of box is tracking point.
        return {x + width / 2, y + height/2 };
    }
}