OpenShot Library | libopenshot 0.2.7
|
This class contains the properties of a tracked object and functions to manipulate it. More...
#include <TrackedObjectBBox.h>
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. More... | |
void | clear () |
Clear the BoxVec map. More... | |
bool | Contains (int64_t frame_number) const |
Check if there is a bounding-box in the given frame. More... | |
bool | ExactlyContains (int64_t frame_number) const override |
Check if there is a bounding-box in the exact frame number. More... | |
double | FrameNToTime (int64_t frame_number, double time_scale) const |
Get the time of the given frame. More... | |
Fraction | GetBaseFPS () |
Return the object's BaseFps. More... | |
BBox | GetBox (int64_t frame_number) |
Return a bounding-box from BoxVec with it's properties adjusted by the Keyframes. More... | |
BBox | GetBox (int64_t frame_number) const |
Const-cast of the GetBox function, so that it can be called inside other cont function. More... | |
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. More... | |
int64_t | GetLength () const |
Get the size of BoxVec map. More... | |
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. More... | |
BBox | InterpolateBoxes (double t1, double t2, BBox left, BBox right, double target) |
Interpolate the bouding-boxes properties. More... | |
std::string | Json () const override |
Get and Set JSON methods. More... | |
Json::Value | JsonValue () const override |
Generate Json::Value for this object. More... | |
bool | LoadBoxData (std::string inputFilePath) |
Load the bounding-boxes information from the protobuf file. More... | |
Json::Value | PropertiesJSON (int64_t requested_frame) const override |
void | RemoveBox (int64_t frame_number) |
Remove a bounding-box from the BoxVec map. More... | |
void | ScalePoints (double scale) override |
Update the TimeScale member variable. More... | |
void | SetBaseFPS (Fraction fps) |
Update object's BaseFps. More... | |
void | SetJson (const std::string value) override |
Load JSON string into this object. More... | |
void | SetJsonValue (const Json::Value root) override |
Load Json::Value into this object. More... | |
TrackedObjectBBox () | |
Default Constructor. More... | |
TrackedObjectBBox (int Red, int Green, int Blue, int Alfa) | |
![]() | |
Json::Value | add_property_choice_json (std::string name, int value, int selected_value) const |
Generate JSON choice for a property (dropdown properties) More... | |
virtual void | AddBox (int64_t _frame_num, float _cx, float _cy, float _width, float _height, float _angle) |
Add a bounding box to the tracked object's BoxVec map. More... | |
std::string | ChildClipId () const |
Get and set the Id of the childClip of this object. More... | |
void | ChildClipId (std::string _childClipId) |
virtual bool | ExactlyContains (int64_t frame_number) const |
Check if there is data for the exact frame number. More... | |
virtual std::map< std::string, float > | GetBoxValues (int64_t frame_number) const |
Return the main properties of a TrackedObjectBBox instance - such as position, size and rotation. More... | |
virtual std::map< std::string, float > | GetParentClipProperties (int64_t frame_number) const |
Return the main properties of the tracked object's parent clip - such as position, size and rotation. More... | |
std::string | Id () const |
Get the id of this object. More... | |
void | Id (std::string _id) |
Set the id of this object. More... | |
virtual std::string | Json () const =0 |
Get and Set JSON methods. More... | |
virtual Json::Value | JsonValue () const =0 |
Generate Json::Value for this object. More... | |
ClipBase * | ParentClip () const |
Get and set the parentClip of this object. More... | |
void | ParentClip (ClipBase *clip) |
virtual Json::Value | PropertiesJSON (int64_t requested_frame) const =0 |
virtual void | ScalePoints (double scale) |
Scale an object's property. More... | |
virtual void | SetJson (const std::string value)=0 |
Load JSON string into this object. More... | |
virtual void | SetJsonValue (const Json::Value root)=0 |
Load Json::Value into this object. More... | |
TrackedObjectBase () | |
Default constructor. More... | |
TrackedObjectBase (std::string _id) | |
Constructor which takes an object ID. More... | |
virtual | ~TrackedObjectBase ()=default |
Destructor. More... | |
Public Attributes | |
Color | background |
Background fill color. More... | |
Keyframe | background_alpha |
Background box opacity. More... | |
Keyframe | background_corner |
Radius of rounded corners. More... | |
std::map< double, BBox > | BoxVec |
Index the bounding-box by time of each frame. More... | |
Keyframe | delta_x |
X-direction displacement Keyframe. More... | |
Keyframe | delta_y |
Y-direction displacement Keyframe. More... | |
std::string | protobufDataPath |
Path to the protobuf file that holds the bounding box points across the frames. More... | |
Keyframe | rotation |
Rotation Keyframe. More... | |
Keyframe | scale_x |
X-direction scale Keyframe. More... | |
Keyframe | scale_y |
Y-direction scale Keyframe. More... | |
Color | stroke |
Border line color. More... | |
Keyframe | stroke_alpha |
Stroke box opacity. More... | |
Keyframe | stroke_width |
Thickness of border line. More... | |
![]() | |
Keyframe | draw_box |
Keyframe | visible |
Additional Inherited Members | |
![]() | |
std::string | childClipId |
std::string | id |
ClipBase * | parentClip |
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 148 of file TrackedObjectBBox.h.
TrackedObjectBBox::TrackedObjectBBox | ( | ) |
Default Constructor.
Definition at line 44 of file TrackedObjectBBox.cpp.
TrackedObjectBBox::TrackedObjectBBox | ( | int | Red, |
int | Green, | ||
int | Blue, | ||
int | Alfa | ||
) |
Definition at line 49 of file TrackedObjectBBox.cpp.
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 490 of file TrackedObjectBBox.cpp.
Referenced by PropertiesJSON().
|
overridevirtual |
Add a BBox to the BoxVec map.
Reimplemented from openshot::TrackedObjectBase.
Definition at line 62 of file TrackedObjectBBox.cpp.
Referenced by LoadBoxData(), and openshot::ObjectDetection::LoadObjDetectdData().
void TrackedObjectBBox::clear | ( | ) |
Clear the BoxVec map.
Definition at line 311 of file TrackedObjectBBox.cpp.
Referenced by LoadBoxData().
bool TrackedObjectBBox::Contains | ( | int64_t | frame_number | ) | const |
Check if there is a bounding-box in the given frame.
Definition at line 99 of file TrackedObjectBBox.cpp.
|
overridevirtual |
Check if there is a bounding-box in the exact frame number.
Reimplemented from openshot::TrackedObjectBase.
Definition at line 113 of file TrackedObjectBBox.cpp.
double TrackedObjectBBox::FrameNToTime | ( | int64_t | frame_number, |
double | time_scale | ||
) | const |
Get the time of the given frame.
Definition at line 240 of file TrackedObjectBBox.cpp.
Referenced by AddBox(), Contains(), ExactlyContains(), GetBox(), and RemoveBox().
Fraction TrackedObjectBBox::GetBaseFPS | ( | ) |
Return the object's BaseFps.
Definition at line 235 of file TrackedObjectBBox.cpp.
BBox TrackedObjectBBox::GetBox | ( | int64_t | frame_number | ) |
Return a bounding-box from BoxVec with it's properties adjusted by the Keyframes.
Definition at line 142 of file TrackedObjectBBox.cpp.
Referenced by GetBox(), GetBoxValues(), and PropertiesJSON().
|
inline |
Const-cast of the GetBox function, so that it can be called inside other cont function.
Definition at line 200 of file TrackedObjectBBox.h.
|
overridevirtual |
Return a map that contains the bounding box properties and it's keyframes indexed by their names.
Reimplemented from openshot::TrackedObjectBase.
Definition at line 527 of file TrackedObjectBBox.cpp.
int64_t TrackedObjectBBox::GetLength | ( | ) | const |
Get the size of BoxVec map.
Definition at line 89 of file TrackedObjectBBox.cpp.
|
overridevirtual |
Return a map that contains the properties of this object's parent clip.
Reimplemented from openshot::TrackedObjectBase.
Definition at line 554 of file TrackedObjectBBox.cpp.
BBox TrackedObjectBBox::InterpolateBoxes | ( | double | t1, |
double | t2, | ||
BBox | left, | ||
BBox | right, | ||
double | target | ||
) |
Interpolate the bouding-boxes properties.
Definition at line 195 of file TrackedObjectBBox.cpp.
Referenced by GetBox().
|
overridevirtual |
Get and Set JSON methods.
Generate JSON string of this object
Implements openshot::TrackedObjectBase.
Definition at line 317 of file TrackedObjectBBox.cpp.
|
overridevirtual |
Generate Json::Value for this object.
Implements openshot::TrackedObjectBase.
Definition at line 324 of file TrackedObjectBBox.cpp.
Referenced by Json().
bool TrackedObjectBBox::LoadBoxData | ( | std::string | inputFilePath | ) |
Load the bounding-boxes information from the protobuf file.
Definition at line 252 of file TrackedObjectBBox.cpp.
|
overridevirtual |
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 439 of file TrackedObjectBBox.cpp.
void TrackedObjectBBox::RemoveBox | ( | int64_t | frame_number | ) |
Remove a bounding-box from the BoxVec map.
Definition at line 127 of file TrackedObjectBBox.cpp.
|
overridevirtual |
Update the TimeScale member variable.
Reimplemented from openshot::TrackedObjectBase.
Definition at line 247 of file TrackedObjectBBox.cpp.
Referenced by SetJsonValue().
void TrackedObjectBBox::SetBaseFPS | ( | Fraction | fps | ) |
Update object's BaseFps.
Definition at line 229 of file TrackedObjectBBox.cpp.
|
overridevirtual |
Load JSON string into this object.
Implements openshot::TrackedObjectBase.
Definition at line 356 of file TrackedObjectBBox.cpp.
|
overridevirtual |
Load Json::Value into this object.
Implements openshot::TrackedObjectBase.
Definition at line 374 of file TrackedObjectBBox.cpp.
Referenced by SetJson().
Color openshot::TrackedObjectBBox::background |
Background fill color.
Definition at line 166 of file TrackedObjectBBox.h.
Referenced by JsonValue(), PropertiesJSON(), and SetJsonValue().
Keyframe openshot::TrackedObjectBBox::background_alpha |
Background box opacity.
Definition at line 161 of file TrackedObjectBBox.h.
Referenced by JsonValue(), PropertiesJSON(), and SetJsonValue().
Keyframe openshot::TrackedObjectBBox::background_corner |
Radius of rounded corners.
Definition at line 162 of file TrackedObjectBBox.h.
Referenced by JsonValue(), PropertiesJSON(), and SetJsonValue().
std::map<double, BBox> openshot::TrackedObjectBBox::BoxVec |
Index the bounding-box by time of each frame.
Definition at line 155 of file TrackedObjectBBox.h.
Referenced by AddBox(), clear(), Contains(), ExactlyContains(), GetBox(), GetLength(), and RemoveBox().
Keyframe openshot::TrackedObjectBBox::delta_x |
X-direction displacement Keyframe.
Definition at line 156 of file TrackedObjectBBox.h.
Referenced by GetBox(), GetBoxValues(), JsonValue(), PropertiesJSON(), and SetJsonValue().
Keyframe openshot::TrackedObjectBBox::delta_y |
Y-direction displacement Keyframe.
Definition at line 157 of file TrackedObjectBBox.h.
Referenced by GetBox(), GetBoxValues(), JsonValue(), PropertiesJSON(), and SetJsonValue().
std::string openshot::TrackedObjectBBox::protobufDataPath |
Path to the protobuf file that holds the bounding box points across the frames.
Definition at line 168 of file TrackedObjectBBox.h.
Referenced by SetJsonValue().
Keyframe openshot::TrackedObjectBBox::rotation |
Rotation Keyframe.
Definition at line 160 of file TrackedObjectBBox.h.
Referenced by GetBox(), GetBoxValues(), JsonValue(), PropertiesJSON(), and SetJsonValue().
Keyframe openshot::TrackedObjectBBox::scale_x |
X-direction scale Keyframe.
Definition at line 158 of file TrackedObjectBBox.h.
Referenced by GetBox(), GetBoxValues(), JsonValue(), PropertiesJSON(), and SetJsonValue().
Keyframe openshot::TrackedObjectBBox::scale_y |
Y-direction scale Keyframe.
Definition at line 159 of file TrackedObjectBBox.h.
Referenced by GetBox(), GetBoxValues(), JsonValue(), PropertiesJSON(), and SetJsonValue().
Color openshot::TrackedObjectBBox::stroke |
Border line color.
Definition at line 165 of file TrackedObjectBBox.h.
Referenced by JsonValue(), PropertiesJSON(), and SetJsonValue().
Keyframe openshot::TrackedObjectBBox::stroke_alpha |
Stroke box opacity.
Definition at line 164 of file TrackedObjectBBox.h.
Referenced by JsonValue(), PropertiesJSON(), and SetJsonValue().
Keyframe openshot::TrackedObjectBBox::stroke_width |
Thickness of border line.
Definition at line 163 of file TrackedObjectBBox.h.
Referenced by JsonValue(), PropertiesJSON(), and SetJsonValue().