def svimg(totarr):
#print it out:
x,y=totarr.shape
vl = np.around(totarr.flatten(),5)#round to 5 digits
xx = np.repeat(np.arange(x),x)+1
yy = np.tile(np.arange(y),y)+1
big =np.column_stack((xx,yy,vl))
np.savetxt("noisyimage.txt",big,fmt=('%4.1f','%4.1f','%10.5f'))
##Add this if you want to
##read it out to make sure it works
##Otherwise slows down routine.
#row,col,data=np.loadtxt("noisyimage.txt",unpack=True)
#rsize = int(max(row))
#csize = int(max(col))
#data=np.array(data).reshape(rsize,csize)
# plt.imshow(data, interpolation='None',cmap=plt.cm.Greys_r)
评论列表
文章目录