Давид В. Андриевский il y a 3 ans
commit
e1b3d720d2
2 fichiers modifiés avec 13 ajouts et 0 suppressions
  1. BIN
      kolya.png
  2. 13 0
      tesseract.py

BIN
kolya.png


+ 13 - 0
tesseract.py

@@ -0,0 +1,13 @@
+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))