OpenShot Library | libopenshot 0.3.3
Loading...
Searching...
No Matches
Stabilizer.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_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
26{
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
41{
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
55namespace 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
Header file for EffectBase class.
Header file for JSON class.
Header file for the Keyframe class.
This abstract class is the base class, used by all effects in libopenshot.
Definition EffectBase.h:54
A Keyframe is a collection of Point instances, which is used to vary a number or property over time.
Definition KeyFrame.h:53
This class stabilizes a video clip to remove undesired shaking and jitter.
Definition Stabilizer.h:67
Json::Value JsonValue() const override
Generate Json::Value for this object.
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
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...
std::map< size_t, EffectTransformParam > transformationData
Definition Stabilizer.h:77
std::string teste
Definition Stabilizer.h:75
std::string PropertiesJSON(int64_t requested_frame) const override
void SetJson(const std::string value) override
Load JSON string into this object.
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
std::map< size_t, EffectCamTrajectory > trajectoryData
Definition Stabilizer.h:76
bool LoadStabilizedData(std::string inputFilePath)
Load protobuf data file.
std::string Json() const override
Generate JSON string of this object.
This namespace is the default namespace for all code in the openshot library.
Definition Compressor.h:29
EffectCamTrajectory(double _x, double _y, double _a)
Definition Stabilizer.h:43
EffectTransformParam(double _dx, double _dy, double _da)
Definition Stabilizer.h:28