From 9be8e297905d4cc2db407d3ff077acd4540f1095 Mon Sep 17 00:00:00 2001 From: "FeRD (Frank Dana)" Date: Wed, 31 Mar 2021 20:12:47 -0400 Subject: [PATCH] Tabs->spaces in OpenCV effect headers --- src/effects/ObjectDetection.h | 74 +++++++++++++-------------- src/effects/Stabilizer.h | 96 +++++++++++++++++------------------ src/effects/Tracker.h | 94 +++++++++++++++++----------------- tests/Timeline_Tests.cpp | 1 + 4 files changed, 134 insertions(+), 131 deletions(-) diff --git a/src/effects/ObjectDetection.h b/src/effects/ObjectDetection.h index affd0c9c9..0dbb8cd6c 100644 --- a/src/effects/ObjectDetection.h +++ b/src/effects/ObjectDetection.h @@ -59,57 +59,57 @@ struct DetectionData{ namespace openshot { - /** - * @brief This effect displays all the detected objects on a clip. - */ - class ObjectDetection : public EffectBase - { - private: - std::string protobuf_data_path; - std::map detectionsData; - std::vector classNames; + /** + * @brief This effect displays all the detected objects on a clip. + */ + class ObjectDetection : public EffectBase + { + private: + std::string protobuf_data_path; + std::map detectionsData; + std::vector classNames; - std::vector classesColor; + std::vector classesColor; - /// Init effect settings - void init_effect_details(); + /// Init effect settings + void init_effect_details(); - void drawPred(int classId, float conf, cv::Rect2d box, cv::Mat& frame); + void drawPred(int classId, float conf, cv::Rect2d box, cv::Mat& frame); - public: + public: ObjectDetection(); - ObjectDetection(std::string clipTrackerDataPath); + ObjectDetection(std::string clipTrackerDataPath); - /// @brief This method is required for all derived classes of EffectBase, and returns a - /// modified openshot::Frame object - /// - /// The frame object is passed into this method, and a frame_number is passed in which - /// tells the effect which settings to use from its keyframes (starting at 1). - /// - /// @returns The modified openshot::Frame object - /// @param frame The frame object that needs the effect applied to it - /// @param frame_number The frame number (starting at 1) of the effect on the timeline. - std::shared_ptr GetFrame(std::shared_ptr frame, int64_t frame_number) override; + /// @brief This method is required for all derived classes of EffectBase, and returns a + /// modified openshot::Frame object + /// + /// The frame object is passed into this method, and a frame_number is passed in which + /// tells the effect which settings to use from its keyframes (starting at 1). + /// + /// @returns The modified openshot::Frame object + /// @param frame The frame object that needs the effect applied to it + /// @param frame_number The frame number (starting at 1) of the effect on the timeline. + std::shared_ptr GetFrame(std::shared_ptr frame, int64_t frame_number) override; - std::shared_ptr GetFrame(int64_t frame_number) override { return GetFrame(std::make_shared(), frame_number); } + std::shared_ptr GetFrame(int64_t frame_number) override { return GetFrame(std::make_shared(), frame_number); } - /// Load protobuf data file + /// Load protobuf data file bool LoadObjDetectdData(std::string inputFilePath); - DetectionData GetTrackedData(size_t frameId); + DetectionData GetTrackedData(size_t frameId); - // Get and Set JSON methods - std::string Json() const override; ///< Generate JSON string of this object - void SetJson(const std::string value) override; ///< Load JSON string into this object - Json::Value JsonValue() const override; ///< Generate Json::Value for this object - void SetJsonValue(const Json::Value root) override; ///< Load Json::Value into this object + // Get and Set JSON methods + std::string Json() const override; ///< Generate JSON string of this object + void SetJson(const std::string value) override; ///< Load JSON string into this object + Json::Value JsonValue() const override; ///< Generate Json::Value for this object + void SetJsonValue(const Json::Value root) override; ///< Load Json::Value into this object - /// Get all properties for a specific frame (perfect for a UI to display the current state - /// of all properties at any time) - std::string PropertiesJSON(int64_t requested_frame) const override; - }; + /// Get all properties for a specific frame (perfect for a UI to display the current state + /// of all properties at any time) + std::string PropertiesJSON(int64_t requested_frame) const override; + }; } diff --git a/src/effects/Stabilizer.h b/src/effects/Stabilizer.h index dba7c1519..b7ce0e5c7 100644 --- a/src/effects/Stabilizer.h +++ b/src/effects/Stabilizer.h @@ -75,57 +75,57 @@ struct EffectCamTrajectory namespace openshot { - /** - * @brief This class stabilizes 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. - */ - class Stabilizer : public EffectBase - { - private: - /// Init effect settings - void init_effect_details(); - std::string protobuf_data_path; - Keyframe zoom; - - public: - std::string teste; - std::map trajectoryData; // Save camera trajectory data - std::map transformationData; // Save transormation data + /** + * @brief This class stabilizes 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. + */ + class Stabilizer : public EffectBase + { + private: + /// Init effect settings + void init_effect_details(); + std::string protobuf_data_path; + Keyframe zoom; + + public: + std::string teste; + std::map trajectoryData; // Save camera trajectory data + std::map transformationData; // Save transormation data Stabilizer(); - Stabilizer(std::string clipTrackerDataPath); - - /// @brief This method is required for all derived classes of EffectBase, and returns a - /// modified openshot::Frame object - /// - /// The frame object is passed into this method, and a frame_number is passed in which - /// tells the effect which settings to use from its keyframes (starting at 1). - /// - /// @returns The modified openshot::Frame object - /// @param frame The frame object that needs the effect applied to it - /// @param frame_number The frame number (starting at 1) of the effect on the timeline. - std::shared_ptr GetFrame(std::shared_ptr frame, int64_t frame_number) override; - - std::shared_ptr GetFrame(int64_t frame_number) override { - return GetFrame(std::make_shared(), frame_number); - }; - - /// Load protobuf data file - bool LoadStabilizedData(std::string inputFilePath); - - // Get and Set JSON methods - std::string Json() const override; ///< Generate JSON string of this object - void SetJson(const std::string value) override; ///< Load JSON string into this object - Json::Value JsonValue() const override; ///< Generate Json::Value for this object - void SetJsonValue(const Json::Value root) override; ///< Load Json::Value into this object - - /// Get all properties for a specific frame (perfect for a UI to display the current state - /// of all properties at any time) - std::string PropertiesJSON(int64_t requested_frame) const override; - }; + Stabilizer(std::string clipTrackerDataPath); + + /// @brief This method is required for all derived classes of EffectBase, and returns a + /// modified openshot::Frame object + /// + /// The frame object is passed into this method, and a frame_number is passed in which + /// tells the effect which settings to use from its keyframes (starting at 1). + /// + /// @returns The modified openshot::Frame object + /// @param frame The frame object that needs the effect applied to it + /// @param frame_number The frame number (starting at 1) of the effect on the timeline. + std::shared_ptr GetFrame(std::shared_ptr frame, int64_t frame_number) override; + + std::shared_ptr GetFrame(int64_t frame_number) override { + return GetFrame(std::make_shared(), frame_number); + }; + + /// Load protobuf data file + bool LoadStabilizedData(std::string inputFilePath); + + // Get and Set JSON methods + std::string Json() const override; ///< Generate JSON string of this object + void SetJson(const std::string value) override; ///< Load JSON string into this object + Json::Value JsonValue() const override; ///< Generate Json::Value for this object + void SetJsonValue(const Json::Value root) override; ///< Load Json::Value into this object + + /// Get all properties for a specific frame (perfect for a UI to display the current state + /// of all properties at any time) + std::string PropertiesJSON(int64_t requested_frame) const override; + }; } diff --git a/src/effects/Tracker.h b/src/effects/Tracker.h index 53412c9b4..68f18e834 100644 --- a/src/effects/Tracker.h +++ b/src/effects/Tracker.h @@ -72,54 +72,56 @@ struct EffectFrameData{ namespace openshot { - /** - * @brief This class track a given object through the clip and, when called, draws a box surrounding it. - * - * Tracking is useful to better visualize and follow the movement of an object through video. - */ - class Tracker : public EffectBase - { - private: - /// Init effect settings - void init_effect_details(); - std::string protobuf_data_path; - - public: - - std::map trackedDataById; // Save object tracking box data - + /** + * @brief This class track a given object through the clip and, when called, draws a box surrounding it. + * + * Tracking is useful to better visualize and follow the movement of an object through video. + */ + class Tracker : public EffectBase + { + private: + /// Init effect settings + void init_effect_details(); + std::string protobuf_data_path; + + public: + + std::map trackedDataById; // Save object tracking box data + + /// Blank constructor, useful when using Json to load the effect properties + Tracker(std::string clipTrackerDataPath); + + /// Default constructor Tracker(); - Tracker(std::string clipTrackerDataPath); - - /// @brief This method is required for all derived classes of EffectBase, and returns a - /// modified openshot::Frame object - /// - /// The frame object is passed into this method, and a frame_number is passed in which - /// tells the effect which settings to use from its keyframes (starting at 1). - /// - /// @returns The modified openshot::Frame object - /// @param frame The frame object that needs the effect applied to it - /// @param frame_number The frame number (starting at 1) of the effect on the timeline. - std::shared_ptr GetFrame(std::shared_ptr frame, int64_t frame_number) override; - std::shared_ptr GetFrame(int64_t frame_number) override { return GetFrame(std::shared_ptr (new Frame()), frame_number); } - - /// Load protobuf data file - bool LoadTrackedData(std::string inputFilePath); - - /// Get tracker info for the desired frame - EffectFrameData GetTrackedData(size_t frameId); - - // Get and Set JSON methods - std::string Json() const override; ///< Generate JSON string of this object - void SetJson(const std::string value) override; ///< Load JSON string into this object - Json::Value JsonValue() const override; ///< Generate Json::Value for this object - void SetJsonValue(const Json::Value root) override; ///< Load Json::Value into this object - - /// Get all properties for a specific frame (perfect for a UI to display the current state - /// of all properties at any time) - std::string PropertiesJSON(int64_t requested_frame) const override; - }; + /// @brief This method is required for all derived classes of EffectBase, and returns a + /// modified openshot::Frame object + /// + /// The frame object is passed into this method, and a frame_number is passed in which + /// tells the effect which settings to use from its keyframes (starting at 1). + /// + /// @returns The modified openshot::Frame object + /// @param frame The frame object that needs the effect applied to it + /// @param frame_number The frame number (starting at 1) of the effect on the timeline. + std::shared_ptr GetFrame(std::shared_ptr frame, int64_t frame_number) override; + std::shared_ptr GetFrame(int64_t frame_number) override { return GetFrame(std::shared_ptr (new Frame()), frame_number); } + + // Load protobuf data file + bool LoadTrackedData(std::string inputFilePath); + + // Get tracker info for the desired frame + EffectFrameData GetTrackedData(size_t frameId); + + // Get and Set JSON methods + std::string Json() const override; ///< Generate JSON string of this object + void SetJson(const std::string value) override; ///< Load JSON string into this object + Json::Value JsonValue() const override; ///< Generate Json::Value for this object + void SetJsonValue(const Json::Value root) override; ///< Load Json::Value into this object + + /// Get all properties for a specific frame (perfect for a UI to display the current state + /// of all properties at any time) + std::string PropertiesJSON(int64_t requested_frame) const override; + }; } diff --git a/tests/Timeline_Tests.cpp b/tests/Timeline_Tests.cpp index 2a9cd632e..fecba1788 100644 --- a/tests/Timeline_Tests.cpp +++ b/tests/Timeline_Tests.cpp @@ -57,6 +57,7 @@ TEST(Constructor) // Check values CHECK_EQUAL(640, t1.info.width); CHECK_EQUAL(480, t1.info.height); + CHECK_EQUAL("Timeline", t1.Name()); // Create a default fraction (should be 1/1) Timeline t2(300, 240, fps, 44100, 2, LAYOUT_STEREO);