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)

图片显示为:

 

posted @ 2022-03-13 10:38  小丑_jk  阅读(961)  评论(0编辑  收藏  举报