Site icon Python GUI

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?

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.

<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:

 

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.

Open Demo01dproj

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

[crayon-6632e2fd8ac38420312105/]

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:

[crayon-6632e2fd8ac43403685155/]

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

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

<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):

[crayon-6632e2fd8ac45653539989/]

Let’s see the result on our P4D GUI:

<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:

<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):

[crayon-6632e2fd8ac46597315143/]

Let’s see the result on our Python GUI:

<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:

Exit mobile version