Read Text and Numbers
Use this tool to read text and numbers in an image. You can use easyTouch and easyTouch+ to interactively select the text to be read. easyTouch will automatically estimate the parameter values for detecting and reading the selected text. You can also use a region of interest (ROI) over the text to be read. In case the ROI contains multiple lines of text, each line of text is read and returned in a tuple.
In contrast to the tool Read Text and Numbers with Deep Learning, this tool requires a trained font as input to read the text. Therefore, only text with the specified font can be read. MERLIC already provides some pre-trained fonts. However, you can also use your own font file. There are also some further restrictions to consider, e.g., at least two characters are required within a text line.
Which of the tools, "Read Text and Numbers" or "Read Text and Numbers with Deep Learning", is best for your application depends on various factors. If you are not sure, which of the two fits best for your application, you can test both and compare the results, the processing time, as well as other factors that are relevant for your application.
In general, this tool is suitable for texts with left-to-right script and for images in which the position of the text to be read is already known. If you also have the required pre-trained font and want to use as less memory and processing time as possible, you could also try out this tool first.
Parameters
Basic Parameters
Image:
This parameter represents the input image.
If a color image is used as input image for this tool, only the first channel, i.e., the red channel, is used for the processing.
Font Name:
This parameter allows you to select a font from the combo box. Alternatively, use the button to load a font from file. This font is used to read the text.
|
Value |
Description |
|---|---|
|
DotPrint.omc |
This font enables you to read dot print. |
|
Industrial.omc |
This font enables you to read regular text. |
|
Universal.omc |
This font enables you to read both regular text and dot print. The recognition rate of "Universal.omc" may be lower than the rate of "DotPrint.omc" and "Industrial.omc". Therefore, we recommend to use this font only if it is unknown whether the text that should be read is regular text or dot print. |
|
UniversalDeepLearning.occ |
This font enables you to read both regular text and dot print. It is based on deep learning and regarded to be more robust than other fonts. By default, this font is used to read the text. |
To use your own font from a file, copy the font file to the ocr directory in your MERLIC installation directory. The new font will be available in the drop-down menu of the parameter "Font Name" as soon as the tool is loaded again, i.e., if it is inserted.
Dot Print:
This parameter defines whether characters are dot print or not. The default setting is 0.
|
Value |
Description |
|---|---|
|
0 |
The character is not printed in dot print. |
|
1 |
The character is printed in dot print. |
Character Width:
This parameter defines the width of the characters. The value refers to an uppercase character. It is defined in pixels and set to 30 px by default.
|
Value |
Description |
|---|---|
|
30 |
This is the default value for the character width. |
|
0 - 120 |
This is the available value range for setting the character width. |
Character Height:
This parameter defines the height of the characters. The value refers to an uppercase character. It is defined in pixels and set to 55 px by default.
|
Value |
Description |
|---|---|
|
55 |
This is the default value for the character height. |
|
0 - 200 |
This is the available value range for setting the character height. |
Additional Parameters
ROI:
The parameter "ROI" defines the region of interest (ROI) for the detection of text and numbers. By default no ROI is defined. If you want to use an ROI for the processing, you either have to connect the parameter to an appropriate ROI result of a previous tool to make sure that an ROI is transmitted to this tool or you have to draw new ROIs into the image using the available ROI buttons. Alternatively, you can use easyTouch and easyTouch+ to detect the text and numbers that should be read. An ROI is then automatically created around the text.
Alignment Data:
This parameter represents the alignment data that are used to align the ROI. By default no alignment data are connected and thus no effect is visible. If you want to use specific alignment data, you have to connect the parameter to an appropriate result of a previous tool such as Determine Alignment with Matching, Determine Alignment with Straight Border, Align Image, or Rotate Image.
Size Tolerance:
This parameter defines how much the size of the characters may differ from "Character Width" or "Character Height". It is defined as a percentage value and set to 120% by default. You may change the "Size Tolerance" to a value from 0 to 300. In case it is set to 300%, the character could have a size from 1/4 to 4 times of the "Character Width" (or "Character Height").
|
Value |
Description |
|---|---|
|
120 |
The size of the characters to be read may differ by 120%. |
|
0 - 300 |
This is the available value range for setting the size tolerance. |
Character Property:
This parameter defines the appearance of characters compared to the background. The default setting is "dark".
|
Value |
Description |
|---|---|
|
dark |
The character is dark on light background. |
|
light |
The character is light on dark background. |
Text Structure:
The parameter "Text Structure" only supports proportional fonts, i.e., fonts with characters of varying widths. It might not work reliably for mono-spaced fonts.
This parameter defines the structure of a text, i.e., how characters are grouped. This parameter is useful if texts always appear in the same structure, e.g., if the image contains a date. In such a structured text characters appear in blocks of a certain length. This value contains the number of characters in each block. For example, if the value for "Text Structure" is defined as '4 2 2' and the parameter "Text Separators" is '-', it means the text consists of three blocks, the first block contains four characters, whereas the second and the third contain two characters each. The three blocks are separated by a '-'.
Example text to be read: 2015-06-15
Expression in the parameter "Text Structure": 4 2 2
Text Separators:
This parameter defines which text separators may appear in a string. Setting this parameter is useful for structured text, e.g., when reading a date. In this case, the "Text Structure" has to be defined first at the corresponding parameter.
Example text to be read:2015-06-15
The "Text" result is returned without separators: 20150615
If other separators than '.' are used, e.g., '/', all separators should be defined in the parameter "Text Separators". However, if no value is set for "Text Separators", it may return the same correct result in this case, because the tool already has the information about the number of character blocks from the parameter "Text Structure" even though the kind of separator is unknown.
Stroke Width:
This parameter defines the stroke width of the characters. It is defined in pixels and set to 12 px by default.
|
Value |
Description |
|---|---|
|
12 |
This is the default value for the stroke width of a character. |
|
1 - 30 |
This is the available value range for setting the stroke width. |
Failed Processing:
This parameter defines which value is returned in the result "Text" and "Confidence" in case one of the strings in the image cannot be read. The parameter is set to "ignore" by default.You may set the parameter at the corresponding connector to the following values.
|
Value |
Description |
|---|---|
|
ignore |
Nothing happens if one of the strings in the image cannot be read. |
|
−1 |
This value is just an example. You may replace it directly in the input field of the connector with any number or string you want to return in case one text cannot be read. |
|
* |
This value is just an example. You may replace it directly in the input field of the connector with any number or string you want to return in case one text cannot be read. |
Encoding:
This parameter defines which encoding is used when reading text or numbers. The "default" value means that "UTF-8" is used as encoding type.
Expand the following table to see the list of supported encoding types.
|
Encoding type |
|---|
|
default (UTF-8) |
|
native (encoding of the system) |
|
Big5 |
|
Big5-HKSCS |
|
CP949 |
|
EUC-JP |
|
EUC-KR |
|
GB18030 |
|
HP-ROMAN8 |
|
IBM 850 |
|
IBM 866 |
|
IBM 874 |
|
ISO 2022-JP |
|
ISO 8859-1 |
|
ISO 8859-2 |
|
ISO 8859-3 |
|
ISO 8859-4 |
|
ISO 8859-5 |
|
ISO 8859-6 |
|
ISO 8859-7 |
|
ISO 8859-8 |
|
ISO 8859-9 |
|
ISO 8859-10 |
|
ISO 8859-13 |
|
ISO 8859-14 |
|
ISO 8859-15 |
|
Iscii-Bng |
|
Iscii-Dev |
|
Iscii-Gjr |
|
Iscii-Knd |
|
Iscii-Mlm |
|
Iscii-Ori |
|
Iscii-Pnj |
|
Iscii-Tlg |
|
Iscii-Tml |
|
KOI8-R |
|
KOI8-U |
|
Macintosh |
|
Shift-JIS |
|
TIS-620 |
|
TSCII |
|
UTF-8 |
|
UTF-16 |
|
UTF-16BE |
|
UTF-16LE |
|
UTF-32 |
|
UTF-32BE |
|
UTF-32LE |
|
Windows-1250 |
|
Windows-1251 |
|
Windows-1252 |
|
Windows-1253 |
|
Windows-1254 |
|
Windows-1255 |
|
Windows-1256 |
|
Windows-1257 |
|
Windows-1258 |
Results
Basic Results
Text:
This result contains the text and the numbers that have been read. They are returned as a string. If more than one text entry or number has been read in multiple ROIs, the results are returned in a tuple.
Confidence:
This result returns a tuple of confidence values that indicate with which confidence a text has been read. A confidence value is returned for each text string in the image. The values are returned in a tuple as real number. If a text was read with a confidence of 100%, the value 1 is returned for this region.
Tool State:
"Tool State" returns information about the state of the tool and thus can be used for error handling. For more information, see Tool State Result
Additional Results
Extracted Character Regions:
This result returns the region for each character that has been read in the image.
Processing Time:
This result returns the duration of the most recent execution of the tool in milliseconds. The result is provided as additional result. Therefore, it is hidden by default but it can be displayed via the button beside the tool results. For more information see the section Processing Time in the tool reference overview.
Application Examples
This tool is used in the following MERLIC Vision App examples:
- read_lot_number_and_ECC200.mvapp
- read_text_in_3d_height_image.mvapp