https://blog.csdn.net/sxlsxl119/article/details/81332856
#可以读取带中文路径的图
def cv_imread(file_path,type=0):
cv_img=cv2.imdecode(np.fromfile(file_path,dtype=np.uint8),-1)
if(type==0):
cv_img = cv2.cvtColor(cv_img, cv2.COLOR_BGR2GRAY)
return cv_img
#保存图片到带中文的路径下
savePath = (r"D:\sxl\处理图片\汉字分类\train653_badHandle\%d.jpg" % (count))
cv2.imencode('.jpg', newimg)[1].tofile(savePath) # 保存图片
本文介绍了如何使用OpenCV在Python中读取包含中文路径的图片,并演示了如何将处理后的图片保存到指定的中文目录。重点在于处理中文路径和基本的图像操作技巧。
2821

被折叠的 条评论
为什么被折叠?



