Functions

The image processing algorithms are encapsulated in functions. More complex algorithms have been implemented as function blocks and can be found at ImageProcessing.

Structure of a function call

Functions are structured as follows:

Functions 1:

hr

Status variable of the type HRESULT. The execution status of every function can be followed with this.

F_VN_

Functions are identified by the prefix "F_VN_".

Parameter <...>

Function parameters essentially fulfill the following purpose:

  • Input parameters (e.g. images or containers) that are to be processed.
  • Parameters for setting the algorithm
  • Parameters as reference for returning the results

Grouping of functions

All functions of the TwinCAT Vision library are sorted thematically into the following groups:

Images

Container

Contours

Measuring

Code reading

Optical character recognition (OCR)

Drawing and text

Machine Learning

Advanced Functions

Miscellaneous

Expert functions

Expert versions exist for many functions. These contain additional parameters and are usually marked by the name suffix "Exp". In the case of functions with expert versions, this is additionally noted under the heading "Expert Parameters".

For example, the expert version of F_VN_MaxImage is called F_VN_MaxImagesExp and contains the additional parameter ipMask.

Runtime behavior

The execution duration of some image processing algorithms depends on their parameterization and also the image content. It is therefore not deterministic. In order to guarantee real-time behavior despite that, watchdogs can be applied to these functions or function groups that abort the functions after a specified time.

WARNING

TwinCAT crash when functions are used incorrectly

If some functions are used incorrectly, this can lead to errors (and to resulting TwinCAT crashes). These are not intercepted within the function, as corresponding checks would considerably lengthen the execution time. Therefore, you must take care to use the functions properly! For example, we recommend carrying out a validation of the input parameters.