FIX: multiply by the maximum value may change dtype

This commit is contained in:
kuantkid
2012-09-10 13:11:27 +08:00
parent 61be60cace
commit 07b258e208
+2 -1
View File
@@ -152,12 +152,13 @@ def convert(image, dtype, force_copy=False, uniform=False):
if kind == 'b':
# to binary image
sign_loss()
prec_loss()
return dtype(image)
if kind_in == 'b':
# from binary image, to float and to integer
return dtype(image) * dtype_range[dtype][1]
return dtype(image) * dtype(dtype_range[dtype][1])
if kind in 'ui':
imin = np.iinfo(dtype).min