Skip to content

Commit

Permalink
Fix possible bug in MotionBlur (#2168)
Browse files Browse the repository at this point in the history
* fix near empty kernel when direction is -1

* update default value of direction_range
  • Loading branch information
huuquan1994 authored Nov 29, 2024
1 parent 96c10b5 commit eaa1b5f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion albumentations/augmentations/blur/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ def create_motion_kernel(

# Apply direction bias
if direction != 0:
t = t * (1 + direction)
t = t * (1 + abs(direction))
if direction < 0:
t = t * -1

# Generate line coordinates
x = center + dx * t
Expand Down
2 changes: 1 addition & 1 deletion albumentations/augmentations/blur/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def __init__(
blur_limit: ScaleIntType = 7,
allow_shifted: bool = True,
angle_range: tuple[float, float] = (0, 360),
direction_range: tuple[float, float] = (-1.0, 1.0),
direction_range: tuple[float, float] = (-0.5, 0.5),
always_apply: bool | None = None,
p: float = 0.5,
):
Expand Down

0 comments on commit eaa1b5f

Please sign in to comment.