Loading...
Searching...
No Matches
openshot::TrackedObjectBBox Class Reference

This class contains the properties of a tracked object and functions to manipulate it. More...

`#include <TrackedObjectBBox.h>`

Inheritance diagram for openshot::TrackedObjectBBox:

## Public Member Functions

Json::Value | add_property_json (std::string name, float value, std::string type, std::string memo, const Keyframe *keyframe, float min_value, float max_value, bool readonly, int64_t requested_frame) const
void | AddBox (int64_t _frame_num, float _cx, float _cy, float _width, float _height, float _angle) override
| Add a BBox to the BoxVec map.
void | clear ()
| Clear the BoxVec map.
bool | Contains (int64_t frame_number) const
| Check if there is a bounding-box in the given frame.
bool | ExactlyContains (int64_t frame_number) const override
| Check if there is a bounding-box in the exact frame number.
double | FrameNToTime (int64_t frame_number, double time_scale) const
| Get the time of the given frame.
Fraction | GetBaseFPS ()
| Return the object's BaseFps.
BBox | GetBox (int64_t frame_number)
| Return a bounding-box from BoxVec with it's properties adjusted by the Keyframes.
BBox | GetBox (int64_t frame_number) const
| Const-cast of the GetBox function, so that it can be called inside other cont function.
std::map< std::string, float > | GetBoxValues (int64_t frame_number) const override
| Return a map that contains the bounding box properties and it's keyframes indexed by their names.
int64_t | GetLength () const
| Get the size of BoxVec map.
std::map< std::string, float > | GetParentClipProperties (int64_t frame_number) const override
| Return a map that contains the properties of this object's parent clip.
BBox | InterpolateBoxes (double t1, double t2, BBox left, BBox right, double target)
| Interpolate the bouding-boxes properties.
std::string | Json () const override
| Get and Set JSON methods.
Json::Value | JsonValue () const override
| Generate Json::Value for this object.
bool | LoadBoxData (std::string inputFilePath)
| Load the bounding-boxes information from the protobuf file.
Json::Value | PropertiesJSON (int64_t requested_frame) const override
void | RemoveBox (int64_t frame_number)
| Remove a bounding-box from the BoxVec map.
void | ScalePoints (double scale) override
| Update the TimeScale member variable.
void | SetBaseFPS (Fraction fps)
| Update object's BaseFps.
void | SetJson (const std::string value) override
| Load JSON string into this object.
void | SetJsonValue (const Json::Value root) override
| Load Json::Value into this object.
| TrackedObjectBBox ()
| Default Constructor.
| TrackedObjectBBox (int Red, int Green, int Blue, int Alfa)
Public Member Functions inherited from openshot::TrackedObjectBase
Json::Value | add_property_choice_json (std::string name, int value, int selected_value) const
| Generate JSON choice for a property (dropdown properties)
std::string | ChildClipId () const
| Get and set the Id of the childClip of this object.
void | ChildClipId (std::string _childClipId)
std::string | Id () const
| Get the id of this object.
void | Id (std::string _id)
| Set the id of this object.
ClipBase * | ParentClip () const
| Get and set the parentClip of this object.
void | ParentClip (ClipBase *clip)
| TrackedObjectBase ()
| Default constructor.
| TrackedObjectBase (std::string _id)
| Constructor which takes an object ID.
virtual | ~TrackedObjectBase ()=default
| Destructor.

## Public Attributes

Color | background
| Background fill color.
Keyframe | background_alpha
| Background box opacity.
Keyframe | background_corner
| Radius of rounded corners.
std::map< double, BBox > | BoxVec
| Index the bounding-box by time of each frame.
Keyframe | delta_x
| X-direction displacement Keyframe.
Keyframe | delta_y
| Y-direction displacement Keyframe.
std::string | protobufDataPath
| Path to the protobuf file that holds the bounding box points across the frames.
Keyframe | rotation
| Rotation Keyframe.
Keyframe | scale_x
| X-direction scale Keyframe.
Keyframe | scale_y
| Y-direction scale Keyframe.
Color | stroke
| Border line color.
Keyframe | stroke_alpha
| Stroke box opacity.
Keyframe | stroke_width
| Thickness of border line.
Public Attributes inherited from openshot::TrackedObjectBase
Keyframe | draw_box
Keyframe | visible

## Additional Inherited Members

Protected Attributes inherited from openshot::TrackedObjectBase
std::string | childClipId
std::string | id
ClipBase * | parentClip

## Detailed Description

This class contains the properties of a tracked object and functions to manipulate it.

The bounding-box displacement in X and Y directions, it's width, height and rotation variation over the frames are set as openshot::Keyframe objects.

The bounding-box information over the clip's frames are saved into a protobuf file and loaded into an object of this class.

Definition at line 130 of file TrackedObjectBBox.h.

## Constructor & Destructor Documentation

## TrackedObjectBBox() [1/2]

TrackedObjectBBox::TrackedObjectBBox | ( |  | ) |

Default Constructor.

Definition at line 28 of file TrackedObjectBBox.cpp.

## TrackedObjectBBox() [2/2]

