社区
脚本语言
帖子详情
求助.python使用matplotlib出错
ChaoticNg
2017-11-15 09:29:30
from PIL import Image
import matplotlib.pyplot as plt
pil_im = Image.open('d:/1.jpg').convert('L')
plt.figure("gray")
plt.imshow(pil_im)
plt.show()
提示一堆最后: AttributeError: 'numpy.ndarray' object has no attribute 'mask'
...全文
772
3
打赏
收藏
求助.python使用matplotlib出错
from PIL import Image import matplotlib.pyplot as plt pil_im = Image.open('d:/1.jpg').convert('L') plt.figure("gray") plt.imshow(pil_im) plt.show() 提示一堆最后: AttributeError: 'numpy.ndarray' object has no attribute 'mask'
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
3 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
weixin_42097515
2019-08-22
打赏
举报
回复
楼主,我遇到和您一样的问题,我用这种办法,没有解决,还有别的方法?谢谢楼主的回答,如果可能的话,可不可以把解决思路和办法发到2782762830@qq.com,谢谢楼主。
以下是程序:
def load_image(depth_name):
y = []
for filename in os.listdir(r"./" + depth_name):
depthM = cv2.imread(depth_name + "/" + filename)
# depthM1=np.array(depthM)
# depthM1 = depthM.shape
depthM = Image.open(depth_name + "/" + filename)
depthM = depthM.convert('1')
depthM = np.array(depthM.getdata(), dtype=np.uint8)
# depthM = np.array(depthM.getdata(),dtype='float')
y.append(depthM)
y = np.vstack(y)
print(y.shape)
# print(y.shape)
return y
for m in range(4):
#测试集输出
outimage=self.ae.predict([x_test,y_test])
#查看outimage数据格式
outimage=np.array(outimage)
print("outimage:",outimage.shape)
outimage = outimage[0,:,:]
print("outimage1:",outimage.shape)
outimage = outimage[m,:]
print("输出图形的大小:",outimage.shape)
# outimage = outimage.reshape((100,150))
# print("输出重新转化后的图形:",outimage.shape)
#输出图像
outimage_min=outimage.min(0)
outimage_max=outimage.max(0)
print("最小值:",outimage_min)
print("最大值:",outimage_max)
ranges=outimage_max-outimage_min
norm_image=np.zeros(np.shape(outimage))
print("norm_image:",norm_image.shape)
n=outimage.shape[0]
norm_image=outimage-np.tile(outimage_min,(1,n))
norm_image=norm_image/np.tile(ranges,(1,n))
#print("修改后的norm_image:",norm_image.shape)
#norm_image.shape=(1,15000)
norm_image=norm_image.astype("uint8")
norm_image=norm_image.reshape(100,150)
print("修改后的norm_image:",norm_image.shape)
show_image=Image.fromarray(norm_image)
plt.subplot(2,2,m+1)
plt.imshow(show_image)
plt.show()
plt.close()
# plt.imshow(show_image)
ChaoticNg
2017-11-15
打赏
举报
回复
from PIL import Image import matplotlib.pyplot as plt img=Image.open('d:/1.jpg').convert("1") plt.figure("dog") plt.imshow(img) plt.show() 已解决, 灰度模式改成二值图像"1" 就可以了
手无护鸡之力
2017-11-15
打赏
举报
回复
你装numpy了没
python
matplotlib
pyplot参数错误_
求助
! import
matplotlib
.pyplot
出错
该楼层疑似违规已被系统折叠隐藏此楼查看此楼有大神知道这是怎么回事吗?>>> import
matplotlib
.pyplotTraceback (most recent call last):File "D:\
python
\Lib\site-packages\
matplotlib
\font_manager.py", line 1353, in fontManager = jso...
python
matplotlib
pyplot参数错误,
求助
! import
matplotlib
.pyplot
出错
该楼层疑似违规已被系统折叠隐藏此楼查看此楼有大神知道这是怎么回事吗?>>> import
matplotlib
.pyplotTraceback (most recent call last):File "D:\
python
\Lib\site-packages\
matplotlib
\font_manager.py", line 1353, in fontManager = jso...
python
安装
matplotlib
库三种失败情况
安装matplot时,出现的三种失败情况 1、read timed out 一开始我在pycharm终端
使用
pip install
matplotlib
时,出现的是下图所示情况,大致情况是安装时间太长,所以当时我用了清华镜像,将原来的命令改成了pip install --index https://mirrors.u......
python
中
matplotlib
出错
_
python
调用
matplotlib
出错
,import那步就报错
展开全部pyparsing安装好了
matplotlib
,但是62616964757a686964616fe4b893e5b19e31333365636133引入的时候出现问题,无法引用,提示引用错误:ImportError:
matplotlib
requires pyparsing。本文着重总结一下遇到这种情况时的解决方法。首先,进入
matplotlib
官网的Installing目录,请注意观察...
python
导入
matplotlib
包
出错
,导入
matplotlib
.pyplot时
出错
When I run import
matplotlib
.pyplot as plt, I get the following error message:---------------------------------------------------------------------------ImportError Trace...
脚本语言
37,738
社区成员
34,211
社区内容
发帖
与我相关
我的任务
脚本语言
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
复制链接
扫一扫
分享
社区描述
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
试试用AI创作助手写篇文章吧
+ 用AI写文章