Created
July 19, 2022 10:03
-
-
Save Wujek280/99a360b72d964e758bea3c32b837e8b3 to your computer and use it in GitHub Desktop.
OCR
This file contains 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
#! /usr/bin/env python3 | |
# pip install pytesseract | |
# | |
# Simple cli ocr using pytesseract library | |
# License MIT | |
# Author JS.0N | |
import os | |
import sys | |
import numpy as np | |
from PIL import Image | |
import pytesseract | |
# import cv2 | |
for file in sys.argv: | |
if(file == './ocr.py' or file.endswith('/ocr')): | |
continue | |
filename = file ## sys.argv[i] | |
img1 = np.array(Image.open(filename)) | |
# text = pytesseract.image_to_string(img1, nice=4, config='outputbase digits') | |
text = pytesseract.image_to_string(img1, nice=4) | |
print(text) | |
print(file) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment