fayllar.org
ma'muriyatiga murojaat qiling
#Define path to tessaract exe path to tesseract =
Download
224.68 Kb.
Sana
20.12.2022
Hajmi
224.68 Kb.
#1039944
Bog'liq
713-20.Mashina
from PIL import Image
from pytesseract
import pytesseract
import os
#Define path to tessaract.exe
path_to_tesseract = r'C:\Program Files\Tesseract-OCR\tesseract.exe'
#Define
path to images folder
path_to_images = r'images/'
#Point tessaract_cmd to tessaract.exe
pytesseract.tesseract_cmd = path_to_tesseract
#Get the
file names in the directory
for root, dirs, file_names in os.walk(path_to_images):
#Iterate over
each file name in the folder
for file_name in file_names:
#Open
image with PIL
img = Image.open(path_to_images + file_name)
#Extract
text from image
text = pytesseract.image_to_string(img)
print(text)
Download
224.68 Kb.
Do'stlaringiz bilan baham:
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling