OpenShot Library | libopenshot  0.3.3
Tracker.h
Go to the documentation of this file.
1 
10 // Copyright (c) 2008-2019 OpenShot Studios, LLC
11 //
12 // SPDX-License-Identifier: LGPL-3.0-or-later
13 
14 #ifndef OPENSHOT_TRACKER_EFFECT_H
15 #define OPENSHOT_TRACKER_EFFECT_H
16 
17 #include <string>
18 #include <memory>
19 #include <map>
20 
21 #include "EffectBase.h"
22 
23 #include "Json.h"
24 #include "KeyFrame.h"
25 
26 #include "TrackedObjectBBox.h"
27 
28 namespace openshot
29 {
30  // Forwards decls
31  class Frame;
32  class TrackedObjectBBox;
33 
41  class Tracker : public EffectBase
42  {
43  private:
45  void init_effect_details();
46 
47  Fraction BaseFPS;
48  double TimeScale;
49 
50  public:
51  std::string protobuf_data_path;
52  std::shared_ptr<TrackedObjectBBox> trackedData;
53 
55  Tracker();
56 
57  Tracker(std::string clipTrackerDataPath);
58 
64  std::shared_ptr<Frame> GetFrame(std::shared_ptr<Frame> frame, int64_t frame_number) override;
65 
66  std::shared_ptr<openshot::Frame>
67  GetFrame(int64_t frame_number) override {
68  return GetFrame(std::shared_ptr<Frame>(new Frame()), frame_number);
69  }
70 
72  std::string GetVisibleObjects(int64_t frame_number) const override;
73 
74  // Get and Set JSON methods
75 
77  std::string Json() const override;
79  void SetJson(const std::string value) override;
81  Json::Value JsonValue() const override;
83  void SetJsonValue(const Json::Value root) override;
84 
89  std::string PropertiesJSON(int64_t requested_frame) const override;
90  };
91 
92 }
93 
94 #endif
openshot::Tracker::Json
std::string Json() const override
Generate JSON string of this object.
Definition: Tracker.cpp:161
openshot::EffectBase
This abstract class is the base class, used by all effects in libopenshot.
Definition: EffectBase.h:53
openshot
This namespace is the default namespace for all code in the openshot library.
Definition: Compressor.h:28
openshot::Fraction
This class represents a fraction.
Definition: Fraction.h:30
openshot::Tracker::SetJson
void SetJson(const std::string value) override
Load JSON string into this object.
Definition: Tracker.cpp:194
openshot::Tracker::GetVisibleObjects
std::string GetVisibleObjects(int64_t frame_number) const override
Get the indexes and IDs of all visible objects in the given frame.
Definition: Tracker.cpp:139
openshot::Frame
This class represents a single frame of video (i.e. image & audio data)
Definition: Frame.h:90
EffectBase.h
Header file for EffectBase class.
KeyFrame.h
Header file for the Keyframe class.
openshot::Tracker::PropertiesJSON
std::string PropertiesJSON(int64_t requested_frame) const override
Definition: Tracker.cpp:265
openshot::Tracker::protobuf_data_path
std::string protobuf_data_path
Path to the protobuf file that holds the bounding-box data.
Definition: Tracker.h:51
openshot::Tracker::JsonValue
Json::Value JsonValue() const override
Generate Json::Value for this object.
Definition: Tracker.cpp:168
openshot::Tracker
This class tracks a given object through the clip, draws a box around it and allow the user to attach...
Definition: Tracker.h:41
openshot::Tracker::GetFrame
std::shared_ptr< openshot::Frame > GetFrame(int64_t frame_number) override
This method is required for all derived classes of ClipBase, and returns a new openshot::Frame object...
Definition: Tracker.h:67
openshot::Tracker::trackedData
std::shared_ptr< TrackedObjectBBox > trackedData
Pointer to an object that holds the bounding-box data and it's Keyframes.
Definition: Tracker.h:52
openshot::Tracker::GetFrame
std::shared_ptr< Frame > GetFrame(std::shared_ptr< Frame > frame, int64_t frame_number) override
Apply this effect to an openshot::Frame.
Definition: Tracker.cpp:87
openshot::Tracker::SetJsonValue
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Definition: Tracker.cpp:212
TrackedObjectBBox.h
Header file for the TrackedObjectBBox class.
Json.h
Header file for JSON class.
openshot::Tracker::Tracker
Tracker()
Default constructor.
Definition: Tracker.cpp:53