python 图片io操作方法

python 图片io操作方法

opencv

import cv2
im = cv2.imread('')

skimage:skimage.io.imread

from skimage import io
from skimage import color
im = io.imread('1.jpg')

skimage.color.rgb2grey(rgb)
skimage.color.rgb2hsv(rgb)
skimage.color.rgb2lab(rgb)
skimage.color.gray2rgb(image)
skimage.color.hsv2rgb(hsv)
skimage.color.lab2rgb(lab)

caffe

caffe.io.load_image()
caffe.io.resize()

imageio

import imageio

im = imageio.imread('1.jpg')
imageio.imsave('2.png',im)

scipy

from scipy import misc

im = misc.imread('1.jpg')  # 接口被抛弃 ,一直imageio.imread/imwrite
misc.imsave('misc1.png',im)

PIL

from PIL import Image
im = Image.open('1.jpg')
上一篇:IM平台即时聊天功能及服务介绍


下一篇:python学习第十六天 --继承进阶篇