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 :: python catch all exceptions 
Python :: how to print a line letter by letter in python 
Python :: convert string to operator python 
Python :: sheebang python 
Python :: pandas create dataframe of ones 
Python :: truncate add weird symbols in python 
Python :: programe to check if a is divisible 
Python :: get all paragraph tags beautifulsoup 
Python :: df select first n rows 
Python :: python get script path 
Python :: python code to get all file names in a folder 
Python :: function to convert minutes to hours and minutes python 
Python :: python extract mails from string 
Python :: python memoization 
Python :: python request post with json with headers 
Python :: pandas series to list 
Python :: ValueError: There may be at most 1 Subject headers in a message 
Python :: zermelo api 
Python :: python convert base 
Python :: print without changing line python 
Python :: remove all rows where one ccolumns egale to nan 
Python :: python image black and white 
Python :: python read word document 
Python :: python product of list 
Python :: shuffle array python 
Python :: install python 3 on mac 
Python :: flask run on ip and port 
Python :: saving to csv without the index 
Python :: flask for loops 
Python :: python check if variables are the same 
ADD CONTENT
Topic
Content
Source link
Name
5+8 =