OpenShot Library | libopenshot  0.5.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
openshot::Sharpen::SetJson
void SetJson(const std::string value) override
Load JSON string into this object.
Definition: Sharpen.cpp:395
openshot::Sharpen::mode
int mode
Sharpening mode (0 = UnsharpMask, 1 = HighPassBlend)
Definition: Sharpen.h:57
openshot::SHARPEN_MASK_VARY_STRENGTH
@ SHARPEN_MASK_VARY_STRENGTH
Definition: Sharpen.h:27
openshot::EffectBase
This abstract class is the base class, used by all effects in libopenshot.
Definition: EffectBase.h:56
openshot::Sharpen::GetFrame
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
openshot
This namespace is the default namespace for all code in the openshot library.
Definition: Compressor.h:28
openshot::Sharpen::mask_mode
int mask_mode
Mask behavior mode for this effect.
Definition: Sharpen.h:63
openshot::Sharpen::PropertiesJSON
std::string PropertiesJSON(int64_t requested_frame) const override
Definition: Sharpen.cpp:419
openshot::Sharpen::Json
std::string Json() const override
Get and Set JSON methods.
Definition: Sharpen.cpp:376
openshot::Sharpen::radius
Keyframe radius
Radius of the blur used in sharpening (0 to 10 pixels for 1080p)
Definition: Sharpen.h:51
openshot::Sharpen::GetFrame
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
openshot::Sharpen::channel
int channel
Channel to apply sharpening to (0 = All, 1 = Luma, 2 = Chroma)
Definition: Sharpen.h:60
EffectBase.h
Header file for EffectBase class.
openshot::Sharpen
This class provides a sharpen effect for video frames.
Definition: Sharpen.h:36
KeyFrame.h
Header file for the Keyframe class.
openshot::Keyframe
A Keyframe is a collection of Point instances, which is used to vary a number or property over time.
Definition: KeyFrame.h:53
openshot::Sharpen::ApplyCustomMaskBlend
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
openshot::SHARPEN_MASK_LIMIT_TO_AREA
@ SHARPEN_MASK_LIMIT_TO_AREA
Definition: Sharpen.h:26
openshot::Sharpen::JsonValue
Json::Value JsonValue() const override
Generate Json::Value for this object.
Definition: Sharpen.cpp:381
openshot::Sharpen::SetJsonValue
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Definition: Sharpen.cpp:401
openshot::Sharpen::Sharpen
Sharpen()
Default constructor.
Definition: Sharpen.cpp:24
openshot::Sharpen::threshold
Keyframe threshold
Threshold for applying sharpening (0 to 1)
Definition: Sharpen.h:54
openshot::SharpenMaskMode
SharpenMaskMode
Definition: Sharpen.h:25
Json.h
Header file for JSON class.
openshot::Sharpen::amount
Keyframe amount
Amount of sharpening to apply (0 to 2)
Definition: Sharpen.h:48
openshot::Sharpen::UseCustomMaskBlend
bool UseCustomMaskBlend(int64_t frame_number) const override
Optional override for effects that need custom mask behavior.
Definition: Sharpen.cpp:58