Skip to content

Commit

Permalink
Merge pull request albumentations-team#55 from BloodAxe/feature/fix-s…
Browse files Browse the repository at this point in the history
…qrt-warning

Apparently, when computing sum of squares we get a very small number …
  • Loading branch information
albu authored Sep 4, 2018
2 parents de0ed21 + 8e46c48 commit 2f5a92a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion albumentations/augmentations/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def optical_distortion(img, k=0, dx=0, dy=0, interpolation=cv2.INTER_LINEAR, bor
x = x.astype(np.float32) - width / 2 - dx
y = y.astype(np.float32) - height / 2 - dy
theta = np.arctan2(y, x)
d = (x * x + y * y) ** 0.5
d = (x * x + y * y + 1e-8) ** 0.5
r = d * (1 + k * d * d)
map_x = r * np.cos(theta) + width / 2 + dx
map_y = r * np.sin(theta) + height / 2 + dy
Expand Down

0 comments on commit 2f5a92a

Please sign in to comment.