mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-31 12:41:20 +08:00
slightly faster image conversion by creating less temporaries.
This commit is contained in:
@@ -75,7 +75,10 @@ def _convert(image, dtype, prec_loss):
|
||||
|
||||
# Do scaling/shifting calculations in floating point
|
||||
image = image.astype(np.float64)
|
||||
out = round_fn((image - imin) * scale + shift).astype(dtype)
|
||||
out = image - imin
|
||||
out *= scale
|
||||
out += shift
|
||||
out = round_fn(out).astype(dtype)
|
||||
|
||||
return out
|
||||
|
||||
|
||||
Reference in New Issue
Block a user