Add a BBox to the BoxVec map
| 43 | |
| 44 | // Add a BBox to the BoxVec map |
| 45 | void 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 |
| 72 | int64_t TrackedObjectBBox::GetLength() const |
no test coverage detected