Python PyteSeract无法读取屏幕截图上的数字
您好,我可以找出为什么pytesseract无法读取这些数字,我的结果是:crePython PyteSeract无法读取屏幕截图上的数字,python,image,ocr,python-tesseract,Python,Image,Ocr,Python Tesseract,您好,我可以找出为什么pytesseract无法读取这些数字,我的结果是:cre 有人知道如何改进结果吗?您应该在运行Tesseract(带有opencv库的python代码)之前对图像进行预处理: 图像质量不好,这就是您无法看到预期结果的原因。您可以尝试先预处理图像。请参阅 pytesseract.pytesseract.tesseract_cmd = "C:\\Users\\X\\AppData\\Local\\Tesseract-OCR\\tesseract.exe" im = pyau
有人知道如何改进结果吗?您应该在运行Tesseract(带有opencv库的python代码)之前对图像进行预处理:
图像质量不好,这就是您无法看到预期结果的原因。您可以尝试先预处理图像。请参阅
pytesseract.pytesseract.tesseract_cmd = "C:\\Users\\X\\AppData\\Local\\Tesseract-OCR\\tesseract.exe"
im = pyautogui.screenshot(region=(265, 110, 50, 20))
im.save("screenshot.png")
print(pytesseract.image_to_string(Image.open("screenshot.png")))
import cv2
pytesseract.pytesseract.tesseract_cmd = "C:\\Users\\X\\AppData\\Local\\Tesseract-OCR\\tesseract.exe"
im = pyautogui.screenshot(region=(265, 110, 50, 20))
im= cv2.bitwise_not(im)
im.save("screenshot.png")
print(pytesseract.image_to_string(Image.open("screenshot.png")))