TrackedObjectBBox::TrackedObjectBBox | ( | int | Red,
|  | int | Green,
|  | int | Blue,
|  | int | Alfa
| ) |  |

Definition at line 33 of file TrackedObjectBBox.cpp.

## Member Function Documentation

## add_property_json()

Json::Value TrackedObjectBBox::add_property_json | ( | std::string | name,
|  | float | value,
|  | std::string | type,
|  | std::string | memo,
|  | const Keyframe * | keyframe,
|  | float | min_value,
|  | float | max_value,
|  | bool | readonly,
|  | int64_t | requested_frame
| ) |  | const

Definition at line 471 of file TrackedObjectBBox.cpp.

Referenced by PropertiesJSON().

## AddBox()

void TrackedObjectBBox::AddBox | ( | int64_t | _frame_num,
|  | float | _cx,
|  | float | _cy,
|  | float | _width,
|  | float | _height,
|  | float | _angle
| ) |  |

override virtual

Add a BBox to the BoxVec map.

Reimplemented from openshot::TrackedObjectBase.

Definition at line 46 of file TrackedObjectBBox.cpp.

Referenced by LoadBoxData(), and openshot::ObjectDetection::LoadObjDetectdData().

## clear()

void TrackedObjectBBox::clear | ( |  | ) |

Clear the BoxVec map.

Definition at line 295 of file TrackedObjectBBox.cpp.

Referenced by LoadBoxData().

## Contains()

bool TrackedObjectBBox::Contains | ( | int64_t | frame_number | ) | const

Check if there is a bounding-box in the given frame.

Definition at line 83 of file TrackedObjectBBox.cpp.

## ExactlyContains()

bool TrackedObjectBBox::ExactlyContains | ( | int64_t | frame_number | ) | const

override virtual

Check if there is a bounding-box in the exact frame number.

Reimplemented from openshot::TrackedObjectBase.

Definition at line 97 of file TrackedObjectBBox.cpp.

## FrameNToTime()

double TrackedObjectBBox::FrameNToTime | ( | int64_t | frame_number,
|  | double | time_scale
| ) |  | const

Get the time of the given frame.

Definition at line 224 of file TrackedObjectBBox.cpp.

Referenced by AddBox(), Contains(), ExactlyContains(), GetBox(), and RemoveBox().

## GetBaseFPS()

Fraction TrackedObjectBBox::GetBaseFPS | ( |  | ) |

Return the object's BaseFps.

Definition at line 219 of file TrackedObjectBBox.cpp.

## GetBox() [1/2]

BBox TrackedObjectBBox::GetBox | ( | int64_t | frame_number | ) |

Return a bounding-box from BoxVec with it's properties adjusted by the Keyframes.

Definition at line 126 of file TrackedObjectBBox.cpp.

Referenced by GetBox(), GetBoxValues(), and PropertiesJSON().

## GetBox() [2/2]

BBox openshot::TrackedObjectBBox::GetBox | ( | int64_t | frame_number | ) | const

inline

Const-cast of the GetBox function, so that it can be called inside other cont function.

Definition at line 182 of file TrackedObjectBBox.h.

## GetBoxValues()

std::map< std::string, float > TrackedObjectBBox::GetBoxValues | ( | int64_t | frame_number | ) | const

override virtual

Return a map that contains the bounding box properties and it's keyframes indexed by their names.

Reimplemented from openshot::TrackedObjectBase.

Definition at line 508 of file TrackedObjectBBox.cpp.

## GetLength()

int64_t TrackedObjectBBox::GetLength | ( |  | ) | const

Get the size of BoxVec map.

Definition at line 73 of file TrackedObjectBBox.cpp.

## GetParentClipProperties()

std::map< std::string, float > TrackedObjectBBox::GetParentClipProperties | ( | int64_t | frame_number | ) | const

override virtual

Return a map that contains the properties of this object's parent clip.

Reimplemented from openshot::TrackedObjectBase.

Definition at line 535 of file TrackedObjectBBox.cpp.

## InterpolateBoxes()

BBox TrackedObjectBBox::InterpolateBoxes | ( | double | t1,
|  | double | t2,
|  | BBox | left,
|  | BBox | right,
|  | double | target
| ) |  |

Interpolate the bouding-boxes properties.

Definition at line 179 of file TrackedObjectBBox.cpp.

Referenced by GetBox().

## Json()

std::string TrackedObjectBBox::Json | ( |  | ) | const

override virtual

Get and Set JSON methods.

Generate JSON string of this object

Implements openshot::TrackedObjectBase.

Definition at line 301 of file TrackedObjectBBox.cpp.

## JsonValue()

Json::Value TrackedObjectBBox::JsonValue | ( |  | ) | const

override virtual

Generate Json::Value for this object.

Implements openshot::TrackedObjectBase.

Definition at line 308 of file TrackedObjectBBox.cpp.

Referenced by Json().

## LoadBoxData()

bool TrackedObjectBBox::LoadBoxData | ( | std::string | inputFilePath | ) |

Load the bounding-boxes information from the protobuf file.

Definition at line 236 of file TrackedObjectBBox.cpp.

## PropertiesJSON()

Json::Value TrackedObjectBBox::PropertiesJSON | ( | int64_t | requested_frame | ) | const

override virtual

Get all properties for a specific frame (perfect for a UI to display the current state of all properties at any time)

Implements openshot::TrackedObjectBase.

Definition at line 420 of file TrackedObjectBBox.cpp.

## RemoveBox()

void TrackedObjectBBox::RemoveBox | ( | int64_t | frame_number | ) |

Remove a bounding-box from the BoxVec map.

Definition at line 111 of file TrackedObjectBBox.cpp.

## ScalePoints()

void TrackedObjectBBox::ScalePoints | ( | double | scale | ) |

override virtual

Update the TimeScale member variable.

Reimplemented from openshot::TrackedObjectBase.

Definition at line 231 of file TrackedObjectBBox.cpp.

Referenced by SetJsonValue().

## SetBaseFPS()

void TrackedObjectBBox::SetBaseFPS | ( | Fraction | fps | ) |

Update object's BaseFps.

Definition at line 213 of file TrackedObjectBBox.cpp.

## SetJson()

void TrackedObjectBBox::SetJson | ( | const std::string | value | ) |

override virtual

Load JSON string into this object.

Implements openshot::TrackedObjectBase.

Definition at line 340 of file TrackedObjectBBox.cpp.

## SetJsonValue()

void TrackedObjectBBox::SetJsonValue | ( | const Json::Value | root | ) |

override virtual

Load Json::Value into this object.

Implements openshot::TrackedObjectBase.

Definition at line 358 of file TrackedObjectBBox.cpp.

Referenced by SetJson().

## Member Data Documentation

## background

Color openshot::TrackedObjectBBox::background

Background fill color.

Definition at line 148 of file TrackedObjectBBox.h.

Referenced by JsonValue(), PropertiesJSON(), and SetJsonValue().

## background_alpha

Keyframe openshot::TrackedObjectBBox::background_alpha

Background box opacity.

Definition at line 143 of file TrackedObjectBBox.h.

Referenced by JsonValue(), PropertiesJSON(), and SetJsonValue().

## background_corner

Keyframe openshot::TrackedObjectBBox::background_corner

Radius of rounded corners.

Definition at line 144 of file TrackedObjectBBox.h.

Referenced by JsonValue(), PropertiesJSON(), and SetJsonValue().

## BoxVec

std::map<double, BBox> openshot::TrackedObjectBBox::BoxVec

Index the bounding-box by time of each frame.

Definition at line 137 of file TrackedObjectBBox.h.

Referenced by AddBox(), clear(), Contains(), ExactlyContains(), GetBox(), GetLength(), and RemoveBox().

## delta_x

Keyframe openshot::TrackedObjectBBox::delta_x

X-direction displacement Keyframe.

Definition at line 138 of file TrackedObjectBBox.h.

Referenced by GetBox(), GetBoxValues(), JsonValue(), PropertiesJSON(), and SetJsonValue().

## delta_y

Keyframe openshot::TrackedObjectBBox::delta_y

Y-direction displacement Keyframe.

Definition at line 139 of file TrackedObjectBBox.h.

Referenced by GetBox(), GetBoxValues(), JsonValue(), PropertiesJSON(), and SetJsonValue().

## protobufDataPath

std::string openshot::TrackedObjectBBox::protobufDataPath

Path to the protobuf file that holds the bounding box points across the frames.

Definition at line 150 of file TrackedObjectBBox.h.

Referenced by SetJsonValue().

## rotation

Keyframe openshot::TrackedObjectBBox::rotation

Rotation Keyframe.

Definition at line 142 of file TrackedObjectBBox.h.

Referenced by GetBox(), GetBoxValues(), JsonValue(), PropertiesJSON(), and SetJsonValue().

## scale_x

Keyframe openshot::TrackedObjectBBox::scale_x

X-direction scale Keyframe.

Definition at line 140 of file TrackedObjectBBox.h.

Referenced by GetBox(), GetBoxValues(), JsonValue(), PropertiesJSON(), and SetJsonValue().

## scale_y

Keyframe openshot::TrackedObjectBBox::scale_y

Y-direction scale Keyframe.

Definition at line 141 of file TrackedObjectBBox.h.

Referenced by GetBox(), GetBoxValues(), JsonValue(), PropertiesJSON(), and SetJsonValue().

## stroke

Color openshot::TrackedObjectBBox::stroke

Border line color.

Definition at line 147 of file TrackedObjectBBox.h.

Referenced by JsonValue(), PropertiesJSON(), and SetJsonValue().

## stroke_alpha

Keyframe openshot::TrackedObjectBBox::stroke_alpha

Stroke box opacity.

Definition at line 146 of file TrackedObjectBBox.h.

Referenced by JsonValue(), PropertiesJSON(), and SetJsonValue().

## stroke_width

Keyframe openshot::TrackedObjectBBox::stroke_width

Thickness of border line.

Definition at line 145 of file TrackedObjectBBox.h.

Referenced by JsonValue(), PropertiesJSON(), and SetJsonValue().

The documentation for this class was generated from the following files:

- TrackedObjectBBox.h
- TrackedObjectBBox.cpp