一、PIL.Image 转 numpy.array
from PIL import Image
import numpy as np
Img = Image.open('G:/Experiment/train/images/000_HC.png')
array_img = np.array(Img)
二、numpy.array 转 PIL.Image
img = Image.fromarray(translation_img4.astype('uint8')).convert('RGB') # numpy.array 转 PIL.Image
# im = Image.fromarray(img) 直接这样发现没有啥区别,不懂
Image._show(img)