【CV】numpy 视角下的 image

Backto Python Index

np array to other image-formats

arr = np.random.random(3, 512, 512)

to pil

formatted = ((arr - np.min(arr))*255 / (np.max(arr) - np.min(arr) + 1e-0.5)).astype('uint8')
img = Image.fromarray(formatted)

to sp.misc

import scipy.misc
img = scipy.misc.toimage(arr)
scipy.misc.imsave('outfile.jpg', image)

你可能感兴趣的:(Python)