Advertisement
Korobka887

image-to-text-python

Jan 17th, 2023
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. from PIL import Image
  2. from pytesseract import pytesseract
  3.  
  4. path_to_tesseract = r"C:\Users\egorp\AppData\Local\Programs\Tesseract-OCR\tesseract.exe" # URL на экзешник
  5. image_path = r"images\number.jpeg" # URL картинки
  6.  
  7. img = Image.open(image_path)
  8.  
  9. pytesseract.tesseract_cmd = path_to_tesseract
  10.  
  11. text = pytesseract.image_to_string(img)
  12.  
  13. print(text[:-1])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement