Configure text recognition settings
Relevant for: GUI tests and components
This topic describes how to configure text recognition settings.
Prerequisites
In your application, capture an image of the text you want to detect or extract.
Analyze the characteristics of the text
Determine whether you can capture the text using a text (or text-like) property instead of using a text recognition mechanism.
Running steps that use OCR takes longer than running steps that use property-based object recognition.
Decide which OCR engine to use
You may need to experiment with your application to find out which OCR settings achieve the best results. Once you determine which OCR engine works best with your tests, we recommend using that engine consistently. Using different engines for different runs may produce different results.
When choosing an OCR engine, consider the following:
Consideration | Google and Baidu (Cloud) | ABBYY and Tesseract (Non cloud) |
---|---|---|
Accuracy |
Choose the OCR engine that proves most accurate for your applications. Cloud vendors provide different customer plans providing various levels of accuracy. |
|
Availability |
Requires a cloud OCR account and an available Internet connection |
No need for account or Internet connection |
Language support |
Google Cloud OCR detects the languages automatically and supports mixed-language text. You do not have to specify which languages to expect in the application. See also Known issues - Multilingual applications. Baidu OCR supports fewer languages than ABBYY but provides greater accuracy and better recognition in hieroglyphic languages, such as Chinese, Japanese, or Korean. Check the list of available languages for Baidu and ABBYY in the Text Recognition pane. Baidu supports various languages separately, or text that contains Chinese and English. See also Known issues - Multilingual applications. |
ABBYY OCR supports many languages, it can be configured to support multiple languages, and can recognize mixed-language text. When using the Tesseract OCR engine, it is possible to use only one language pack at a time. See more details on language packs in Languages, below. |
Performance |
Affected by the quality of the Internet connection and not the computer's configuration. Affected by your cloud platform plan. |
Requires a strong processor. On older computers, may take a long time to provide result for complicated images or multilingual text. The Tesseract OCR engine is slower than the ABBYY OCR engine. If your test has a significant use of text recognition steps (such as GetVisibleText), note that the total time required to run these tests will increase. |
Set the appropriate options
In the Text Recognition pane of the Options dialog box (Tools > Options > GUI Testing tab > Text Recognition node, set the following options:
OCR engine type |
Select one of the following text recognition mechanisms:
UFT One versions 2021 R1 and later: The ABBYY OCR Text Recognition engine is available only if you included it in the UFT One installation. If ABBYY is not installed, Tesseract is used as the default engine instead. |
Configure the connection to the Cloud OCR service |
Using a cloud OCR engine requires setting up an account with the relevant vendor and obtaining an access token or key used to connect to the cloud service.
|
Text Recognition mode |
(ABBYY and Tesseract OCR engines only)
|
Languages |
Available languages and supported languages (ABBYY OCR engine only) From the list of available languages, select one or more languages to support for text recognition. |
Language type (Baidu OCR Engine only) From the list of languages, select a single language to support for text recognition, or select Chinese and English. |
|
Current language pack (Tesseract OCR engine only) The current language pack to use in text recognition. When using the Tesseract engine, it is possible to use only one language pack at a time. You can download additional language packs from the Tesseract OCR engine download site: https://github.com/tesseract-ocr/tessdoc/blob/master/Data-Files.md#data-files-for-version-400-november-29-2016. After downloading, add the files to the <UFT One installation folder>/dat/tessdata4.1 folder. |
|
Preview | (ABBYY, Baidu, and Google OCR engines only)
Click this button to preview the text recognition result produced based on the options set in this task. See Verify the text recognition configuration for more details. |
Symbols for text recognition | (Tesseract OCR engine only) Enter the list of characters you want UFT One to recognize. When UFT One runs the test, it will perform text recognition only on the characters specified and all others are ignored. |
Use configuration from a file |
(Tesseract OCR engine only) Instructs UFT One load text recognition configuration from an externally created file. For details on creating a file, see https://github.com/tesseract-ocr/tesseract/blob/master/doc/tesseract.1.asc. |
Preprocess the image before using text recognition | Instructs UFT One to process the background image before performing text recognition. This enables UFT One to identify the image elements before using text recognition. |
Enable fast mode (Tesseract OCR engine only)
The Tesseract engine provides a fast mode to improve OCR performance. This may reduce text recognition accuracy.
The fast mode option is no longer available in the UI. The fast mode is now controlled by the data file used for OCR.
To enable fast mode:
-
Download the language pack for fast mode from the Tesseract OCR engine site https://github.com/tesseract-ocr/tessdata_fast.
-
Replace the file in the <UFT One installation folder>/dat/tessdata4.1 folder with the new file for fast mode.
Note: Make sure to maintain the original file in case you want to disable the fast mode later.
Verify the text recognition configuration
You can use the Preview button to verify the text recognition options you set in Set the appropriate options and then optimize your settings.
To preview text recognition results using Google or Baidu:
- Click the Preview button in Tools > Options > GUI Testing tab > Text Recognition node.
- In the Preview dialog box, click Browse to select the image file of your application, then click Recognize.
- View the recognition result in the right box.
- Adjust the Text Recognition options if necessary.
To preview text recognition results using ABBYY:
- Click the Preview button in Tools > Options > GUI Testing tab > Text Recognition node.
- In the Preview dialog box, click Browse to select the image file of your application.
-
Select or customize a set of OCR configurations, and then click Recognize.
For details about the OCR configuration sets and recognition parameters, see Preview Pane (Options Dialog Box > GUI Testing Tab > Text Recognition) .
- In the right box, view the recognition result produced based on the configuration set you selected or customized and the OCR options you set in the Text Recognition pane.
-
Adjust your text recognition settings if necessary.
You can adjust the settings globally in the Options Window, or locally for a specific test run in the test itself.
To adjust locally for a test run in the test, click Generate Script to generate the selected or customized set of ABBYY OCR parameter settings (SetABBYYParameters steps) and then click Copy Script to copy to your test.
Tip:
-
If you want ABBYY OCR parameter settings to affect images whose text was already retrieved in the same test run, insert a ClearOCRCache step before the SetABBYYParameters steps you added.
-
After using ABBYY OCR parameter settings for part of the test run, you can return to the global ABBYY OCR settings by using a ResetABBYYParameters step.
-
See also: