原始图片: 降噪后的图片 实现代码: # coding:utf-8 import sys, os from PIL import Image, ImageDraw # 二值数组 t2val = {} def twoValue(image, G): for y in xrange(0, image.size[1]): for x in xrange(0, image.size[0]): g = image.getpixel((x, y)) if g > G: t2val[(x, y)] = 1 e…