32 #ifndef OPENSHOT_TRACKEDOBJECTBBOX_H 33 #define OPENSHOT_TRACKEDOBJECTBBOX_H 72 BBox(
float _cx,
float _cy,
float _width,
float _height,
float _angle)
94 root[
"width"] =
width;
96 root[
"angle"] =
angle;
111 catch (
const std::exception &e)
114 throw InvalidJSON(
"JSON is invalid (missing keys or invalid data types)");
123 if (!root[
"cx"].isNull())
124 cx = root[
"cx"].asDouble();
125 if (!root[
"cy"].isNull())
126 cy = root[
"cy"].asDouble();
127 if (!root[
"width"].isNull())
128 width = root[
"width"].asDouble();
129 if (!root[
"height"].isNull())
130 height = root[
"height"].asDouble();
131 if (!root[
"angle"].isNull())
132 angle = root[
"angle"].asDouble();
175 void AddBox(int64_t _frame_num,
float _cx,
float _cy,
float _width,
float _height,
float _angle)
override;
184 void ScalePoints(
double scale)
override;
187 bool Contains(int64_t frame_number)
const;
189 bool ExactlyContains(int64_t frame_number)
const override;
192 int64_t GetLength()
const;
195 void RemoveBox(int64_t frame_number);
198 BBox GetBox(int64_t frame_number);
206 bool LoadBoxData(std::string inputFilePath);
209 double FrameNToTime(int64_t frame_number,
double time_scale)
const;
212 BBox InterpolateBoxes(
double t1,
double t2,
BBox left,
BBox right,
double target);
218 std::string
Json()
const override;
220 void SetJson(
const std::string value)
override;
225 Json::Value PropertiesJSON(int64_t requested_frame)
const override;
228 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;
231 std::map<std::string, float> GetBoxValues(int64_t frame_number)
const override;
233 std::map<std::string, float> GetParentClipProperties(int64_t frame_number)
const override;
Header file for Fraction class.
float cy
y-coordinate of the bounding box center
Keyframe background_alpha
Background box opacity.
Json::Value JsonValue() const
Generate Json::Value for this object.
float height
bounding box height
Keyframe stroke_alpha
Stroke box opacity.
Keyframe delta_y
Y-direction displacement Keyframe.
This abstract class is the base class of all Tracked Objects.
const Json::Value stringToJson(const std::string value)
Header file for the Keyframe class.
float angle
bounding box rotation angle [degrees]
void SetJsonValue(const Json::Value root)
Load Json::Value into this object.
Keyframe stroke_width
Thickness of border line.
Header file for all Exception classes.
Color background
Background fill color.
std::string protobufDataPath
Path to the protobuf file that holds the bounding box points across the frames.
Color stroke
Border line color.
Keyframe delta_x
X-direction displacement Keyframe.
Header file for JSON class.
float width
bounding box width
This class represents a fraction.
std::map< double, BBox > BoxVec
Index the bounding-box by time of each frame.
BBox(float _cx, float _cy, float _width, float _height, float _angle)
This struct holds the information of a bounding-box.
Keyframe scale_y
Y-direction scale Keyframe.
BBox GetBox(int64_t frame_number) const
Const-cast of the GetBox function, so that it can be called inside other cont function.
Header file for Color class.
This class represents a color (used on the timeline and clips)
Keyframe rotation
Rotation Keyframe.
This namespace is the default namespace for all code in the openshot library.
Keyframe scale_x
X-direction scale Keyframe.
float cx
x-coordinate of the bounding box center
Exception for invalid JSON.
void SetJson(const std::string value)
Load JSON string into this object.
Header file for the TrackedObjectBase class.
std::string Json() const
Generate JSON string of this object.
A Keyframe is a collection of Point instances, which is used to vary a number or property over time...
Keyframe background_corner
Radius of rounded corners.
This class contains the properties of a tracked object and functions to manipulate it...