5.5   Reading and Writing Control Parameters

This section describes routines for reading and writing in-/output control parameters, see figure 5.25, figure 5.29, figure 5.30, and figure 5.35. Interchanging control data with the host language is done via arrays of the data type INT4_8 for LONG_PAR, double for DOUBLE_PAR, Hphandle for HANDLE_PAR, char* for STRING_PAR, or Hcpar for MIXED_PAR array types (see section “Control Parameters”).

Control parameters can be passed through the HALCON interface in two different ways: by reference or by value. The former is more efficient but does not allow to modify the values. It is supported by the routines HGetPElemL, HGetPElemD, HGetPElemS, and HGetPPar for reading, depending on the expected type of the input array. HGetPElem provides a general, type independent read access. In case of writing output control parameters, HPutPPar and HPutPElem are provided. In contrast, the routines HGetElemL, HGetElemD, HGetElemS, HGetCElemH1, HGetCElemH, HGetCElemHN, and HGetCPar return a copy of the input array, whereas HPutElem, HPutElemH, and HPutCPar copy an array to an output control parameter.

Names

    HGetPElemL, HGetPElemD, HGetPElemS, HGetPPar, HGetPElem

Conversion Flags

    CONV_NONE   /* no conversion; do only consider original element types */
    CONV_CAST   /* <INT4_8>=(INT4_8)<double>; <double>=(double)<INT4_8>   */
    CONV_IDNT   /* convert double to INT4_8, if double has no fraction    */
    CONV_RND    /* <INT4_8>=(INT4_8)(<double>+0.5)                        */

Synopsis

    #include "Halcon.h"

    HGetPElemL(     Hproc_handle               proc_handle,
                    int                        par,
                    int                        convert,
                    INT4_8 const*restrict      *elem,
                    INT4_8                     *num)

    HGetPElemD(     Hproc_handle               proc_handle,
                    int                        par,
                    int                        convert,
                    double const*restrict      *elem,
                    INT4_8                     *num)

    HGetPElemS(     Hproc_handle               proc_handle,
                    int                        par,
                    int                        convert,
                    char const* const*restrict *elem,
                    INT4_8                     *num)

    HGetPPar(       Hproc_handle               proc_handle,
                    int                        par,
                    Hcpar* restrict            *val,
                    INT4_8                     *num)

    HGetPElem(      Hproc_handle               proc_handle,
                    int                        par,
                    void const*restrict        *elem,
                    INT4_8                     *num,
                    int                        *type)

Figure 5.25: Routines for reading control input parameters by reference.