![](/img/trans.png)
[英]How do I find ALL the positions of the lowest numbers in a list? (python)
[英]How to find out all the numbers and the positions of them in an image with Python?
此處缺少一些結果,但您可以從以下方法開始:
代碼:
import pytesseract
from PIL import Image
pytesseract.pytesseract.tesseract_cmd = r'c:\Program Files\Tesseract-OCR\tesseract.exe'
img = Image.open('image.png')
for x, ltr in enumerate('abcdefghijklmno'):
for y, nbr in enumerate(range(15, 0, -1)):
x_start = 20+x*30
y_start = 20+y*30
img_crop = img.crop((x_start, y_start, x_start+20, y_start+20))
res = pytesseract.image_to_string(img_crop).replace('\f', '').replace('\n', '')
if res:
print(f'{ltr}{nbr} - {res}')
Output:
b9 - 39
c7 - 44
c6 - 22
d9 - 37
f11 - 31
f10 - 42
f4 - 24
f3 - 23
g11 - 20
h11 - 26
i12 - 25
j11 - 27
j9 - 21
k10 - 28
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.