How to Capture Text from Image using OCR package | Automation Anywhere

How to Capture Text from Image using OCR package | Automation Anywhere

To automate task......

Problem Statement:

To automate the task of extracting text from an image and displaying it.

OCR package of Automation Anywhere:

The extracted invoice number from the image files

Extract P.O. number from PDF files

Objectives:

We have extracted a text from an image file or a window and displayed it using OCR.

OCR Package:

The OCR package Enables you to:

  • Extract text from images with formats .jpeg, .jpg, .bmp, .gif, .png

  • Extract text from a window of an application

  • Extract text from a specific area of an application

  • Filter extracted text and store it as a variable

Tool used:

Automation Anywhere Learning Edition.

Business use case:

Such a bot may be used for extracting a field value if the user wants to fetch specific information and can display it on the destination file.

Procedure:

Create a project in Automation Anywhere

  • create Loop Action

  • create variables

  • running the bot and testing

  • filter the captured text

  • add an action to log the text to a file

  • create project

  • assign captured text

Data Source:

  1. Here are sample invoices in the Folder

  2. Invoice image

1. User Input:

* Bot Creation

In Automation Anywhere cloud Control Room, create a new boat for extracting text from PDF. We’ll be using OCR*: Capture image by path Method*” action to consume invoice.png. We have used a log to file & We’ll also have the “Message Box” action attached to the output. The final bot structure will be as follows.

2. Actions Used:

Use the Capture image by path action to extract text from an image on a device or a folder in the Control Room. The extracted text can assigned as a variable.

  1. provide the folder path

3.Capture image by path:

which capture text from an image file stored inside a directory

  1. In the Actions palette, double-click or drag the Capture image by path action from the OCR package.

  2. In the Image path field, select an option:

    • Control Room file: Uses a file that is available on the Control Room.

    • Desktop file: Uses a file that is available on a device.

    • Variable: Uses a file variable to specify the file location.

  • Follow these steps to use the Capture image by path action:

    1. Select the Filter the captured text check box to filter the captured text.Specify the text to filter out in the Before and After fields. For example, if the extracted text is Name: ABC Inc. Location:, to retrieve ABC Inc., you must specify Location: in the Before field and Name: in the After field.

    2. Select the Trim the captured text check box to trim the extra spaces.

  1. Provide Dictionary

  1. In the Assign value to variable list, select a string variable.Click Save.

  1. Message box to show you all get extracted

4. Output (visualization):

  1. lets running a Bot

  2. it captures the text from an image file and displayed it inside a message box.

  3. Message from Bot

    5.Execute Bot and Review Output

    With this configuration completed, now ready to execute the bot and see the output message box.

    1. Copy the message and paste it into an invoice.txt file

  1. It displays the invoice total from the image file

  1. So here you see in this file the invoice numbers which fetch from image file

  1. The bot has run successfully!

  • This is helpful for you to capture image paths by using OCR and displaying some specific information from the source to the destination file in automation anywhere.