尽管尝试了每个 -psm,Pytesseract 仍无法识别数字
Pytesseract does not recognize numbers despite trying every -psm
我一直在尝试从 this image 中获取一些数字,但 pytesseract 只给我随机字母。我尝试了很多 -psm 选项,但它似乎不起作用。这是我正在使用的代码:
from PIL import Image
import pytesseract
print(pytesseract.image_to_string(Image.open("Test.png"), config="--psm 6"))
我该怎么做才能让它更成功?
试试这个代码。
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)
结果
550,000
我一直在尝试从 this image 中获取一些数字,但 pytesseract 只给我随机字母。我尝试了很多 -psm 选项,但它似乎不起作用。这是我正在使用的代码:
from PIL import Image
import pytesseract
print(pytesseract.image_to_string(Image.open("Test.png"), config="--psm 6"))
我该怎么做才能让它更成功?
试试这个代码。
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)
结果
550,000