How to Capture Text from Image using OCR package | Automation Anywhere
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:
Here are sample invoices in the Folder
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.
- provide the folder path
3.Capture image by path:
which capture text from an image file stored inside a directory
In the Actions palette, double-click or drag the Capture image by path action from the OCR package.
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:
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.
Select the Trim the captured text check box to trim the extra spaces.
- Provide Dictionary
- In the Assign value to variable list, select a string variable.Click Save.
- Message box to show you all get extracted
4. Output (visualization):
lets running a Bot
it captures the text from an image file and displayed it inside a message box.
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.
- Copy the message and paste it into an invoice.txt file
- It displays the invoice total from the image file
- So here you see in this file the invoice numbers which fetch from image file
- 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.
Subscribe to my newsletter
Read articles from prerana karande directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
prerana karande
prerana karande
I am a passionate Android Developer. Currently Pursuing BTech from Vishwakarma Institute of Information Technology.