import os import cv2 bacepath = "D:/images/" savepath = 'D:/images/' f_n = os.listdir(bacepath) print(f_n) for n in f_n: imdir = bacepath + n print(n) img = cv2.imread(imdir) cropped = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) cv2.imwrite(savepath + n, cropped) print('finish')
版权声明:本文为LingYi_5原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。