Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

get text from image python

img = cv2.imread('image.png')

text = pytesseract.image_to_string(img)
print(text)
Comment

python extract text from image

// install tesseract by -> pip install pytesseract
from PIL import Image
from pytesseract import pytesseract
  
# Defining paths to tesseract.exe 
# and the image we would be using
path_to_tesseract = r"C:Program FilesTesseract-OCR	esseract.exe"
image_path = r"csvd.jpg"
  
# Opening the image & storing it in an image object
img = Image.open(image_path)
  
# Providing the tesseract 
# executable location to pytesseract library
pytesseract.tesseract_cmd = path_to_tesseract
  
# Passing the image object to 
# image_to_string() function
# This function will
# extract the text from the image
text = pytesseract.image_to_string(img)
  
# Displaying the extracted text
print(text[:-1])
Comment

PREVIOUS NEXT
Code Example
Python :: stack overflow python timedate 
Python :: errno 13 permission denied python 
Python :: Concat and Append DFs Python 
Python :: print % in python 
Python :: how to make images in python 
Python :: tkinter new line in text 
Python :: display youtube video in jupyter notebook 
Python :: python json open file 
Python :: pandas concatenate 
Python :: torchvision.transforms 
Python :: python turn true or false into 0 or 1 
Python :: how to use print function in python 
Python :: convert string in list format to list python 
Python :: select only some rows pandas 
Python :: pip install django rest framework 
Python :: pandas apply pass in arguments 
Python :: how to execute python program in ubuntu 
Python :: multiple line input python 
Python :: python print version 
Python :: pytest check exception 
Python :: python change column order in dataframe 
Python :: first 5 letters of a string python 
Python :: python print utf-8 
Python :: how to set up dataframe from csv 
Python :: pandas filter every column not null 
Python :: count rows with nan pandas 
Python :: ursina python 
Python :: how to remove stop words in python 
Python :: how to fill a list in python 
Python :: how to take input from user in python 
ADD CONTENT
Topic
Content
Source link
Name
9+8 =