The first solution
Can be used, the code is as follows:
import
('', image_array)
The abovescipy
The version will standardize all images so that min (data) becomes black and max (data) becomes white. If the data should be accurate grayscale or accurate RGB channels, the solution is:
import
(image_array, cmin=0.0, cmax=...).save('')
The second solution
usePIL。
Given a numpy array "A":
from PIL import Image
im = (A)
("")
You can replace "jpeg" with almost any format you want. See the format for detailshereMore details
The third solution
mport matplotlib
('', array)
import matplotlib.pyplot as plt
plt.imshow(matrix) #Needs to be in row,col order
plt.savefig(
''
)
The fourth solution
import cv2
import numpy as np
("", ((10,10)))
Reference /article/