OpenShot Library | libopenshot  0.3.3
Public Member Functions | Public Attributes | List of all members
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:
[legend]
Collaboration diagram for openshot::TrackedObjectBBox:
[legend]

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...
 
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)
 
- 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) More...
 
std::string Id () const
 Get the id of this object. More...
 
void Id (std::string _id)
 Set the id of this object. More...
 
ClipBaseParentClip () const
 Get and set the parentClip of this object. More...
 
void ParentClip (ClipBase *clip)
 
 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, BBoxBoxVec
 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...
 
- Public Attributes inherited from openshot::TrackedObjectBase
Keyframe draw_box
 Keyframe to determine if a specific box is drawn (or hidden) More...
 
Keyframe visible
 Keyframe to track if a box is visible in the current frame (read-only) More...
 

Additional Inherited Members

- Protected Attributes inherited from openshot::TrackedObjectBase
std::string id
 
ClipBaseparentClip
 

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 461 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 
)
overridevirtual

Add a BBox to the BoxVec map.

Reimplemented from openshot::TrackedObjectBase.

Definition at line 45 of file TrackedObjectBBox.cpp.

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

◆ clear()

void TrackedObjectBBox::clear ( )

Clear the BoxVec map.

Definition at line 294 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 82 of file TrackedObjectBBox.cpp.

◆ ExactlyContains()

bool TrackedObjectBBox::ExactlyContains ( int64_t  frame_number) const
overridevirtual

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

Reimplemented from openshot::TrackedObjectBase.

Definition at line 96 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 223 of file TrackedObjectBBox.cpp.

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

◆ GetBaseFPS()

Fraction TrackedObjectBBox::GetBaseFPS ( )

Return the object's BaseFps.

Definition at line 218 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 125 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
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 498 of file TrackedObjectBBox.cpp.

◆ GetLength()

int64_t TrackedObjectBBox::GetLength ( ) const

Get the size of BoxVec map.

Definition at line 72 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 178 of file TrackedObjectBBox.cpp.

Referenced by GetBox().

◆ Json()

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

Get and Set JSON methods.

Generate JSON string of this object

Implements openshot::TrackedObjectBase.

Definition at line 300 of file TrackedObjectBBox.cpp.

◆ JsonValue()

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

Generate Json::Value for this object.

Implements openshot::TrackedObjectBase.

Definition at line 307 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 235 of file TrackedObjectBBox.cpp.

◆ PropertiesJSON()

Json::Value TrackedObjectBBox::PropertiesJSON ( int64_t  requested_frame) const
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 413 of file TrackedObjectBBox.cpp.

◆ RemoveBox()

void TrackedObjectBBox::RemoveBox ( int64_t  frame_number)

Remove a bounding-box from the BoxVec map.

Definition at line 110 of file TrackedObjectBBox.cpp.

◆ ScalePoints()

void TrackedObjectBBox::ScalePoints ( double  scale)
overridevirtual

Update the TimeScale member variable.

Reimplemented from openshot::TrackedObjectBase.

Definition at line 230 of file TrackedObjectBBox.cpp.

Referenced by SetJsonValue().

◆ SetBaseFPS()

void TrackedObjectBBox::SetBaseFPS ( Fraction  fps)

Update object's BaseFps.

Definition at line 212 of file TrackedObjectBBox.cpp.

◆ SetJson()

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

Load JSON string into this object.

Implements openshot::TrackedObjectBase.

Definition at line 338 of file TrackedObjectBBox.cpp.

◆ SetJsonValue()

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

Load Json::Value into this object.

Implements openshot::TrackedObjectBase.

Definition at line 356 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(), openshot::ObjectDetection::LoadObjDetectdData(), 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: