Tesseract-OCR is an open source application, which can help us to extract text from images. In this tutorial, we will introduce how to use Tesseract-OCR to extract text from images using python. You can lean how to do by following our tutorial.
Preliminary
You should install tesseract ocr firstly, you can read this tutorial to learn how to install.
Install pytesseract
pip install pytesseract
Import library
from PIL import Image import pytesseract
Extract text from images
text=pytesseract.image_to_string(Image.open(img_path)) print(text)
If you have encountered pytesseract.pytesseract.TesseractNotFoundError, you can refer to this tutorial to learn how to fix.
Fix pytesseract.pytesseract.TesseractNotFoundError for Beginners – Python Tutorial