处理器图像:
处理后图像:
代码:
from PIL import Image image = Image.open('4.jpg') image = image.convert('L') image.show() import numpy as np image = np.asarray(image) image = (image > 135) * 255 image = Image.fromarray(image).convert('RGB') image.show() image.save('4.png')