图像到文本-Pytesseract与Windows上的数字作斗争

问题描述 投票:0回答:1

我正在为ML项目实时预处理游戏框架。我想从框架中提取数字,所以我选择了Pytesseract,因为它在文本上看起来相当不错。虽然,无论我做得多么清晰,它都无法正确阅读。我的代码如下:

section = process_screen(screen_image)[1]
pixels = rgb_to_bw(section) #Makes the image grayscale
pixels[pixels < 200] = 0 #Makes all non-white pixels black
tess.image_to_string(pixels)

=> 'ye ml)'

充其量,当我不指定我想要数字时,它输出“ ye ml)”,而当我输入时,它什么也不输出。

未处理的游戏图像如下所示:Unprocessed Image

“像素”图像如下所示:Pixels image

python image-processing reinforcement-learning python-tesseract
1个回答
0
投票

识别之前,您必须反转图像。

© www.soinside.com 2019 - 2024. All rights reserved.