3.3   Structuring Programs

HALCON operators are typically implemented by at least two routines: one procedure (supply procedure) receives/unpacks all input data and checks its consistency. Afterwards it calls the action procedure, which performs the image processing. In some cases it might be convenient to implement several action procedures dependent on special parameter values or pixel types of image data. Generally, these steps are performed within a loop over all input iconic objects that may include further loops over different parameter values and over all image channels. The results are collected and finally returned to the HALCON interface to the application.

Supply procedures are of type Herror and have only one parameter (a handle of type Hproc_handle for instances of HALCON operators or HALCON threads). Do not forget to return an appropriate value at the end of every supply procedure (standard value: H_MSG_TRUE) and every action procedure (standard value: H_MSG_OK).

Typically, action procedures perform the image processing itself. They should return an error code of type Herror as well. It is convenient to implement an action procedure for each pixel type of image data.