Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python PyteSeract无法读取屏幕截图上的数字_Python_Image_Ocr_Python Tesseract - Fatal编程技术网

Python PyteSeract无法读取屏幕截图上的数字

Python 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

您好,我可以找出为什么pytesseract无法读取这些数字,我的结果是:cre


有人知道如何改进结果吗?

您应该在运行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")))