cancel
Showing results for 
Search instead for 
Did you mean: 

Read Text with OCR in Surface Automation - Try these helpful options

andymenon
Staff
Staff

Hello Community,

I've been using the core Blue Prism product for little more than a year now. One of the product features that I found very interesting is Surface Automation. And this post is a direct consequence of me venturing into this area.

Background:

The Surface Automation course is a solid 36 hours long. It took me several weeks to learn and work through several of the exercises. I'm surprised how well Surface Automation works and how it could be used to solve some if not all business problems. 

Unfortunately, when it came to using the Desktop App that comes as part of this course, it was unusable because it required me to activate .NET3.5 and we did not have permissions on our work laptops to do so. Obviously, I could have approached our IT Helpdesk to make this happen, but then scaling it up to a large group of BP developers meant jumping through additional hoops.

The solution? I decided to use what I learned to Surface Automate the famous Centrix Data Solutions desktop application instead. And that is when I found myself stumbling over several times to get the Read Text with OCR action to work reliably!

Cutting to the chase:

After exhausting all the other avenues, I decided to look closer at the Tesseract Engine options that we can set as part of the Read Text with OCR Read action, particularly in this specific order:

  1. Scale
  2. Page Segmentation Mode
  3. Character Whitelist

20905.png

Environmental Conditions & Disclaimer:

The experience published below is based on the following circumstances:

  • Software being automated reads the default English language
  • The text being read is predominantly read only & most importantly Gray scale
  • Major issue #1 - the OCR would not read single digit Order Quantity values between 1 and 9
  • Major issue #2 - the most error prone and least reliable numeric data to read was the number 7 that would be consistently read as "1"!

And therefore, what I've shared here is limited to my experience of getting past the challenges I faced in this environment, and you will need to play with these options before you can exact reliable performance from Read Text with OCR!

Try these helpful options:

A few screen shots published below show the end result. And I'm hoping that these options will help others as a starting point.

  1. Start using Read Text with OCR without any options - this will help identify what is consistently broken
  2. The first option you may want to play with is the Scale
  3. The BP documentation states that the OCR operates with a default option of 4. 
    • But this might not always help your case especially if:
      • Your text is Gray scale 
      • And you might see high instances of 7s badly read as 1s
    • Therefore, reduce the scale value to 2 to see if the reads produce better results
  4. The next option to consider is Page Segmentation
    • Start by setting this option to Line or Character and test your reads
    • My tests showed that Character works better on numeric whole number data on Gray scale
    • Line on the other hand, worked better on alpha-numeric-symbol data on Gray scale such as C-12345
    • Both these options helped me eliminate the "7" as "1" bad read
    • You may want to try the "Word" option but this can have unwarranted consequences if applied to the wrong case- Example: "6" could be read as "6000"!
  5. One or both of the above options used solo or in combination helped overcome major issue #2 where 7 would be read as 1
  6. Next in line is the Character Whitelist
    • This option primarily helped me eliminate major issue #1 where the OCR would not read single digit integer values 1 through 9!

Summarization: 

#

Scale

Page Segmentation Mode

Character Whitelist

Notes

1

2

Line

Worked for alpha-numeric-symbol data on Gray scale. Example: EFD-702, EDA-437,CFF-908

2

4

  • Worked on Decimal numbers on Gray scale. Example: 34.57, 59.89
  • Also worked on composite Decimal data on Black text. Example: £276.56, £598.90 , £307.72

3

2

Character

0123456789

Worked on whole numbers on Gray scale. Example: 7, 8,10,1

4

2

Line

0123456789

Worked on long string numeric data. Example: 43723457, 90895989

IMPORTANT NOTES: 

  • Some OCR Read issues can be solved by setting just one option
  • Others may need 2 or more options in combination for the read to work reliably 
  • All these options helped me eliminate the "7" as "1" bad OCR read in cases the number 7 appeared in different data and formats (Screen shot #1
  • Finally, the setting for each Read stage is different depending on the size, color, and format of the text being read!

Test Results:

Observation: All data where 7 appears in various formats have been read reliably

20907.png

Observation: Single-digit whole number data has been read as expected

20908.png

Related Documentation: 

  • Additional information on OCR Read configuration options can be found in the Blue Prism Course titled : Working with different application types and Spy Modes
  • Blue Prism Surface Automation course has plenty of details on techniques that can be used when reading data in Surface Automation projects

Cheers!

-Andy Menon



------------------------------
Prashanth (Andy) Menon
------------------------------

2 REPLIES 2

ydar360
Level 3

Andy, thank you for taking the time to put this together. I went through the surface automation course myself, and it took a lot longer than 36 hours! But it has been very useful in automating some troublesome applications for sure.

I was having some trouble with the read text with OCR just today. My automation was having trouble reading/interpreting the image below:20887.png

For whatever reason, it was reading it as 4224788062.

Previously the read stage worked 90% of the time. But, unfortunately, from time to time it reads wrong and adds a random number.

I solved the problem using your recommendations. For me, using scale number 3 was what did the trick.

Again, thanks for your extensive review of the subject!



------------------------------
Awoyinka Daramola
------------------------------

Hello @Awoyinka Daramola

First off, thank you for reaching out. Truly appreciate it. 

I'm glad that you were able to solve the problem based on the information published in my open discussion post.

You are correct, the course is 36 hours but it takes a lot longer to step through. As for my OCR article, it was a direct consequence of an 8-week struggle (similar to yours) to read a single digit number. 

Congrats on resolving the issue!

-Andy

 



------------------------------
Prashanth (Andy) Menon
------------------------------