mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-15 11:25:53 +08:00
FIX convert to (unsigned) integer from bool type
This commit is contained in:
+10
-1
@@ -150,8 +150,17 @@ def convert(image, dtype, force_copy=False, uniform=False):
|
||||
itemsize = dtypeobj.itemsize
|
||||
itemsize_in = dtypeobj_in.itemsize
|
||||
|
||||
if kind == 'b' or kind_in == 'b':
|
||||
if kind == 'b':
|
||||
# to binary image
|
||||
prec_loss()
|
||||
return dtype(image)
|
||||
|
||||
if kind_in == 'b':
|
||||
# from binary image, to float and to integer
|
||||
if kind == 'f':
|
||||
return dtype(image)
|
||||
elif kind in 'ui':
|
||||
return dtype(image) * dtype_range[dtype][1]
|
||||
|
||||
if kind in 'ui':
|
||||
imin = np.iinfo(dtype).min
|
||||
|
||||
Reference in New Issue
Block a user