Skip to content

Commit 36917ae

Browse files
committed
Clip rescaled image to keep values in 0-255 range.
1 parent a157bd0 commit 36917ae

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

dmtools/transform.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def _rescale_axis(image: np.ndarray,
114114
if axis == 1:
115115
rescaled_image = np.swapaxes(rescaled_image,0,1)
116116

117-
return rescaled_image.astype(np.uint8)
117+
return np.clip(rescaled_image, 0.0, 255.0).astype(np.uint8)
118118

119119

120120
def rescale(image: np.ndarray,

0 commit comments

Comments
 (0)