original-screenshot.png
Вот мой код:< /p>
Код: Выделить всё
path = 'original-screenshot.png'
image = cv2.imread(path)
image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
image = cv2.adaptiveThreshold(image, 255, cv2.ADAPTIVE_THRESH_MEAN_C,
cv2.THRESH_BINARY_INV, 101, -69)
cv2.imwrite('screenshot.png', image)
custom_config = r'--oem 3 --psm 7 -l eng -c tessedit_char_whitelist=abcdefghigklmnopqrstuvwxyz0123456789'
text = pytesseract.image_to_string(image, config=custom_config)
print(text)
screenshot.png
Вывод текста:
Код: Выделить всё
01991f5
Код: Выделить всё
o1991f5
Подробнее здесь: https://stackoverflow.com/questions/787 ... zes-o-as-0