Skip to content

Commit

Permalink
Fixes (#2178)
Browse files Browse the repository at this point in the history
* Empty-Commit

* Boosted version to 1.4.22

* FIx in Sharpen for gaussian method
  • Loading branch information
ternaus authored Dec 6, 2024
1 parent 33c9fc9 commit ff5cf99
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion albumentations/augmentations/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -2362,6 +2362,7 @@ def generate_shared_noise(
return noise_map


@clipped
@preserve_channel_dim
def sharpen_gaussian(
img: np.ndarray,
Expand All @@ -2376,7 +2377,9 @@ def sharpen_gaussian(
sigmaX=sigma,
sigmaY=sigma,
)
return add_weighted(blurred, 1 - alpha, img, alpha)
# Unsharp mask formula: original + alpha * (original - blurred)
# This is equivalent to: original * (1 + alpha) - alpha * blurred
return img + alpha * (img - blurred)


def apply_salt_and_pepper(
Expand Down

0 comments on commit ff5cf99

Please sign in to comment.