OpenShot Library | libopenshot  0.6.0
Sharpen.h
Go to the documentation of this file.
1 // Sharpen.h
10 // Copyright (c) 2008-2025 OpenShot Studios, LLC
11 //
12 // SPDX-License-Identifier: LGPL-3.0-or-later
13 
14 #ifndef OPENSHOT_SHARPEN_EFFECT_H
15 #define OPENSHOT_SHARPEN_EFFECT_H
16 
17 #include "EffectBase.h"
18 #include "KeyFrame.h"
19 #include "Json.h"
20 
21 #include <string>
22 
23 namespace openshot {
24 
28 };
29 
36 class Sharpen : public EffectBase {
37 private:
39  void init_effect_details();
40 
41 protected:
42  bool UseCustomMaskBlend(int64_t frame_number) const override;
43  void ApplyCustomMaskBlend(std::shared_ptr<QImage> original_image, std::shared_ptr<QImage> effected_image,
44  std::shared_ptr<QImage> mask_image, int64_t frame_number) const override;
45 
46 public:
49 
52 
55 
57  int mode;
58 
60  int channel;
61 
63  int mask_mode;
64 
66  Sharpen();
67 
69  Sharpen(Keyframe new_amount, Keyframe new_radius, Keyframe new_threshold);
70 
80  std::shared_ptr<Frame> GetFrame(std::shared_ptr<Frame> frame, int64_t frame_number) override;
81  std::shared_ptr<Frame> GetFrame(int64_t n) override
82  { return GetFrame(std::make_shared<Frame>(), n); }
83 
85  std::string Json() const override;
86  Json::Value JsonValue() const override;
87  void SetJson(const std::string value) override;
88  void SetJsonValue(const Json::Value root) override;
89 
92  std::string PropertiesJSON(int64_t requested_frame) const override;
93 };
94 
95 } // namespace openshot
96 
97 #endif // OPENSHOT_SHARPEN_EFFECT_H
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:57
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 provides a sharpen effect for video frames.
Definition: Sharpen.h:36
int mode
Sharpening mode (0 = UnsharpMask, 1 = HighPassBlend)
Definition: Sharpen.h:57
std::string Json() const override
Get and Set JSON methods.
Definition: Sharpen.cpp:376
Keyframe radius
Radius of the blur used in sharpening (0 to 10 pixels for 1080p)
Definition: Sharpen.h:51
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: Sharpen.cpp:235
Json::Value JsonValue() const override
Generate Json::Value for this object.
Definition: Sharpen.cpp:381
int mask_mode
Mask behavior mode for this effect.
Definition: Sharpen.h:63
Sharpen()
Default constructor.
Definition: Sharpen.cpp:24
void ApplyCustomMaskBlend(std::shared_ptr< QImage > original_image, std::shared_ptr< QImage > effected_image, std::shared_ptr< QImage > mask_image, int64_t frame_number) const override
Optional override for effects with custom mask implementation.
Definition: Sharpen.cpp:64
void SetJson(const std::string value) override
Load JSON string into this object.
Definition: Sharpen.cpp:395
int channel
Channel to apply sharpening to (0 = All, 1 = Luma, 2 = Chroma)
Definition: Sharpen.h:60
std::shared_ptr< Frame > GetFrame(int64_t n) override
This method is required for all derived classes of ClipBase, and returns a new openshot::Frame object...
Definition: Sharpen.h:81
bool UseCustomMaskBlend(int64_t frame_number) const override
Optional override for effects that need custom mask behavior.
Definition: Sharpen.cpp:58
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Definition: Sharpen.cpp:401
Keyframe amount
Amount of sharpening to apply (0 to 2)
Definition: Sharpen.h:48
std::string PropertiesJSON(int64_t requested_frame) const override
Definition: Sharpen.cpp:419
Keyframe threshold
Threshold for applying sharpening (0 to 1)
Definition: Sharpen.h:54
This namespace is the default namespace for all code in the openshot library.
Definition: Compressor.h:29
SharpenMaskMode
Definition: Sharpen.h:25
@ SHARPEN_MASK_LIMIT_TO_AREA
Definition: Sharpen.h:26
@ SHARPEN_MASK_VARY_STRENGTH
Definition: Sharpen.h:27