Loading...
Searching...
No Matches
Tracker.h
Go to the documentation of this file.
// Copyright (c) 2008-2019 OpenShot Studios, LLC
//
// SPDX-License-Identifier: LGPL-3.0-or-later
#ifndef OPENSHOT_TRACKER_EFFECT_H
#define OPENSHOT_TRACKER_EFFECT_H
#include <string>
#include <memory>
#include <map>
#include "EffectBase.h"
#include "Json.h"
#include "KeyFrame.h"
#include "TrackedObjectBBox.h"
namespace openshot
{
// Forwards decls
class Frame;
class TrackedObjectBBox;
class Tracker : public EffectBase
{
private:
void init_effect_details();
Fraction BaseFPS;
double TimeScale;
public:
std::string protobuf_data_path;
std::shared_ptr<TrackedObjectBBox> trackedData;
Tracker();
Tracker(std::string clipTrackerDataPath);
std::shared_ptr<Frame> GetFrame(std::shared_ptr<Frame> frame, int64_t frame_number) override;
std::shared_ptr<openshot::Frame>
GetFrame(int64_t frame_number) override {
return GetFrame(std::shared_ptr<Frame>(new Frame()), frame_number);
}
std::string GetVisibleObjects(int64_t frame_number) const override;
void DrawRectangleRGBA(cv::Mat &frame_image, cv::RotatedRect box, std::vector<int> color, float alpha, int thickness, bool is_background);
// Get and Set JSON methods
std::string Json() const override;
void SetJson(const std::string value) override;
Json::Value JsonValue() const override;
void SetJsonValue(const Json::Value root) override;
std::string PropertiesJSON(int64_t requested_frame) const override;
};
}
#endif
EffectBase.h
Header file for EffectBase class.
Json.h
Header file for JSON class.
KeyFrame.h
Header file for the Keyframe class.
TrackedObjectBBox.h
Header file for the TrackedObjectBBox class.
openshot::EffectBase
This abstract class is the base class, used by all effects in libopenshot.
Definition EffectBase.h:53
openshot::Fraction
This class represents a fraction.
Definition Fraction.h:30
openshot::Frame
This class represents a single frame of video (i.e. image & audio data)
Definition Frame.h:91
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:42
openshot::Tracker::Json
std::string Json() const override
Generate JSON string of this object.
Definition Tracker.cpp:234
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:212
openshot::Tracker::JsonValue
Json::Value JsonValue() const override
Generate Json::Value for this object.
Definition Tracker.cpp:241
openshot::Tracker::SetJson
void SetJson(const std::string value) override
Load JSON string into this object.
Definition Tracker.cpp:267
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:86
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::PropertiesJSON
std::string PropertiesJSON(int64_t requested_frame) const override
Definition Tracker.cpp:338
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::SetJsonValue
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Definition Tracker.cpp:285
openshot::Tracker::Tracker
Tracker()
Default constructor.
Definition Tracker.cpp:52
openshot::Tracker::DrawRectangleRGBA
void DrawRectangleRGBA(cv::Mat &frame_image, cv::RotatedRect box, std::vector< int > color, float alpha, int thickness, bool is_background)
Definition Tracker.cpp:171
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
This namespace is the default namespace for all code in the openshot library.
Definition Compressor.h:29