Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sharpen sigma changed #23

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ color_space_conversion:

sharpen:
is_enable: true
sharpen_sigma: 5
sharpen_sigma: 2
sharpen_strength: 0.9
is_save: false

Expand Down
7 changes: 3 additions & 4 deletions modules/sharpen.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def gaussian_kernel(self, size_x, size_y=None, sigma_x=5, sigma_y=None):
"""
Generate a Gaussian kernel for convolutions for Sharpening Algorithm
"""

if size_y is None:
size_y = size_x
if sigma_y is None:
Expand All @@ -48,8 +47,8 @@ def gaussian_kernel(self, size_x, size_y=None, sigma_x=5, sigma_y=None):
x_axis -= x_0
y_axis -= y_0

exp_part = (x_axis**2 / (2 * sigma_x**2)) + (y_axis**2 / (2 * sigma_y**2))
return 1 / ((2 * np.pi * sigma_x * sigma_y) * np.exp(-exp_part))
exp_part = x_axis**2 / (2 * sigma_x**2) + y_axis**2 / (2 * sigma_y**2)
return 1 / (2 * np.pi * sigma_x * sigma_y) * np.exp(-exp_part)

def apply_sharpen(self):
"""Sharpens an image using the unsharp mask algorithm.
Expand Down Expand Up @@ -84,7 +83,7 @@ def apply_sharpen(self):
smoothened = correlation >> 20

# Sharpen the image with upsharp mask
# Strength is tuneable with the sharpen_strength parameter]
# Strength is tuneable with the sharpen_strength parameter
sh_str = self.parm_sha["sharpen_strength"]
print(" - Sharpen - strength = ", sh_str)
strength = int(sh_str * (2**10))
Expand Down
Loading