Skip to content

Commit

Permalink
Tabs->spaces in OpenCV effect headers
Browse files Browse the repository at this point in the history
  • Loading branch information
ferdnyc committed Apr 1, 2021
1 parent c723ee1 commit 9be8e29
Show file tree
Hide file tree
Showing 4 changed files with 134 additions and 131 deletions.
74 changes: 37 additions & 37 deletions src/effects/ObjectDetection.h
Expand Up @@ -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<size_t, DetectionData> detectionsData;
std::vector<std::string> classNames;
/**
* @brief This effect displays all the detected objects on a clip.
*/
class ObjectDetection : public EffectBase
{
private:
std::string protobuf_data_path;
std::map<size_t, DetectionData> detectionsData;
std::vector<std::string> classNames;

std::vector<cv::Scalar> classesColor;
std::vector<cv::Scalar> 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<Frame> GetFrame(std::shared_ptr<Frame> 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<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<Frame>(), frame_number); }
std::shared_ptr<openshot::Frame> GetFrame(int64_t frame_number) override { return GetFrame(std::make_shared<Frame>(), 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;
};

}

Expand Down
96 changes: 48 additions & 48 deletions src/effects/Stabilizer.h
Expand Up @@ -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 <size_t,EffectCamTrajectory> trajectoryData; // Save camera trajectory data
std::map <size_t,EffectTransformParam> 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 <size_t,EffectCamTrajectory> trajectoryData; // Save camera trajectory data
std::map <size_t,EffectTransformParam> 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<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);
};

/// 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<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);
};

/// 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;
};

}

Expand Down
94 changes: 48 additions & 46 deletions src/effects/Tracker.h
Expand Up @@ -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<int, EffectFrameData> 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<int, EffectFrameData> 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<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::shared_ptr<Frame> (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<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::shared_ptr<Frame> (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;
};

}

Expand Down
1 change: 1 addition & 0 deletions tests/Timeline_Tests.cpp
Expand Up @@ -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);
Expand Down

0 comments on commit 9be8e29

Please sign in to comment.