Added support to insert the image of a clip inside a Tracked Object

This commit is contained in:
Brenno
2021-02-04 15:45:33 -03:00
parent 2e47325c8f
commit d24c2e451c
5 changed files with 63 additions and 1 deletions

View File

@@ -46,6 +46,7 @@ TrackedObjectBBox::TrackedObjectBBox() : delta_x(0.0), delta_y(0.0), scale_x(1.0
return;
}
// Add a BBox to the BoxVec map
void TrackedObjectBBox::AddBox(int64_t _frame_num, float _cx, float _cy, float _width, float _height, float _angle)
{
@@ -316,6 +317,7 @@ Json::Value TrackedObjectBBox::JsonValue() const
root["BaseFPS"]["num"] = BaseFps.num;
root["BaseFPS"]["den"] = BaseFps.den;
root["TimeScale"] = TimeScale;
root["child_clip_id"] = ChildClipId();
// Keyframe's properties
root["delta_x"] = delta_x.JsonValue();
@@ -375,6 +377,10 @@ void TrackedObjectBBox::SetJsonValue(const Json::Value root)
if (!root["protobuf_data_path"].isNull())
protobufDataPath = root["protobuf_data_path"].asString();
// Set the id of the child clio
if (!root["child_clip_id"].isNull())
ChildClipId(root["child_clip_id"].asString());
// Set the Keyframes by the given JSON object
if (!root["delta_x"].isNull())
delta_x.SetJsonValue(root["delta_x"]);
@@ -403,6 +409,9 @@ Json::Value TrackedObjectBBox::PropertiesJSON(int64_t requested_frame) const
// Add the ID of this object to the JSON object
root["box_id"] = add_property_json("Box ID", 0.0, "string", Id(), NULL, -1, -1, true, requested_frame);
// Add the ID of this object's child clip to the JSON object
root["child_clip_id"] = add_property_json("Child Clip ID", 0.0, "string", ChildClipId(), NULL, -1, -1, false, requested_frame);
// Add the data of given frame bounding-box to the JSON object
root["x1"] = add_property_json("X1", box.cx-(box.width/2), "float", "", NULL, 0.0, 1.0, false, requested_frame);
root["y1"] = add_property_json("Y1", box.cy-(box.height/2), "float", "", NULL, 0.0, 1.0, false, requested_frame);