彩色图rgb转换成灰色图

import os
from PIL import Image
I = Image.open(r'D:\xxxxx\sobel-operator-pytorch-master\sample-imgs\33.jpg')
L = I.convert('L')
L.save(r'D:\xxxxx\sobel-operator-pytorch-master\sample-imgs\1.png')

效果展示:

 

猜你喜欢

转载自blog.csdn.net/likunpengjiayou/article/details/125936618