From 0443cc0aab3ed62149d6c5eb0583c7aef004fd40 Mon Sep 17 00:00:00 2001 From: mfaizan-10xe Date: Tue, 3 Sep 2024 16:05:07 +0500 Subject: [PATCH] sharpen sigma changed --- config/configs.yml | 2 +- modules/sharpen.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/config/configs.yml b/config/configs.yml index 1bd8cec..8a30390 100644 --- a/config/configs.yml +++ b/config/configs.yml @@ -122,7 +122,7 @@ color_space_conversion: sharpen: is_enable: true - sharpen_sigma: 5 + sharpen_sigma: 2 sharpen_strength: 0.9 is_save: false diff --git a/modules/sharpen.py b/modules/sharpen.py index 8ced1f0..5cf37f8 100644 --- a/modules/sharpen.py +++ b/modules/sharpen.py @@ -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: @@ -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. @@ -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))