Loading...
Searching...
No Matches
Stabilizer.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_STABILIZER_EFFECT_H
#define OPENSHOT_STABILIZER_EFFECT_H
#include "EffectBase.h"
#include <memory>
#include "Json.h"
#include "KeyFrame.h"
// Store the relative transformation parameters between consecutive frames
struct EffectTransformParam
{
EffectTransformParam() {}
EffectTransformParam(double _dx, double _dy, double _da) {
dx = _dx;
dy = _dy;
da = _da;
}
double dx;
double dy;
double da; // angle
};
// Stores the global camera trajectory for one frame
struct EffectCamTrajectory
{
EffectCamTrajectory() {}
EffectCamTrajectory(double _x, double _y, double _a) {
x = _x;
y = _y;
a = _a;
}
double x;
double y;
double a; // angle
};
namespace openshot
{
// Forwward decls
class Frame;
class Stabilizer : public EffectBase
{
private:
void init_effect_details();
std::string protobuf_data_path;
Keyframe zoom;
public:
std::string teste;
std::map <size_t,EffectCamTrajectory> trajectoryData; // Save camera trajectory data
std::map <size_t,EffectTransformParam> transformationData; // Save transormation data
Stabilizer();
Stabilizer(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::make_shared<openshot::Frame>(), frame_number);
};
bool LoadStabilizedData(std::string inputFilePath);
// 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.
openshot::EffectBase
This abstract class is the base class, used by all effects in libopenshot.
Definition EffectBase.h:53
openshot::Keyframe
A Keyframe is a collection of Point instances, which is used to vary a number or property over time.
Definition KeyFrame.h:53
openshot::Stabilizer
This class stabilizes a video clip to remove undesired shaking and jitter.
Definition Stabilizer.h:67
openshot::Stabilizer::JsonValue
Json::Value JsonValue() const override
Generate Json::Value for this object.
Definition Stabilizer.cpp:164
openshot::Stabilizer::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 Stabilizer.h:94
openshot::Stabilizer::GetFrame
std::shared_ptr< Frame > GetFrame(std::shared_ptr< Frame > frame, int64_t frame_number) override
This method is required for all derived classes of EffectBase, and returns a modified openshot::Frame...
Definition Stabilizer.cpp:63
openshot::Stabilizer::transformationData
std::map< size_t, EffectTransformParam > transformationData
Definition Stabilizer.h:77
openshot::Stabilizer::teste
std::string teste
Definition Stabilizer.h:75
openshot::Stabilizer::PropertiesJSON
std::string PropertiesJSON(int64_t requested_frame) const override
Definition Stabilizer.cpp:213
openshot::Stabilizer::SetJson
void SetJson(const std::string value) override
Load JSON string into this object.
Definition Stabilizer.cpp:177
openshot::Stabilizer::SetJsonValue
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Definition Stabilizer.cpp:194
openshot::Stabilizer::trajectoryData
std::map< size_t, EffectCamTrajectory > trajectoryData
Definition Stabilizer.h:76
openshot::Stabilizer::Stabilizer
Stabilizer()
Definition Stabilizer.cpp:38
openshot::Stabilizer::LoadStabilizedData
bool LoadStabilizedData(std::string inputFilePath)
Load protobuf data file.
Definition Stabilizer.cpp:106
openshot::Stabilizer::Json
std::string Json() const override
Generate JSON string of this object.
Definition Stabilizer.cpp:157
openshot
This namespace is the default namespace for all code in the openshot library.
Definition Compressor.h:29
EffectCamTrajectory
Definition Stabilizer.h:41
EffectCamTrajectory::EffectCamTrajectory
EffectCamTrajectory()
Definition Stabilizer.h:42
EffectCamTrajectory::a
double a
Definition Stabilizer.h:51
EffectCamTrajectory::x
double x
Definition Stabilizer.h:49
EffectCamTrajectory::EffectCamTrajectory
EffectCamTrajectory(double _x, double _y, double _a)
Definition Stabilizer.h:43
EffectCamTrajectory::y
double y
Definition Stabilizer.h:50
EffectTransformParam
Definition Stabilizer.h:26
EffectTransformParam::EffectTransformParam
EffectTransformParam()
Definition Stabilizer.h:27
EffectTransformParam::EffectTransformParam
EffectTransformParam(double _dx, double _dy, double _da)
Definition Stabilizer.h:28
EffectTransformParam::dx
double dx
Definition Stabilizer.h:34
EffectTransformParam::da
double da
Definition Stabilizer.h:36
EffectTransformParam::dy
double dy
Definition Stabilizer.h:35