12345678910111213 |
- import cv2 as cv
- import pytesseract as pts
- pts.pytesseract.tesseract_cmd = "C:\\Program Files\\Tesseract-OCR\\tesseract.exe"
- img = cv.imread("kolya.png")
- img = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
- ret, threshold_image = cv.threshold(img, 127, 255, 0)
- cv.imshow("result", img)
- cv.waitKey(0)
- config = r'--oem 3 --psm 6'
- print(pts.image_to_string(img, lang="rus", config=config))
|