[英]Pytesseract does not recognize numbers despite trying every -psm
I've been trying to get some numbers from this image but pytesseract only gives me random letters.我一直试图从这张图片中获取一些数字,但 pytesseract 只给我随机字母。 I've tried many -psm options but it does not seem to work.
我尝试了许多 -psm 选项,但似乎不起作用。 Here's the code I'm using:
这是我正在使用的代码:
from PIL import Image
import pytesseract
print(pytesseract.image_to_string(Image.open("Test.png"), config="--psm 6"))
What could I do to make it more succesful?我能做些什么来让它更成功?
Try this code.试试这个代码。
import cv2
import pytesseract
img = cv2.imread("vuK1z.png", 0)
thresh = cv2.threshold(img, 127, 255, cv2.THRESH_BINARY_INV)[1]
custom_config = r'-l eng --oem 3 --psm 6 '
text = pytesseract.image_to_string(thresh, config=custom_config)
print(text)
Result结果
550,000
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.