我是 python 新手 我的问题是 imageio 和 visvis 绘制垂直线而不是像素,怎么了?1def writePic(picnum,picres): return vv.imwrite('\picsout\pic'+str(picnum)+'.png',np.array(np.uint8(picres)))def dothisandthat(pnum): global rewards,reward pictime=time.time() tphase=pnum>4 imin=readPic(pnum) imout=[[[255,255,255]]*len(imin[0])]*len(imin) for i in range(len(imin)): for j in range(len(imin[i])): obsP=obsPixels(i,j,imin) if tphase: train() fcol=find_col(obsP,pnum) else: fcol=random_trainer() imout[i][j]=fcol reward=calcRew(i,j,imin,fcol) rewards.append(reward) obs1,obs2,obs3,obs4,obs5=obsP remember_recdata([*fcol,*obs1,*obs2,*obs3,*obs4,*obs5,pnum]) if True: writePic(pnum,imout)
1 回答
江户川乱折腾
TA贡献1851条经验 获得超5个赞
我已经通过替换来管理imout=[[[255,255,255]]*len(imin[0])]*len(imin)
它imout=np.zeros((len(imin),len(imin[0]),3))
添加回答
举报
0/150
提交
取消