二值化
    :param img:
    :param threshold:
    :return:

def binarizing(img,threshold):
    """
    二值化
    :param img:
    :param threshold:
    :return:
    """
    pixdata = img.load()
    w, h = img.size
    for y in range(h):
        for x in range(w):
            if pixdata[x, y] < threshold:
                pixdata[x, y] = 0
            else:
                pixdata[x, y] = 255
    return img