OpenShot Library | libopenshot
1.1.1
Toggle main menu visibility
Loading...
Searching...
No Matches
Stabilizer.h
Go to the documentation of this file.
1
9
10
// Copyright (c) 2008-2019 OpenShot Studios, LLC
11
//
12
// SPDX-License-Identifier: LGPL-3.0-or-later
13
14
#ifndef OPENSHOT_STABILIZER_EFFECT_H
15
#define OPENSHOT_STABILIZER_EFFECT_H
16
17
#include "
EffectBase.h
"
18
19
#include <memory>
20
21
#include "
Json.h
"
22
#include "
KeyFrame.h
"
23
24
// Store the relative transformation parameters between consecutive frames
25
struct
EffectTransformParam
26
{
27
EffectTransformParam
() {}
28
EffectTransformParam
(
double
_dx,
double
_dy,
double
_da) {
29
dx
= _dx;
30
dy
= _dy;
31
da
= _da;
32
}
33
34
double
dx
;
35
double
dy
;
36
double
da
;
// angle
37
};
38
39
// Stores the global camera trajectory for one frame
40
struct
EffectCamTrajectory
41
{
42
EffectCamTrajectory
() {}
43
EffectCamTrajectory
(
double
_x,
double
_y,
double
_a) {
44
x
= _x;
45
y
= _y;
46
a
= _a;
47
}
48
49
double
x
;
50
double
y
;
51
double
a
;
// angle
52
};
53
54
55
namespace
openshot
56
{
57
// Forwward decls
58
class
Frame;
59
66
class
Stabilizer
:
public
EffectBase
67
{
68
private
:
70
void
init_effect_details();
71
std::string protobuf_data_path;
72
Keyframe
zoom;
73
74
public
:
75
std::string
teste
;
76
std::map <size_t,EffectCamTrajectory>
trajectoryData
;
// Save camera trajectory data
77
std::map <size_t,EffectTransformParam>
transformationData
;
// Save transormation data
78
79
Stabilizer
();
80
81
Stabilizer
(std::string clipTrackerDataPath);
82
92
std::shared_ptr<Frame>
GetFrame
(std::shared_ptr<Frame> frame, int64_t frame_number)
override
;
93
94
std::shared_ptr<openshot::Frame>
GetFrame
(int64_t frame_number)
override
{
95
return
GetFrame
(std::make_shared<openshot::Frame>(), frame_number);
96
};
97
99
bool
LoadStabilizedData
(std::string inputFilePath);
100
101
// Get and Set JSON methods
102
std::string
Json
()
const override
;
103
void
SetJson
(
const
std::string value)
override
;
104
Json::Value
JsonValue
()
const override
;
105
void
SetJsonValue
(
const
Json::Value root)
override
;
106
109
std::string
PropertiesJSON
(int64_t requested_frame)
const override
;
110
};
111
112
}
113
114
#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:57
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::JsonValue
Json::Value JsonValue() const override
Generate Json::Value for this object.
Definition
Stabilizer.cpp:174
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:73
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:223
openshot::Stabilizer::SetJson
void SetJson(const std::string value) override
Load JSON string into this object.
Definition
Stabilizer.cpp:187
openshot::Stabilizer::SetJsonValue
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Definition
Stabilizer.cpp:204
openshot::Stabilizer::trajectoryData
std::map< size_t, EffectCamTrajectory > trajectoryData
Definition
Stabilizer.h:76
openshot::Stabilizer::Stabilizer
Stabilizer()
Definition
Stabilizer.cpp:48
openshot::Stabilizer::LoadStabilizedData
bool LoadStabilizedData(std::string inputFilePath)
Load protobuf data file.
Definition
Stabilizer.cpp:116
openshot::Stabilizer::Json
std::string Json() const override
Generate JSON string of this object.
Definition
Stabilizer.cpp:167
openshot
This namespace is the default namespace for all code in the openshot library.
Definition
AnimatedCurve.h:24
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::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
effects
Stabilizer.h
Generated by
1.17.0