Read text Version 11 (Python)

Action group: Text recognition


Description

The action performs text recognition on the image and returns it as a result

Action icon

Settings

PropertyDescriptionTypeFilling exampleMandatory field
Parameters
ImagePath to image file. Supported image formats: (jpeg, jpg, bmp, png, tif, tiff)Robin.ImageC:\doc\img.pngYes
Expected languages of text in the image

Expected languages of text in the image

Expected languages of the text in the PDF file

A dropdown list of items:

  • Russian
  • English
  • Vietnamese
  • Arabic
  • Spanish
  • Portuguese
  • Indonesian
  • Persian
  • Turkish
  • Kazakh
  • Belarusian

Default value - Russian

Robin.String
Yes
Additional language

An additional language required for document recognition

A dropdown list of items:

  • No
  • Russian
  • English
  • Vietnamese
  • Arabic
  • Spanish
  • Portuguese
  • Indonesian
  • Persian
  • Turkish
  • Kazakh
  • Belarusian

The default value is No

If the same option is selected in the "Language" and "Additional Language" parameters, there will be no error. The duplicate will be counted as 1 language

Robin.Collection
No
Content formatExpected text content format. Available text formats: (Line, Block, Page)Robin.String
Yes
Trained model

Tesseract trained model file in .taineddata format.

Allows you to load your own model trained on the required fonts.

If the parameter is populated, it will be prioritized over the "Language" and "Additional language" parameters




OptionsConfiguration options for OCR)Robin.String
No
Results
ResultText (string) recognized from imageRobin.String

Special conditions of use

The default mode in the "Parameters" field is --psm 3.

All parameters are listed with a space in the format --parameter value_parameter.

List of all parameters: https://muthu.co/all-tesseract-ocr-options/.

ParameterDefault valueDescription
Main parameters
oem3
  • 0: Use only the outdated tesseract engine
  • 1: Use only the LSTM neural network
  • 2: Use the old tesseract engine and the LSTM neural network at the same time
  • 3: Default value, what is available is used
psm3
  • 0: Orientation and Scenario Detection Only (OSD)

  • 1: Automatic page segmentation using the OSD menu

  • 2: Automatic page segmentation, but no OSD or OCR

  • 3: Fully automatic page segmentation, but no on-screen menus

  • 4: Assume that the text has one column of variable sizes

  • 5: Assume that the text is a single homogeneous block of vertically aligned text

  • 6: The image is treated as one single block of text

  • 7: The image is treated as a single text string

  • 8: The image is treated as a single word

  • 9: The image is treated as one word in a circle

  • 10: The image is treated as a single symbol

  • 11: Sparse text. Search for as much text as possible in random order

  • 12: Sparse text with on-screen menus

  • 13: Unprocessed string. The image is treated as a single text string, bypassing Tesseract-specific hacks

Additional parameters
edges_min_nonhole14Minimum number of box pixels to recognize
textord_space_size_is_variable0If true (1) is set, word delimiter spaces are assumed to be of variable width, even if the characters are of fixed pitch
textord_tabfind_find_tables1Launch table detection
textord_force_make_prop_words0Apply proportional word segmentation to all strings
textord_width_limit8Maximum width of blocks for creating rows
tessedit_pageseg_mode6
  • 0: Orientation and scenario detection only

  • 1: Auto mode + orientation detection

  • 2: Auto mode

  • 3: Column detection

  • 4: Block detection

  • 5: String detection

  • 6: Word detection

  • 7: Symbol detection

textord_max_noise_size7Maximum noise size in pixels
tessedit_dont_blkrej_good_wds0If true (1) is set, the word segmentation quality score is used
tessedit_char_blacklist
Blacklisting characters that cannot be recognized
tessedit_char_whitelist
White list of characters to recognize
List of chars to override tessedit_char_blacklist
List of symbols to override tessedit_char_blacklist

Example of use

Task

Read the text in the image 


Solution

Use the "Read text" action

Implementation

  1. Transfer the "Read text" action to the workspace.
  2. Set the parameters of the "Read text" action
    1. "Image" parameter. Specify the path to the image file, the text of which will be recognized.
    2. Parameter "Expected languages of text in the image". Select the expected languages of the text in the image. The following languages are available for selection: "Russian language", "English language", "Russian and English language", "Spanish language", "Portuguese language". In this case, it is "Russian language".
    3. "Content format" parameter. Select the expected text format. The following are available for selection: "Line", "Block", "Page". In this case - "Line".
    4. "Result". The text obtained during text recognition from the image. Write the result to the "Text" variable.


2. Click on the "Start" button in the top panel. 

Result

The program robot completed successfully. The text is read from the image.


  • Нет меток