Open Source Python API to Integrate OCR Capabilities
Free Python OCR API for Accurate and Fast Text Recognition from Images & Documents. Read both Natural Scene Text and Dense Text in document.
What is EasyOCR?
EasyOCR is a fast, accurate open-source OCR engine that offers software developers a streamlined way to automate data entry and document processing tasks. Its simple interface allows for seamless integration into applications, enabling rapid text extraction from both images and scanned documents within seconds. This makes it an ideal, cost-effective tool for businesses focused on document management, data extraction, and workflow automation without needing hardware or software installation.
Built with Python and powered by deep learning algorithms, the EasyOCR API delivers high accuracy and can quickly process large volumes of data. It provides a flexible and scalable cloud-based solution, accessible via a simple RESTful API, with comprehensive support for over 80 languages. This multi-language support is essential for global operations. Key features like accurate text extraction and customizable engine options allow businesses of all sizes to reduce costs, improve accuracy, and efficiently receive and store extracted text for their specific needs.
Getting Started with EasyOCR
The recommend way to install EasyOCR is using pip. Please use the following command for a smooth installation.
Install EasyOCR via pip
pip install easyocr You can also install it manually; download the latest release files directly from GitHub repository.
Text Reading & Extraction from Image via Python API
The open source EasyOCR API uses deep learning algorithms to load, recognize and extract text from images and PDF files inside Python applications. EasyOCR can read multiple languages at the same time but they have to be compatible with each other. Languages that share most of character (e.g. latin script) with each other are compatible. The API allows reading and extracting text from images, including how to preprocess the images and adjust the OCR engine's parameters to improve accuracy. The following example shows how to read and extract text from images and automate data entry tasks with ease.
How to Read and Extract Text from Images via Python API?
import easyocr
reader = easyocr.Reader(['en']) # Set the language of the OCR engine
# Load the image and preprocess it
from PIL import Image
import cv2
image = Image.open('text_image.png')
image = image.convert('L') # Convert the image to grayscale
image = cv2.imread('text_image.png')
# Use the OCR engine to extract text from the image.
result = reader.readtext(image, detail=0)
Recognizing Characters from Text Boxes via Python API
Recognizing characters from text boxes is a common use case for OCR engines. The open source EasyOCR API provides a powerful and user-friendly solution to this use case. It helps software developers to recognize characters from text boxes with ease and how to preprocess the images and adjust the OCR engine's parameters to improve accuracy. Text boxes can have different shapes, sizes, and orientations, and this can impact the accuracy of the OCR engine. So applying some preprocessing steps can improve the accuracy of the OCR engine, such as Deskew the image, Apply binarization and Apply noise reduction.
How to Recognizing Characters from Text Boxes via Python API?
import easyocr
reader = easyocr.Reader(['en']) # Set the language of the OCR engine
# Load the image and preprocess it
from PIL import Image
import cv2
image = Image.open('text_box.png')
image = image.convert('L') # Convert the image to grayscale
image = cv2.imread('text_box.png')
# OCR engine to recognize the characters in the text box
result = reader.readtext(image, detail=0)
# The result is a list of strings, where each string represents a recognized character in the text box.