mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-10 05:39:03 +08:00
ENH: Bool dtype conversion speed improvements.
This commit is contained in:
@@ -155,11 +155,14 @@ def convert(image, dtype, force_copy=False, uniform=False):
|
||||
if kind_in in "fi":
|
||||
sign_loss()
|
||||
prec_loss()
|
||||
return dtype(image)
|
||||
|
||||
return image > dtype_in(0)
|
||||
|
||||
if kind_in == 'b':
|
||||
# from binary image, to float and to integer
|
||||
return dtype(image) * dtype(dtype_range[dtype][1])
|
||||
result = dtype(image)
|
||||
if kind != 'f':
|
||||
result *= dtype(dtype_range[dtype][1])
|
||||
return result
|
||||
|
||||
if kind in 'ui':
|
||||
imin = np.iinfo(dtype).min
|
||||
|
||||
Reference in New Issue
Block a user