社区
脚本语言
帖子详情
求助.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'
...全文
679
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
作业
写回复
配置赞助广告
用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
绘制等值线图_
python
,
matplotlib
_
python
菜鸟
求助
,
使用
matplotlib
绘制contour等高线图,z为2D数组?,
python
,
matplotlib
- php...
python
菜鸟
求助
,
使用
matplotlib
绘制contour等高线图,z为2D数组?有一系列点坐标如下所示:x,y,z74,781,51373,731,111321,1791,280,1787,41049,2127,121647,2728,62883,3617,152383,3692,72708,2295,222933,1767,...
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...
matplotlib
总是
出错
,不出图片?
1.我先前在pycharm中
使用
matplotlib
画图的时候,仅有plt.show()和勾选setting_
python
scientic中的show plots in tool window是可以在sciview中显示图片的,可是运行着运行着就开始不能显示图片了?不清楚哪里出了...
求助
:在
python
3.6.2 中安装tensorflow1.9.0,测试时
出错
在
python
3.6.2 中安装tensorflow1.9.0,测试时
出错
,报错如下: Traceback (most recent call last): File “D:\anaconda3\envs\
python
36\lib\site-packages\tensorflow\
python
\pywrap_tensorflow.py”, line 58, in ...
脚本语言
37,743
社区成员
34,212
社区内容
发帖
与我相关
我的任务
脚本语言
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写文章