- Optical Character Recognition Software
- Optical Character Recognition Free
- Optical Character Recognition Unit
These Optical Character Recognition and Verification systems include adapted, low distortion optics and programmable, computer-controlled illumination, for maximum repeatability of results. They also include the entire VisionGauge ® OnLine toolset. All of VisionGauge ® OnLine's image processing and analysis tools are thus available to automatically 'cleanup' the image before carrying out the. Optical character recognition process includes segmentation, feature extraction and classification. Text capture converts Analog text based resources to digital text resources. And then these converted resources can be used in several ways like searchable text in indexes so as to identify documents or images. Optical Character Recognition (OCR) is part of the Universal Windows Platform (UWP), which means that it can be used in all apps targeting Windows 10. With OCR you can extract text and text layout information from images. It’s designed to handle various types of images, from scanned documents to photos. At the same time, it.
In this tutorial, you will learn how to use the EasyOCR package to easily perform Optical Character Recognition and text detection with Python.
EasyOCR, as the name suggests, is a Python package that allows computer vision developers to effortlessly perform Optical Character Recognition.
When it comes to OCR, EasyOCR is by far the most straightforward way to apply Optical Character Recognition:
- The EasyOCR package can be installed with a single
- The dependencies on the EasyOCR package are minimal, making it easy to configure your OCR development environment.
- Once EasyOCR is installed, only one
importstatement is required to import the package into your project.
- From there, all you need is two lines of code to perform OCR — one to initialize the
Readerclass and then another to OCR the image via the
Sound too good to be true?
Luckily, it’s not — and today I’ll show you how to use EasyOCR to implement Optical Character Recognition in your own projects.
Applications of Optical Character Recognition. There are many applications that Optical Character Recognition is used to. Here is one example. Ticket counter makes use of the Optical Character Recognition for detection and scanning the important data on the ticket to identify the commuter detail as well as routes.
Optical Character Recognition Software
To learn how to use EasyOCR for Optical Character Recognition, just keep reading.
Looking for the source code to this post?Jump Right To The Downloads Section
Getting started with EasyOCR for Optical Character Recognition
In the first part of this tutorial, we’ll briefly discuss the EasyOCR package. From there, we’ll configure our OCR development environment and install EasyOCR on our machine.
Next, we’ll implement a simple Python script that performs Optical Character Recognition via the EasyOCR package. You’ll see firsthand how simple and straightforward it is to implement OCR (and even OCR text in multiple languages).
We’ll wrap up this tutorial with a discussion of the EasyOCR results.
What is the EasyOCR package?
The EasyOCR package is created and maintained by Jaided AI, a company that specializes in Optical Character Recognition services.
EasyOCR is implemented using Python and the PyTorch library. If you have a CUDA-capable GPU, the underlying PyTorch deep learning library can speed up your text detection and OCR speed tremendously.
As of this writing, EasyOCR can OCR text in 58 languages, including English, German, Hindi, Russian, and more! The EasyOCR maintainers plan to add additional languages in the future. You can find the full list of languages EasyOCR supports on the following page.
Currently, EasyOCR only supports OCR’ing typed text. Later in 2020 they plan on releasing a handwriting recognition model as well!
How to install EasyOCR on your machine
To get started installing EasyOCR, my recommendation is to follow my pip install opencv tutorial with an important caveat:
Be sure to install
opencv-python and not
opencv-contrib-python in your virtual environment. Furthermore, if you have both of these packages in the same environment, it could lead to unintended consequences. It is unlikely that pip would complain if you have both installed, so be diligent and check with the
pip freeze command.
Of course both OpenCV packages are discussed in the aforementioned tutorial; just be sure to install the correct one.
And my recommendation is that you dedicate a separate Python virtual environment on your system for EasyOCR (Option B of the pip install opencv guide).
However, although option B suggests naming your virtual environment
cv, I’d recommend naming it
ocr_easy, or something similar. Download halo 2 vista free trial free. If you saw my personal system, you’d be amazed that at any given time, I have 10-20 virtual environments on my system for different purposes, each with a descriptive name that means something to me.
Your installation steps should look like the following:
- Step #1: Install Python 3
- Step #2: Install pip
- Step #3: Install
virtualenvwrapperon your system, which includes editing your Bash/ZSH profile, as instructed
- Step #4: Create a Python 3 virtual environment named
easyocr(or pick a name of your choosing), and ensure that it is active with the
- Step #5: Install OpenCV and EasyOCR according to the information below
To accomplish Steps #1-#4, be sure to first follow the installation guide linked above.
When you’re ready for Step #5, simply execute the following:
If you have any installation problems with
openv-python, the PyPi package page is helpful. For example, I learned on that page that I needed to upgrade my version of pip.
If you chose to install
easyocr into an existing Python virtual environment, be sure to inspect the output of the following commands:
Notice the following packages are installed:
There are also a handful of other EasyOCR dependencies that are automatically installed for you.
Most importantly, as I mentioned above, ensure that you have
opencv-python and NOT
opencv-contrib-python installed in your virtual environment.
You’ll be up and running in no time flat if you carefully follow the steps I’ve outlined. Once your environment is ready to go, you can get started with EasyOCR for Optical Character Recognition.
Optical Character Recognition Free
Take a moment to find the “Downloads” section of this blog post. Inside the project folder, you’ll find the following files:
Today’s EasyOCR project is already appearing to live up to its name. As you can see, we have three testing
images/ and a single Python driver script,
easy_ocr.py. Our driver script accepts any input image and the desired OCR language to get the job done quite easily, as we’ll see in the implementation section.
Using EasyOCR for Optical Character Recognition
With our development environment configured and our project directory structure reviewed, we are now ready to use the EasyOCR package in our Python script!
Open up the
easy_ocr.py file in the project directory structure, and insert the following code:
Our EasyOCR package should stand out here; notice how we’re importing
Reader from the
Given that OpenCV’s
putText function can’t display non-ASCII characters, let’s define a quick convenience function to parse out those potentially pesky symbols:
As you can see, the
cleanup_text helper function simply ensures that character ordinals in the
text string parameter are less than
128, stripping out any other characters. If you’re curious about the significance of
128, be sure to check out any standard ASCII character table such as this one.
With our inputs and convenience utility ready to go, let’s now define our command line arguments:
Our script accepts three command line arguments:
--image: The path to the input image containing text for OCR.
--langs: A list of language codes separated by commas (no spaces). By
defaultour script assumes English language (
en). If you’d like to use the English and French models, you could pass
en,fr. Or maybe you’d like to use Spanish, Portuguese, and Italian by passing
es,pt,it. Be sure to refer to EasyOCR’s listing of supported languages.
--gpu: Whether or not you’d like to use a GPU. Our
-1, meaning that we’ll use our CPU rather than a GPU. If you have a CUDA-capable GPU, enabling this option will allow faster OCR results.
Given our command line arguments, let’s perform OCR:
Line 22 breaks our
--langs string (comma delimited) into a Python list of languages for our EasyOCR engine.
Note: Unlike Tesseract, EasyOCR can work with OpenCV’s default BGR color channel ordering. Therefore, we do not need to swap color channels after loading the image.
To accomplish Optical Character Recognition with EasyOCR, we first instantiate a
Reader object, passing the
--gpu boolean to the constructor (Line 30). From there, we call the
readtext method while passing our input
image (Line 31).
Reader class and
readtext method are documented in the GitHub project if you’d like to customize your EasyOCR configuration.
results consist of a 3-tuple:
bbox: The bounding box coordinates of the localized text
text: Our OCR’d string
prob: The probability of the OCR results
Looping over each EasyOCR result, we first unpack the bounding box coordinates (Lines 34-43). To prepare our
text for annotation, we sanitize it via our
cleanup_text utility (Line 47).
We then overlay our image with a bounding box surrounding the text and the
text string itself (Lines 48-50).
results are processed and annotated, Lines 53 and 54 display the output
image on our screen.
We are now ready to see the results of applying Optical Character Recognition with the EasyOCR library.
Start by using the “Downloads” section of this tutorial to download the source code and example images.
From there, open up a terminal, and execute the following command:
Here you can see that I am OCR’ing an airport sign containing both English and Arabic text.
--langs en,ar arguments indicate, we’re instructing our script (and ultimately EasyOCR) to OCR in both Arabic and English. You may pass a comma-separated list of languages that EasyOCR supports.
EasyOCR is able to detect and correctly OCR the English and Arabic text in the input image.
Note: If you are using EasyOCR for the first time, you’ll see an indication printed in your terminal that EasyOCR is “Downloading detection model[s].” Be patient while the files download. Once these models are cached on your system, you can use them again and again seamlessly and quickly.
Let’s try another image, this one containing a Swedish sign:
Here we are asking EasyOCR to OCR both English (
en) and Swedish (
For those not already familiar with the sign, “Fartkontrol” is a bit of a joke amongst the Swedes and Danes.
Literally translated, “Fartkontrol” in English means “Speed Control” (or simply speed monitoring).
But when pronounced, “Fartkontrol” sounds like “fart control” — perhaps someone who is having an issue controlling their flatulence. In college, I had a friend who hung a Swedish “Fartkontrol” sign on their bathroom door — maybe you don’t find the joke funny, but anytime I see that sign I chuckle to myself (perhaps I’m just an immature 8-year-old).
For our final example, let’s look at a Turkish stop sign:
I ask EasyOCR to OCR both English (
en) and Turkish (
tr) text by supplying those values as a comma-separated list via the
--langs command line argument.
EasyOCR is able to detect the text, “DUR,” which when translated from Turkish to English is “STOP.”
As you can see, EasyOCR lives up to it’s name — finally, an easy-to-use Optical Character Recognition package!
Additionally, if you have a CUDA-capable GPU, you can obtain even faster OCR results by supplying the
--gpu command line argument, as in the following:
Optical Character Recognition Unit
But again, you will need to have a CUDA GPU configured for the PyTorch library (EasyOCR uses the PyTorch deep learning library under the hood).
If you enjoyed this project and you’d like to develop your knowledge of OCR further, you really need to check out my new OCR book, which I’m actively writing and developing.
Over the years, PyImageSearch content has become synonymous with quality education. I’ve received feedback from readers of my blog and books, informing me about how much they’ve learned and the impacts it has had on their career paths. Hearing success stories often is why I love leading PyImageSearch so much and what motivates me to continue teaching and sharing knowledge.
In continuing with my proven track record, my goal is to deliver you the hands-down best OCR book on the market.
Inside my new book, you’ll find practical code examples, proven use cases, and fundamental knowledge organized in a way that is easy to learn from and straightforward to apply to your own OCR projects.
But I need your help!
To ensure that my latest book is a success, on Aug. 19, 2020 I launched an IndieGoGo funding campaign.
This funding campaign allowed me to offer an exclusive pre-sale of the product, while also ensuring that I can keep the PyImageSearch lights on, servers running, and my team paid. While the funding campaign is over, you can still pre-order a copy of my upcoming OCR book.
To pre-order my new book OCR with OpenCV, and Tesseract:
In this tutorial, you learned how to perform Optical Character Recognition using the EasyOCR Python package.
Unlike the Tesseract OCR engine and the pytesseract package, which can be a bit tedious to work with if you are new to the world of Optical Character Recognition, the EasyOCR package lives up to its name — EasyOCR makes Optical Character Recognition with Python “easy.”
Furthermore, EasyOCR has a number of benefits going for it:
- You can use your GPU to increase the speed of your Optical Character Recognition pipeline.
- You can use EasyOCR to OCR text in multiple languages at the same time.
- The EasyOCR API is Pythonic, making it simple and intuitive to use.
I’m covering EasyOCR in my book OCR with OpenCV, Tesseract, and Python — be sure to take a look if you are interested in learning more about Optical Character Recognition!
To download the source code to this post (and be notified when future tutorials are published here on PyImageSearch), simply enter your email address in the form below!
Download the Source Code and FREE 17-page Resource Guide
Enter your email address below to get a .zip of the code and a FREE 17-page Resource Guide on Computer Vision, OpenCV, and Deep Learning. Inside you'll find my hand-picked tutorials, books, courses, and libraries to help you master CV and DL!