我的计划是做一个机器人,在messenger上回答机器人的问题。
信使机器人的消息是随机数字或数学问答机器人
所以我想做一个机器人来回答信使机器人的问题
我写了一个这样的代码:
import pyautogui
import pytesseract
from PIL import Image我想每隔10秒截屏一次
pyautogui.sleep(2)睡两秒钟,让我有时间从pycharm切换到messenger
pyautogui.screenshot('x_value.png', confidence=0.8)
img = Image.open('x_value.png')
img = pytesseract.image_to_string(img)
print(img)here is the taken screenshot by my bot
结果如下:
Tee oxHj我试着用元组调整图像的大小,但还是得到了错误的结果……我希望你们能帮助我,这样我就可以改善我的skills....thank了。
发布于 2020-10-25 17:22:24
当我反转图像时,它起作用了。但是我不能使用.png格式,所以我尝试了.jpg格式,它工作了。你可以试试这个。
import pytesseract
from PIL import Image, ImageOps
img = Image.open('f1.jpg')
img = ImageOps.invert(img)
img = pytesseract.image_to_string(img)
print(img)希望我能帮上忙。
https://stackoverflow.com/questions/64521587
复制相似问题