什么取代了 scipy.misc.bytescale?
What replaces scipy.misc.bytescale?
我是 运行 旧代码,使用 scipy 1.3.1,导入如下:
from scipy.misc import bytescale
出现以下错误:
ImportError: cannot import name 'bytescale'
我看到了 bytescale
has been removed since 1.3 (source)。该线程建议 scikit-image util
模块将是一个很好的替代品,但没有提供。
什么是现在已弃用的 scipy.misc.bytescale()
的好替代品?
skimage.util.img_as_ubyte
是 scipy.misc.bytescale
的替代品
scipy.misc.bytescale
文档说明如下:
Byte scaling means converting the input image to uint8 dtype and
scaling the range to (low, high) (default 0-255). If the input image
already has dtype uint8, no scaling is done.
skimage.util.img_as_ubyte
文档说明如下:
Convert an image to 8-bit unsigned integer format. Negative input
values will be clipped. Positive values are scaled between 0 and 255.
我认为没有直接的等价物(能够指定高和低)但是你可以使用 skimage.util.img_as_ubyte
之类的东西在 0 到 255 之间缩放,skimage.util.img_as_uint
在 0 到 65535 之间缩放. 在这里检查它们:https://scikit-image.org/docs/stable/api/skimage.util.html(img_as_*
东西)
我是 运行 旧代码,使用 scipy 1.3.1,导入如下:
from scipy.misc import bytescale
出现以下错误:
ImportError: cannot import name 'bytescale'
我看到了 bytescale
has been removed since 1.3 (source)。该线程建议 scikit-image util
模块将是一个很好的替代品,但没有提供。
什么是现在已弃用的 scipy.misc.bytescale()
的好替代品?
skimage.util.img_as_ubyte
是 scipy.misc.bytescale
scipy.misc.bytescale
文档说明如下:
Byte scaling means converting the input image to uint8 dtype and scaling the range to (low, high) (default 0-255). If the input image already has dtype uint8, no scaling is done.
skimage.util.img_as_ubyte
文档说明如下:
Convert an image to 8-bit unsigned integer format. Negative input values will be clipped. Positive values are scaled between 0 and 255.
我认为没有直接的等价物(能够指定高和低)但是你可以使用 skimage.util.img_as_ubyte
之类的东西在 0 到 255 之间缩放,skimage.util.img_as_uint
在 0 到 65535 之间缩放. 在这里检查它们:https://scikit-image.org/docs/stable/api/skimage.util.html(img_as_*
东西)