Article / 文章中心

Gif动图验证码识别

发布时间:2022-06-24 点击数:2054

识别流程:

 

流程说明:

    1.Gif转png,每一帧保存为png格式图片     2.每张png图片进行单独识别     3.统计每个对应位置字符频率,每个位置取最高频率字符作为对应位置字符识别结果     4.拼接指定长度字符作为最终识别结果

抽帧模块:

 
def gif_to_png(length,image):
    '''
    gif抽帧
    :param length:
    :param image:
    :return:
    '''
    try:
        yzm_list = []
        for i in range(1, length):
            image.seek(i)
            stream = BytesIO()
            image.save(stream, 'PNG')
            s = stream.getvalue()
            yzm_list.append(s)
        return yzm_list
    except Exception as e:
        print(e)
    return None