Skip to content

Commit

Permalink
Update filters.py
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlib committed May 1, 2024
1 parent 8294063 commit aa6c444
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions openpiv/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,13 @@ def _gaussian_kernel(half_width: int=1)-> np.ndarray:
"""
# size = int(half_width)
x, y = np.mgrid[-half_width:half_width + 1, -half_width:half_width + 1]
g = np.exp(-(x ** 2 / float(half_width) + y ** 2 / float(half_width)))

if half_width == 0:
return 1
else:
x, y = np.mgrid[-half_width:half_width + 1, -half_width:half_width + 1]
g = np.exp(-(x ** 2 / float(half_width) + y ** 2 / float(half_width)))

return g / g.sum()


Expand Down

0 comments on commit aa6c444

Please sign in to comment.