Text Recognition

Recognize text on the screen, click or wait for text to appear/disappear

Basic

Text Recognition is pretty much the same as Image Detection.

Rather than searching for an image in Region, we search for a text.

Image is compared by pixels (color, intensity, etc...). Text is compared letters by letters.

Text Parameters
Text Parameters

You have extra parameters when text is selected as the Template.

Segment mode

The in-app tutorial explain this quite thoroughly.

After the OCR engine read the screen. We can specify how the text should be segmented: by Word, Line or Paragraph

For example we have this text on the screen:

The quick browns fox
jump over the lazy dog

And the Template is "fox"

  • Word: With this mode we have 9 words and the template will match against the 4th word.
  • Line: With this mode we have 2 lines and the template will obviously not match against any line.
  • Paragragh: With this mode we have 1 paragraph and the template will obviously not match against the whole paragraph.

In this case we should make our template a full line instead of just the word "fox" because it only has 3 letters. If one letter is misread for example "o" can be read as 0 zero, then the match score is only 2/3 or 67% which is below the default Min Score. More letters == better accuracy.

Blacklist, Whitelist

Disallow or allow some characters. "l" sometimes might be read of 1, "o" might be read as 0. Set this correctly will increase the accuracy of OCR Engine.

For example, if you only expect number then you can set whitelist to 0123456789

Case sensitive

By default, text compare is case insensitive. Check this to enable case sensitive compare.

Code Equivalent

    //Create a Region
    var region = Region(100, 100, 500, 500)

    //The only difference here is rather than calling click we call clickText
    var match = region.clickText("the text", FParam.timeout(3000).sRate(2).mScore(0.8))

    if (match) {
        //Success
    } else {
        //Fail
    }

© 2021 - Macrorify by KoK-CODE