Commit 943364bc authored by Yuxin Wu's avatar Yuxin Wu

add missing clip in Saturation (#614)

parent bbe34866
...@@ -240,6 +240,8 @@ class Saturation(ImageAugmentor): ...@@ -240,6 +240,8 @@ class Saturation(ImageAugmentor):
m = cv2.COLOR_RGB2GRAY if self.rgb else cv2.COLOR_BGR2GRAY m = cv2.COLOR_RGB2GRAY if self.rgb else cv2.COLOR_BGR2GRAY
grey = cv2.cvtColor(img, m) grey = cv2.cvtColor(img, m)
ret = img * v + (grey * (1 - v))[:, :, np.newaxis] ret = img * v + (grey * (1 - v))[:, :, np.newaxis]
if old_dtype == np.uint8:
ret = np.clip(ret, 0, 255)
return ret.astype(old_dtype) return ret.astype(old_dtype)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment