def tesser_money_image(image):
image = cv2.resize(image, (0,0), fx=2, fy=2)
image = PIL.Image.fromarray(image)
txt = pytesseract.image_to_string(image, config='-psm 7')
txt_list = list(txt)
for i in range(len(txt_list)):
if txt_list[i] == 'o':
txt_list[i] = '0'
elif txt_list[i] == 'O':
txt_list[i] = '0'
elif txt_list[i] == 'l':
txt_list[i] = '1'
elif txt_list[i] == 'I':
txt_list[i] = '1'
elif txt_list[i] == 'i':
txt_list[i] = '1'
elif txt_list[i] == 'M':
txt_list[i] = '000000'
elif txt_list[i] == 'K':
txt_list[i] = '000'
elif txt_list[i] == 'm':
txt_list[i] = '000000'
elif txt_list[i] == 'k':
txt_list[i] = '000'
elif txt_list[i] == 's':
txt_list[i] = '5'
elif txt_list[i] == 'S':
txt_list[i] = '5'
elif txt_list[i] == 'W':
txt_list[i] = '40'
txt = int(''.join(txt_list))
return(txt)
评论列表
文章目录