【问题标题】:Which attribute in Scipy version 1.6.1 is compatible with the scipy.misc.toimage by scipy version 1.0.0?Scipy 1.6.1 版中的哪个属性与 scipy 1.0.0 版的 scipy.misc.toimage 兼容?
【发布时间】:2021-02-20 16:00:27
【问题描述】:

一旦我将scipy.misc.toimage 与 scipy 版本 1.6.1 一起使用,AttributeError: module 'scipy.misc' has no attribute 'toimage' 总是出错

关于文档,toimage 之类的属性将用于 scipy.misc 仅在版本 1.2.0 之前的版本 1.0.0 之前

来源:https://docs.scipy.org/doc/scipy-1.2.1/reference/misc.html

目前,我使用 python 3.8,请问 scipy 1.6.1 版中的哪个属性与 scipy 1.0.0 版中的scipy.misc.toimage 具有相同的功能?

【问题讨论】:

标签: python scipy opencv-python


【解决方案1】:

链接的文档,section toimage 明确指出:

直接使用 Pillow 的 Image.fromarray。

安装Pillow 包(如果尚未安装),然后使用例如

from PIL import Image
Image.fromarray(data)

(其中data 是一个 NumPy 数组。)

【讨论】:

    猜你喜欢
    • 2016-10-27
    • 2021-02-25
    • 1970-01-01
    • 2016-10-19
    • 2017-12-15
    • 2015-11-30
    • 2017-06-07
    • 2016-07-08
    • 1970-01-01
    相关资源
    最近更新 更多