美文网首页
2018-06-10深度学习之输入图像处理

2018-06-10深度学习之输入图像处理

作者: AI_Finance | 来源:发表于2018-06-10 20:30 被阅读0次

import numpyas np

from matplotlibimport figure

from matplotlib.backends.backend_aggimport FigureCanvasAggas FigureCanvas

import skimage

from skimageimport transform

x = np.linspace(-1, 1, 50)

y1 =2 * x +1

# figure 1

fig = figure.Figure()

canvas = FigureCanvas(fig)

ax = fig.add_subplot(1, 1, 1)

ax.plot(x, y1)

ncols, nrows = fig.canvas.get_width_height()

ax.set_axis_off()

fig.canvas.draw()

observation = np.fromstring(fig.canvas.tostring_argb(), dtype=np.uint8, sep='').reshape(nrows, ncols, 4)

observation = skimage.transform.resize(observation, (64, 64))

# observation = np.delete(observation, np.s_[1:4], axis=2)

# observation = np.reshape(observation, (64, 64, 1))

相关文章

网友评论

      本文标题:2018-06-10深度学习之输入图像处理

      本文链接:https://www.haomeiwen.com/subject/xzsqeftx.html