Commit db1c212c authored by Patrick Wieschollek's avatar Patrick Wieschollek Committed by Yuxin Wu

fix typo `asypte` and remove casting error (#142)

* fix typo `asypte` and remove casting error

* add clipping
parent 49b61fc0
...@@ -54,7 +54,7 @@ class Brightness(ImageAugmentor): ...@@ -54,7 +54,7 @@ class Brightness(ImageAugmentor):
img += v img += v
if self.clip or old_dtype == np.uint8: if self.clip or old_dtype == np.uint8:
img = np.clip(img, 0, 255) img = np.clip(img, 0, 255)
return img.asypte(old_dtype) return img.astype(old_dtype)
class Contrast(ImageAugmentor): class Contrast(ImageAugmentor):
...@@ -227,5 +227,7 @@ class Lighting(ImageAugmentor): ...@@ -227,5 +227,7 @@ class Lighting(ImageAugmentor):
v = v * self.eigval v = v * self.eigval
v = v.reshape((3, 1)) v = v.reshape((3, 1))
inc = np.dot(self.eigvec, v).reshape((3,)) inc = np.dot(self.eigvec, v).reshape((3,))
img += inc img = np.add(img, inc)
if old_dtype == np.uint8:
img = np.clip(img, 0, 255)
return img.astype(old_dtype) return img.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