DelphiLearn PythonPythonPython GUIRAD StudioWindows

How To Build A GUI For Optical Character Recognition

blogbanner easyocr

Are you looking for the easiest way to build an Optical Character Recognizer for 80+ languages and build a nice GUI for them, and all of them are free? You can deliver end-to-end multilingual OCR solutions easily by combining EasyOCR and Python4Delphi library, inside Delphi and C++Builder.

This post will guide you on how to run the EasyOCR library and use Python for Delphi to display it in the Delphi Windows GUI app.

 

What is the EasyOCR library?

How To Build A GUI For Optical Character Recognition EasyOCR Logo

EasyOCR, as the name suggests, is a Python package that allows computer vision developers to effortlessly perform Optical Character Recognition. EasyOCR provides end-to-end, and ready-to-use OCR with 80+ supported languages and all popular writing scripts including Latin, Chinese, Arabic, Devanagari, Cyrillic, etc.

How To Build A GUI For Optical Character Recognition The EasyOCR Framework
<strong>EasyOCR Pipeline<strong> Image Source httpsgithubcomJaidedAIEasyOCR

When it comes to OCR, using EasyOCR is by far the most straightforward way to apply Optical Character Recognition:

  • The EasyOCR package can be installed with a single pip command.
  • The dependencies on the EasyOCR package are minimal, making it easy to configure your OCR development environment.
  • Once EasyOCR is installed, only one import statement 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 Reader class and then another to OCR the image via the readtext function.

 

How do I enable EasyOCR inside Python4Delphi in Windows?

First, open and run our Python GUI using project Demo1 from Python4Delphi with RAD Studio. Then insert the script into the lower Memo, click the Execute button, and get the result in the upper Memo. You can find the Demo1 source on GitHub. The behind the scene details of how Delphi manages to run your Python code in this amazing Python GUI can be found at this link.

How To Build A GUI For Optical Character Recognition Python4Delphi in RAD Studio IDE
Open Demo01dproj

The next step is installing EasyOCR into your system. Here is how you can get EasyOCR using pip for stable release:

Note: For Windows, please install torch and torchvision first by following the official instructions here. On the pytorch website, be sure to select the right CUDA version you have. If you intend to run on CPU mode only, select CUDA = None.

Or read more about PyTorch in our article about it:

How can I automatically recognize characters in images with EasyOCR?

Example 1: Simplified Chinese Character and English Recognition

To save your time when running OCR for Chinese character inside Python4Delphi GUI, let’s run this script inside your cmd, to download the detection and recognition models for Simplified Chinese:

Next, we will test the EasyOCR library to detect both Chinese characters and English in this image:

How To Build A GUI For Optical Character Recognition Results of processing in terminal window

Next, we will test the EasyOCR library to detect both Chinese characters and English in this image:

How To Build A GUI For Optical Character Recognition Chinese OCR
<strong>Image Source <strong>httpscmsqzcomwp contentuploads201706china english road signs 2017 e1498204314511jpgquality=75strip=allw=1600h=903

The following is a basic usage of EasyOCR to detect both Chinese characters and English in the sample image above (run this inside the lower Memo of Python4Delphi Demo01 GUI):

Let’s see the result on our P4D GUI:

How To Build A GUI For Optical Character Recognition Demo output
<strong>EasyOCR <strong>Simplified Chinese Character and English Detection Demo with Python4Delphi in Windows

 

Example 2: Arabic Character and English Recognition

Next example, we will test the EasyOCR library to detect both Arabic characters and English in this image:

How To Build A GUI For Optical Character Recognition Recognizing Arabic characters in your app
<strong>Image Source<strong> httpssc04alicdncomkfH25fecd88d1a54cd494a7d11f23491f13gjpg

Run the following EasyOCR code to detect both Arabic characters and English in the sample image above (run this inside the lower Memo of Python4Delphi Demo01 GUI):

Let’s see the result on our Python GUI:

How To Build A GUI For Optical Character Recognition Results of processing OCR in your app
<strong>EasyOCR <strong>Arabic Character and English Detection Demo with Python4Delphi in Windows

Check out the full source code here!

Amazing isn’t it? You can make your computer recognize Chinese, Arabic, and English characters, as well as other 80+ supported languages.

Congratulations, now you have learned how to run the EasyOCR library using Python for Delphi to display it in the Delphi Windows GUI app! Now you can build countless powerful apps based on this end-to-end OCR framework created by the EasyOCR library and Python4Delphi.

 

Where can I find more examples of building GUI for Computer Vision libraries?

Check out the EasyOCR computer vision framework for Python and use it in your projects: 

https://pypi.org/project/easyocr/ and

Check out Python4Delphi which easily allows you to build Python GUIs for Windows using Delphi: https://github.com/pyscripter/python4delphi

Or read our collections of Computer Vision and AI-related articles:

Keras: 

OpenCV:

Face Recognition:

Mahotas:

PyTorch:

5 Ultimate Python Computer Vision Libraries:

10 Ultimate Python AI Libraries:

Related posts
CodeIDELearn PythonPythonPython GUITkinter

How To Make More Than 20 ChatGPT Prompts Work With Python GUI Builders And OpenCV Library?

CodeIDEProjectsPythonWindows

Unlock the Power of Python for Deep Learning with Radial Basis Function Networks (RBFNs)

CodeIDELearn PythonPythonPython GUITkinter

How To Make More Than 20 ChatGPT Prompts Work With Python GUI Builders And NumPy Library?

CodeIDEProjectsPythonWindows

Unlock the Power of Python for Deep Learning with Generative Adversarial Networks (GANs) - The Engine behind DALL-E

Leave a Reply

Your email address will not be published. Required fields are marked *