Home > Article > Backend Development > Python method to output two-dimensional array as picture
This time I will bring you Python method to output two-dimensional array to picture, Python outputs two-dimensional array to of the picture What are the precautions? The following is a practical case, let’s take a look.
For a two-dimensional array, img_mask
[[ 0 0 0 ..., 7 7 7] [ 0 0 0 ..., 7 7 7] [ 0 0 0 ..., 7 7 7] ..., [266 266 266 ..., 253 253 253] [266 266 266 ..., 253 253 253] [266 266 266 ..., 253 253 253]]
The code displayed as a picture is:
import matplotlib.pyplot as pyplot pyplot.imshow(im_mask)
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!
Recommended reading:
Summary of Pycharm usage skills
How to use the max function in a two-dimensional list
The above is the detailed content of Python method to output two-dimensional array as picture. For more information, please follow other related articles on the PHP Chinese website!