Python 3.x PyteSeract图像\u到\u字符串未拉字符串,但无错误

Python 3.x PyteSeract图像\u到\u字符串未拉字符串,但无错误,python-3.x,image,image-processing,python-imaging-library,python-tesseract,Python 3.x,Image,Image Processing,Python Imaging Library,Python Tesseract,我正在使用pytesseract包中的image_to_string函数将单个图片文件的多个部分转换为字符串。除此图像外,所有零件均正常工作: 下面是我用来转换它的脚本: from PIL import Image import pytesseract pytesseract.pytesseract.tesseract_cmd = 'C:/Program Files (x86)/Tesseract-OCR/tesseract' im = Image.open('image.png') text

我正在使用pytesseract包中的image_to_string函数将单个图片文件的多个部分转换为字符串。除此图像外,所有零件均正常工作:

下面是我用来转换它的脚本:

from PIL import Image
import pytesseract
pytesseract.pytesseract.tesseract_cmd = 'C:/Program Files (x86)/Tesseract-OCR/tesseract'

im = Image.open('image.png')
text = pytesseract.image_to_string(im)
print(text)
它给出了输出:

-\-\-\N-\-\-\-\-\N


我尝试过将图像分割成更小的部分,并将图像处理为jpg和png。我该怎么做才能让它输出图像中的值呢?

使用不同的页面分割而不是默认的页面分割似乎有效

text = pytesseract.image_to_string(im,config ='--psm 6'))
根据tesseract wiki,选项6假设一个统一的文本块。我尝试了其他选择,但只有这一个有效。
要查看其他页面分割方法,请阅读tesseract wiki,了解如何提高图像质量。

使用不同的页面分割而不是默认的页面分割似乎有效

text = pytesseract.image_to_string(im,config ='--psm 6'))
根据tesseract wiki,选项6假设一个统一的文本块。我尝试了其他选择,但只有这一个有效。 要查看其他页面分割方法,请阅读tesseract wiki,了解如何提高图像质量