示例#1
0
def save_train_imgs(train_img_path):
    data_list = os.listdir(train_img_path)
    for file in data_list:
        if file != '.DS_Store':
            img = Image.open(train_img_path + file)
            img = solve_it.dele_noise(img, N=2, Z=1)
            img = solve_it.clear_lib_line(img)
            img_list = solve_it.cut_img_to_img_list(img,30,background=255)
            for k,i in enumerate(img_list):
                random_num = str(time.time())[-10:-3].replace('.',str(random.random())[2:4])
                i.save('train_imgs/{}.png'.format(file[k]+'-'+random_num))
示例#2
0
def break_capt(img):
    img = solve_it.dele_noise(img, N=2, Z=1)
    img = solve_it.clear_lib_line(img)
    mode_list = solve_it.cut_img_to_mode_list(img, 30)

    # imgs = map()

    test_x = np.array(mode_list)
    ans = pred_ans(test_x)
    res = ''.join(map(chr_num, ans.tolist()))
    return res