8.2   Control Types and Constants

All non-iconic data is represented by so called control data (numbers, strings or handles) in HDevelop. The name is derived from their respective functions within HALCON operators where they control the behavior (the effect) of image processing (e.g., thresholds for a segmentation operator). Control parameters in HDevelop 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.

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 (48879 in decimal notation)
  073421 (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).

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 8.1 (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).

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

Table 8.1: Surrogates for special characters.

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. Please note that some HALCON operators take logical values for input (e.g., 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, e.g., a connection to an image acquisition device or a model for shape-based matching.

In addition to these general types, there are special constants and the type tuple, which are specific to HALCON or HDevelop, respectively. Since HALCON 12.0, HDevelop also supports the variable type vector (see section “Vectors”).

constants
There are constants for the return value (result state) of an operator. The constants can be used together with the operator 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 (there are plenty of error numbers internally, see the Extension Package Programmer's Manual).

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

Table 8.2: Return values for operators.

In table 8.2 all return messages can be found. Additionally, there are constants for the types of control data (see table 8.3). These can be compared to the result of a type operation to react to different types of control data (see section “Type Operations” on page 825).

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

Table 8.3: Type values for control data.

tuple
The control types are only used within the generic HDevelop 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 included into brackets. This is illustrated in figure 8.1.

Figure 8.1: The syntax of tuple constants.

[] 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']