https://digi.bib.uni-mannheim.de/tesseract/tesseract-ocr-setup-3.05.02-20180621.exe ________________________________________________________________________ create path variable: TESSDATA_PREFIX=C:\Program Files (x86)\Tesseract-OCR _______________________________________________________________________ import os import tempfile import subprocess import pytesseract pytesseract.pytesseract.tesseract_cmd = 'C:/Program Files (x86)/Tesseract-OCR/tesseract' def ocr(path): temp = tempfile.NamedTemporaryFile(delete=False) process = subprocess.Popen(['tesseract', path, temp.name], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) process.communicate() with open(temp.name + '.txt', 'r') as handle: contents = handle.read() os.remove(temp.name + '.txt') #os.remove(temp.name) return contents str = ocr(r'C:\Users\Freeware Sys\Downloads\alpha.jpg') print(str)
International Corporate Trainer | Technical Consultant | Data Scientist | IoT Solution Architect | Blockchain Architect | Industry 4.0 Architect
Sunday, 4 November 2018
OCR -AI -ML
Subscribe to:
Post Comments (Atom)
Still not Working, File Not Found Error
ReplyDelete