Skip to content

Commit

Permalink
sharpen sigma changed
Browse files Browse the repository at this point in the history
  • Loading branch information
mfaizan-10xe committed Sep 3, 2024
1 parent b269caa commit 0443cc0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
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

0 comments on commit 0443cc0

Please sign in to comment.