解决:Python下OpenCV不能加载带中文路径的图片

0.加载模块

from PIL import Image
import cv2 as cv
import numpy as np

PIL加载图片,转为opencv格式处理

image = Image.open('xxx.jpg')
image_cv = cv.cvtColor(np.asarray(image), cv.COLOR_RGB2BGR)
'''
经过opencv处理后,转为PIL格式并保存
'''
image_pil = Image.fromarray(cv.cvtColor(image_cv , cv.COLOR_BGR2RGB))
image_pil.save('xx.jpg')

你可能感兴趣的:(python,图像处理,opencv,python,计算机视觉)