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)  # 保存图片

 

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