MCPcopy Create free account
hub / github.com/OpenShot/libopenshot / AddBox

Method AddBox

src/TrackedObjectBBox.cpp:45–69  ·  view source on GitHub ↗

Add a BBox to the BoxVec map

Source from the content-addressed store, hash-verified

43
44// Add a BBox to the BoxVec map
45void TrackedObjectBBox::AddBox(int64_t _frame_num, float _cx, float _cy, float _width, float _height, float _angle)
46{
47 // Check if the given frame number is valid
48 if (_frame_num < 0)
49 return;
50
51 // Instantiate a new bounding-box
52 BBox newBBox = BBox(_cx, _cy, _width, _height, _angle);
53
54 // Get the time of given frame
55 double time = this->FrameNToTime(_frame_num, 1.0);
56 // Create an iterator that points to the BoxVec pair indexed by the time of given frame
57 auto BBoxIterator = BoxVec.find(time);
58
59 if (BBoxIterator != BoxVec.end())
60 {
61 // There is a bounding-box indexed by the time of given frame, update-it
62 BBoxIterator->second = newBBox;
63 }
64 else
65 {
66 // There isn't a bounding-box indexed by the time of given frame, insert a new one
67 BoxVec.insert({time, newBBox});
68 }
69}
70
71// Get the size of BoxVec map
72int64_t TrackedObjectBBox::GetLength() const

Callers 3

LoadBoxDataMethod · 0.95
LoadObjDetectdDataMethod · 0.45
KeyFrame.cppFile · 0.45

Calls 2

FrameNToTimeMethod · 0.95
BBoxClass · 0.85

Tested by

no test coverage detected