OpenShot Library | libopenshot
0.3.3
|
Go to the documentation of this file.
14 #ifndef OPENSHOT_TRACKEDOBJECTBBOX_H
15 #define OPENSHOT_TRACKEDOBJECTBBOX_H
54 BBox(
float _cx,
float _cy,
float _width,
float _height,
float _angle)
76 root[
"width"] =
width;
78 root[
"angle"] =
angle;
93 catch (
const std::exception &e)
96 throw InvalidJSON(
"JSON is invalid (missing keys or invalid data types)");
105 if (!root[
"cx"].isNull())
106 cx = root[
"cx"].asDouble();
107 if (!root[
"cy"].isNull())
108 cy = root[
"cy"].asDouble();
109 if (!root[
"width"].isNull())
110 width = root[
"width"].asDouble();
111 if (!root[
"height"].isNull())
112 height = root[
"height"].asDouble();
113 if (!root[
"angle"].isNull())
114 angle = root[
"angle"].asDouble();
157 void AddBox(int64_t _frame_num,
float _cx,
float _cy,
float _width,
float _height,
float _angle)
override;
169 bool Contains(int64_t frame_number)
const;
191 double FrameNToTime(int64_t frame_number,
double time_scale)
const;
200 std::string
Json()
const override;
202 void SetJson(
const std::string value)
override;
207 Json::Value
PropertiesJSON(int64_t requested_frame)
const override;
210 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;
213 std::map<std::string, float>
GetBoxValues(int64_t frame_number)
const override;
const Json::Value stringToJson(const std::string value)
Json::Value PropertiesJSON(int64_t requested_frame) const override
Keyframe stroke_alpha
Stroke box opacity.
Keyframe rotation
Rotation Keyframe.
void AddBox(int64_t _frame_num, float _cx, float _cy, float _width, float _height, float _angle) override
Add a BBox to the BoxVec map.
float height
bounding box height
Header file for Fraction class.
bool Contains(int64_t frame_number) const
Check if there is a bounding-box in the given frame.
Json::Value JsonValue() const override
Generate Json::Value for this object.
Color background
Background fill color.
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
This namespace is the default namespace for all code in the openshot library.
Json::Value JsonValue() const
Generate Json::Value for this object.
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
double FrameNToTime(int64_t frame_number, double time_scale) const
Get the time of the given frame.
This class represents a fraction.
float cy
y-coordinate of the bounding box center
void ScalePoints(double scale) override
Update the TimeScale member variable.
This abstract class is the base class of all Tracked Objects.
BBox GetBox(int64_t frame_number) const
Const-cast of the GetBox function, so that it can be called inside other cont function.
std::string Json() const override
Get and Set JSON methods.
Fraction GetBaseFPS()
Return the object's BaseFps.
Header file for the Keyframe class.
Keyframe scale_y
Y-direction scale Keyframe.
This class represents a color (used on the timeline and clips)
float angle
bounding box rotation angle [degrees]
This class contains the properties of a tracked object and functions to manipulate it.
A Keyframe is a collection of Point instances, which is used to vary a number or property over time.
Keyframe scale_x
X-direction scale Keyframe.
Exception for invalid JSON.
BBox GetBox(int64_t frame_number)
Return a bounding-box from BoxVec with it's properties adjusted by the Keyframes.
TrackedObjectBBox()
Default Constructor.
float width
bounding box width
void SetJsonValue(const Json::Value root)
Load Json::Value into this object.
BBox InterpolateBoxes(double t1, double t2, BBox left, BBox right, double target)
Interpolate the bouding-boxes properties.
Keyframe delta_y
Y-direction displacement Keyframe.
void RemoveBox(int64_t frame_number)
Remove a bounding-box from the BoxVec map.
std::map< double, BBox > BoxVec
Index the bounding-box by time of each frame.
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.
void SetJson(const std::string value)
Load JSON string into this object.
Keyframe delta_x
X-direction displacement Keyframe.
This struct holds the information of a bounding-box.
bool LoadBoxData(std::string inputFilePath)
Load the bounding-boxes information from the protobuf file.
void clear()
Clear the BoxVec map.
void SetBaseFPS(Fraction fps)
Update object's BaseFps.
void SetJson(const std::string value) override
Load JSON string into this object.
Color stroke
Border line color.
bool ExactlyContains(int64_t frame_number) const override
Check if there is a bounding-box in the exact frame number.
std::string Json() const
Generate JSON string of this object.
std::string protobufDataPath
Path to the protobuf file that holds the bounding box points across the frames.
BBox(float _cx, float _cy, float _width, float _height, float _angle)
Header file for Color class.
float cx
x-coordinate of the bounding box center
Header file for JSON class.
Keyframe stroke_width
Thickness of border line.
Header file for the TrackedObjectBase class.
Keyframe background_corner
Radius of rounded corners.
Header file for all Exception classes.
Keyframe background_alpha
Background box opacity.
int64_t GetLength() const
Get the size of BoxVec map.