Skip to main content

Lesson 1 of 12

What is OCR?

Optical Character Recognition (OCR) is the technology that converts images of text into machine-readable digital text. It is used in document digitisation, data entry automation, and accessibility tools.

8 minBy Priygop Editorial TeamUpdated 2026Peer Reviewed & Verified

What is OCR?

OCR (Optical Character Recognition) is the process of extracting text from images.

When you photograph a sign, receipt, business card, or book page and your phone converts it to editable text — that is OCR.

OCR is used in:
- Document scanning and digitisation
- Automated data entry from forms and invoices
- Number plate (license plate) reading
- Bank cheque processing
- Translating text in photos
- Accessibility tools that read text aloud from images
- Archiving historical documents

The most widely used open-source OCR engine is Tesseract, originally developed by HP and now maintained by Google. Python's pytesseract library provides a simple interface to Tesseract.

Diagram
Loading diagram…

Machine Learning follows a structured pipeline from data to deployment

OCR Quick Start

OCR Quick Start
# Installation (run in terminal):
# pip install pytesseract pillow
# Also install Tesseract OCR engine:
# Windows: download installer from https://github.com/UB-Mannheim/tesseract/wiki
# Linux:   sudo apt install tesseract-ocr
# macOS:   brew install tesseract

import pytesseract
from PIL import Image
import cv2

# For Windows, tell pytesseract where Tesseract is installed:
# pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe'

# Read text from an image using PIL
image = Image.open("document.jpg")
text = pytesseract.image_to_string(image)
print("Extracted text:")
print(text)

# Read text from an OpenCV image
cv_image = cv2.imread("document.jpg")
text_from_cv = pytesseract.image_to_string(cv_image)
print("\nText from OpenCV image:")
print(text_from_cv[:200])

Finished this lesson?

0 of 12 in Module 7
Sign in to save progress
PreviousStart of module
Next lessonHow OCR Works

Topics in This Module

0/12 done