Skip to content

Commit

Permalink
Merge pull request OpenPIV#326 from alexlib/master
Browse files Browse the repository at this point in the history
update filters.py
  • Loading branch information
alexlib authored Jul 19, 2024
2 parents 713586c + bf98c9f commit 402646e
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 402646e

Please sign in to comment.