伊谢尔伦2017-04-18 10:04:04
在识别之前做一些基本的图片处理,可以提高识别率:
im = Image.open(img_name)
enhancer = ImageEnhance.Color(im)
enhancer = enhancer.enhance(0)
enhancer = ImageEnhance.Brightness(enhancer)
enhancer = enhancer.enhance(2)
enhancer = ImageEnhance.Contrast(enhancer)
enhancer = enhancer.enhance(8)
enhancer = ImageEnhance.Sharpness(enhancer)
im = enhancer.enhance(20)
print pytesseract.image_to_string(im)