* @brief This class stabilizes a video clip to remove undesired shaking and jitter. * * Adding stabilization is useful to increase video quality overall, since it removes * from subtle to harsh unexpected camera movements. */
| 64 | * from subtle to harsh unexpected camera movements. |
| 65 | */ |
| 66 | class Stabilizer : public EffectBase |
| 67 | { |
| 68 | private: |
| 69 | /// Init effect settings |
| 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 | |
| 83 | /// @brief This method is required for all derived classes of EffectBase, and returns a |
| 84 | /// modified openshot::Frame object |
| 85 | /// |
| 86 | /// The frame object is passed into this method, and a frame_number is passed in which |
| 87 | /// tells the effect which settings to use from its keyframes (starting at 1). |
| 88 | /// |
| 89 | /// @returns The modified openshot::Frame object |
| 90 | /// @param frame The frame object that needs the effect applied to it |
| 91 | /// @param frame_number The frame number (starting at 1) of the effect on the timeline. |
| 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 | |
| 98 | /// Load protobuf data file |
| 99 | bool LoadStabilizedData(std::string inputFilePath); |
| 100 | |
| 101 | // Get and Set JSON methods |
| 102 | std::string Json() const override; ///< Generate JSON string of this object |
| 103 | void SetJson(const std::string value) override; ///< Load JSON string into this object |
| 104 | Json::Value JsonValue() const override; ///< Generate Json::Value for this object |
| 105 | void SetJsonValue(const Json::Value root) override; ///< Load Json::Value into this object |
| 106 | |
| 107 | /// Get all properties for a specific frame (perfect for a UI to display the current state |
| 108 | /// of all properties at any time) |
| 109 | std::string PropertiesJSON(int64_t requested_frame) const override; |
| 110 | }; |
| 111 | |
| 112 | } |
| 113 |