Skip to content

Control Types and ConstantsπŸ”—

All non-iconic data is represented by so called control data (numbers, strings or handles) in HDevelopEVO. The name is derived from their respective functions within HALCON operators where they control the behavior of image processing, for example, thresholds for a segmentation operator. Control parameters in HDevelopEVO may contain arithmetic or logical operations. A control data item can be of one of the following data types: integer, real, string, boolean, and handle.

Control Data TypesπŸ”—

integerπŸ”—

The data type integer is used under the same syntactical rules as in C. Integer numbers can be input in the standard decimal notation, in hexadecimal by prefixing the number with 0x, and in octal by prefixing the number with 0 (zero).

For example:

4711
-123
0xbeef # (1)!
073421 # (2)!
  1. 48879 in decimal notation
  2. 30481 in decimal notation

Data items of type integer are converted to their machine-internal representations, that is the C type long (4 or 8 bytes).

The minimum and maximum possible values of an integer depend on whether the 64- or 32-bit version of is used. You can use the operator tuple_number to verify that a value fits into the range of the integer data type. For a reference, see Table 1.

Table 1: Minimum and maximum values of integer
64-bit 32-bit
Minimum value βˆ’9223372036854775808 βˆ’2147483648
Maximum value 9223372036854775807 2147483647

realπŸ”—

The data type real is used under the same syntactical rules as in C.

For example:

73.815
0.32214
.56
-17.32e-122
32E19

Data items of type real are converted to their machine-internal representations, that is the C type double (8 bytes).

stringπŸ”—

A string is a sequence of characters that is enclosed in single quotes ('). Special characters, like the line feed, are represented in the C-like notation, as you can see in Table 2, see the reference of the C language for comparison. You can enter arbitrary characters using the format xnn where nn is a two-digit hexadecimal number, or using the format 0nnn where nnn is a three-digit octal number. Less digits may be used if the string is unambiguous. For example, a line feed may be specified as xa unless the string continues with another hexadecimal digit (0-F).

Table 2: Substitutes for special characters
Meaning Abbreviation Notation
line feed NL (LF) n
horizontal tabulator HT t
vertical tabulator VT v
backspace BS b
carriage return CR r
form feed FF f
bell BEL a
backslash \ \\
single quote ' \'
arbitrary character (hexadecimal) \xnn
arbitrary character (octal) \0nnn

For example: The string Sobel's edge-filter has to be specified as 'Sobel\'s edge-filter'. A Windows directory path can be entered as 'C:\\Programs\\MVTec\\Halcon\\images'

booleanπŸ”—

The constants true and false belong to the data type boolean. The value true is internally represented by the number 1 and the value false by 0. This means, that in the expression Val := true the effective value of Val is set to 1. In general, every integer value other than 0 means true. Note that some HALCON operators take logical values for input, for example, set_system. In this case, the HALCON operators expect string constants like 'true' or 'false' rather than the boolean values true or false.

handleπŸ”—

Handles are references to complex data structures, for example, a connection to an image acquisition device or a model for shape-based matching.

Special TypesπŸ”—

In addition to these general types, there are special constants and the type tuple, which are specific to HALCON or HDevelopEVO, respectively.

constantsπŸ”—

For the return value (result state) of an operator, constants exist. The constants can be used together with the operators dev_error_var and dev_set_check. These constants represent the normal return value of an operator, so-called messages. For errors, no constants are available but there are plenty of error numbers internally. For more information, see the Extension Package Programmer’s Manual .

In Table 3, all return messages can be found.

Table 3: Return values for operators
Constant Meaning Value
H_MSG_TRUE No error; for tests: true 2
H_MSG_FALSE For tests: false 3
H_MSG_VOID No result could be computed 4
H_MSG_FAIL Operator did not succeed 5

Additionally, there are constants for the types of control data, see Table 4. These can be compared to the result of a type operation to react to different types of control data, see Type Operations.

Table 4: Type values for control data
Constant Meaning Value
H_TYPE_INT integer value 1
H_TYPE_REAL real value 2
H_TYPE_STRING string value 4
H_TYPE_MIXED mixed value 8
H_TYPE_HANDLE handle value 16
H_TYPE_ANY empty tuple 31

tupleπŸ”—

The control types are only used within the generic HDevelopEVO type tuple. A tuple of length 1 is interpreted as an atomic value. A tuple may consist of several data items with different types. The standard representation of a tuple is a listing of its elements surrounded by brackets. This is illustrated in the flowchart in Figure 1.

%%{ init: { 'flowchart': { 'curve': 'stepBefore' } } }%%
graph LR
    A@{ shape: sm-circ } --> OpenBracket
    OpenBracket(["["]) --> Value1["Value"]
    Value1 --> CloseBracket(["]"])
    Value1 --> Comma([","])
    Comma --> Value2["Value"]
    Value2 --> CloseBracket
    Value2 --> Comma
    OpenBracket --> CloseBracket
    CloseBracket --> Z@{shape: sm-circ}

Figure 1. Syntax of tuple constants
β€œValue” can each have one of the types string, integer, real, boolean, or handle.

[] specifies the empty tuple. A tuple with just one element is to be considered as a special case, because it can either be specified in the tuple notation or as an atomic value: [55] defines the same constant as 55. Examples for tuples are:

4711
0.815
'Text'
[16]
[100.0,100.0,200.0,200.0]
['FileName','Extension']
[4711,0.815,'Hugo']