how to recognize or read text from image in python window



extracting text from image using Tesseract ocr
image can be like
-printed page photo
-scanned image
-camera capture image
-window or any other application error message popup screenshot
etc (NOTE:input image should not blurry or noisy)
for recognize or read text you need to follow these steps
-first you should have knowledge of python if not then you need to first watch our video “Python install and helloworld program Tutorial” url :

-download and install tesseract Ocr Library

and add tesseract installation dir path into Environment variables } PATH } New

or use below line on start of your script
pytesseract.pytesseract.tesseract_cmd = r”C:\Program Files (x86)\Tesseract-OCR\tesseract.exe”

then install 2 python libraries
pip install pytesseract
pip install pillow

*************Example Code (**************
 from PIL import Image

import pytesseract

#uncomment below line if you dont want to set "Environment variables" path
 #pytesseract.pytesseract.tesseract_cmd = r"C:\Program Files (x86)\Tesseract-OCR\tesseract.exe"

im ="sample1.jpg")

text = pytesseract.image_to_string(im, lang = 'eng')



thats all
thank you for watching
keep subscribe our channel h2zone


To using Tesseract ocr we can extract text from image like screenshot,printed page photo,scanned image,camera capture image,error message screenshot etc