测试

2020-06-01  本文已影响0人  l猫宁一
def draw_a_black_unit(p, x, y, ul):
    draw = ImageDraw.Draw(p)
    font = ImageFont.truetype("/Library/Fonts/Arial Unicode.ttf", 10, encoding="utf-8")
    colors = ["red","orange","green","blue","purple"]
    color = random.choice(colors)
    draw.text((x, y), '●', fill = color, font=font)

nihao

myqr https://space.bilibili.com/279911711

你好

def mask(mm, m):
    mps = get_mask_patterns(mm)
    scores = []
    for mp in mps:
        score = 0
        for i in range(len(mp)):
            for j in range(len(mp)):
                mp[i][j] = mp[i][j] ^ m[i][j]
                if mp[i][j] == 1:
                    score += 1
        scores.append(score)
    best = scores.index(min(scores))
上一篇下一篇

猜你喜欢

热点阅读