Created
April 19, 2021 06:25
-
-
Save codeperfectplus/46a5b150bb6fb587aa8d0ffb04fb70ea to your computer and use it in GitHub Desktop.
Optical Character Recognition Using PyTesseract
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
import pytesseract | |
pytesseract.pytesseract.tesseract_cmd = r"path_to_tessract.exe" | |
def ocr(filename): | |
img = Image.open(filename) | |
text = pytesseract.image_to_string(img) | |
return text | |
print(ocr_core('sample2.png')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment