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')
posted @ 2022-01-01 16:44  xikeHu  阅读(239)  评论(0编辑  收藏  举报