Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!
CodeDelphiRAD Studio

Optical Character Recognition Component for FireMonkey by Winsoft

  1. Introduction

OCR (Optical Character recognition) for FireMonkey is a FireMonkey type component (it supports Windows, macOS, iOS and Android). Its main purpose is to decode text from a picture into plain text. Check the video below for installation instructions.

2. Components in the Demo and what they do

There are two main panels – one on the left and one on the right witch keep all the other visual components inside. On the left is the TPanel, containing TImageViewer In this case the Image loads the chosen picture. At the top is the ‘Select Picture’ button. The OnClick event executes TOpenDialog window, in which you can load the image from file. The chosen file is shown with the TImageViewer component into the left panel. Watch the Demo in action the video below.

There are more options on the right. When an image with text is loaded from file on the right you can press the ‘Recognize’ button which starts exaction of text in image recognizing. While the process is ACTIVE the button Recognize changes to Cancel and the process could be stopped before it is already finished. The process of text recognition itself uses the TFOcr component which its main purpse is exactly text recognition in an image.

     As you can see from the above code the image with text is already assigned by the OCR component, which means the text can be gotten with the .Text property of the OCR component. This is mainly done on the Recognize button click, containing also different image settings with Canvas, etc.

    All these settings can be checked, using the TTabControl component. It reacts as a tab control, which changes the content on the right depending on the chosen page. First page shows the text in its simple variant. Next there is an html format of the text, then UNLV, followed by Regions, which puts the paragraphs in a frame. ‘The Paragraph’ Tab Sheet divides the recognized text on paragraphs (if there is more than one). The ‘Text Lines’ tab sheet count the lines of the hall text. Next to it is ‘Words’, which frames each word in the recognized text. The ‘Components’ sheet tab divides the text to separate ‘components’.  

You can see all them in the code below:

If Button ’Cancel’ is pressed while text recognition is in progress the flag ‘CancelRequest’ will become true, which will cause the code above to be NOT executed and no result will  be shown on the right.

You can download the Demo here.

Check out FastMath if you need faster calculations that don’t need full accuracy.

Like what you see? You can get PDF Library for Android and over 100 other fantastic WinSoft components with our Enterprise Component Pack. For a limited time, when you purchase RAD Studio Enterprise or Architect Edition at special Upgrade Pricing, you will also get this package of third-party software worth over $13,000, including the full WinSoft Component Library, at NO EXTRA COST! Step up to RAD Studio 10.4.1 today!

See What's Coming in 12.2 Athens Dev Days of Summer 2-24

Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

IN THE ARTICLES