def show_image(data, shape, order='f', cmap=cm.gray):
"""
display an image from a 1d vector
:param data: 1d vector containing image information
:param shape: actual image dimensions
:param order: 'c' or 'f'
:param cmap: colour map, defaults to grayscale
:return:
"""
img = data.reshape(shape, order=order)
plt.imshow(img, cmap=cmap)
plt.show()
评论列表
文章目录