5.4.6   HPutDImage

HPutDImage (see figure 5.19) combines HPutImage and HDefObj. It stores the gray value channel (image matrix) image in the HALCON database of iconic objects and returns the corresponding database key in image_key. The parameter copy (false or true) is used as in HPutImage and specifies, whether the pixel data is copied15) or only a pointer to the data is passed to the database. Moreover, the gray value channel is inserted into the image object obj_key as component comp (1 … n). Figure 5.22 shows a typical application of this routine.

Note that HPutDImage automatically checks the result state of the underlying procedure with the macro HCkP (see section “HCkP”). Thus, you must not use HCkP on HPutDImage yourself.

    Hkey      obj_key,k;
    Himage    image;
    Hrlregion *region;
    ...
    /* image:  processed gray value data */
    /* region: region data               */
    HCrObj(proc_handle,par_num,&obj_key);
    HPutDImage(proc_handle,obj_key,IMAGE_INDEX,&image,false,&k);
    HPutDRL(proc_handle,obj_key,region,&k);

Figure 5.22: Creating a new image object using HPutDImage and HPutDRL.

15) This is necessary, if the pixel data was stored in temporary memory or if it will be modified later on.