Python实现二维数组输出为图片
import matplotlib.pyplot as pyplot pyplot.imshow(binary_mask)
pyplot.show()
binary_mask显示为:
array([[0, 0, 0, ..., 0, 0, 0],
[0, 1, 0, ..., 0, 0, 0],
[0, 0, 1, ..., 0, 0, 0],
...,
[0, 1, 0, ..., 0, 1, 0],
[0, 0, 0, ..., 0, 0, 1],
[0, 1, 0, ..., 0, 1, 0]], dtype=uint8)
图片显示为: