A frequently needed task is to process all image objects (images or regions) passed to an operator by one or two input iconic object parameters. This is true for most filter and many segmentation operators. Loop macros provide a framework for this problem, see also section “Loop Macros for Accessing Single Input Objects”.
The following table contains an overview of all loop macros, their areas of application, and the provided image data. Their syntax is defined in figure 6.1.
| Macro | Application | Image Data Provided |
| HAllReg | region shape features, region transformation, binary morphology | region data (Hrlregion) of input image object |
| HAllSegm | gray value features, segmentation | region and image data (Hrlregion and Himage) of input image object |
| HAllFilter | filter, image transformations | region and image data (Hrlregion and Himage) of input image object, image data structure (Himage) for image output object |
| HAllFilter2 | filter, segmentation, arithmetics with two input images | intersection of the regions of both input image objects (Hrlregion), the image data of both objects, and a image data structure (Himage) for the image output object |
Names
HAllReg, HAllSegm, HAllFilter, HAllFilter2
Synopsis
#include "Halcon.h" HAllReg( Hproc_handle proc_handle, Hrlregion **region, INT4_8 obj_index) HAllSegm( Hproc_handle proc_handle, Hrlregion **region, Himage *image, int max_channels, INT4_8 obj_index) HAllFilter( Hproc_handle proc_handle, Hrlregion **region, Himage *image_in, Himage *image_out, int max_channels, INT4_8 obj_index) HAllFilter2( Hproc_handle proc_handle, Hrlregion *region, Himage *image_in1, Himage *image_in2, Himage *image_out, int max_channels, INT4_8 obj_index)
Figure 6.1: Convenience loop macros to access iconic objects. “&” denotes output parameters of the macros. This is only a special notation to make clear that these parameters are changed by the macros. So do not pass pointers to variables but the variables itself to the macro.
All macros described in this section have in common that they implement a loop over all image objects within the first input iconic parameter. HAllFilter2 also includes a parallel loop over all objects within the second input object parameter. It is assumed that the operator does not have any more input iconic parameters. The macros provide users with the region (domain) and the pixel data of each image object so that they can work on the data within the loop. Some also create output image objects.
The macros return the index of the current object obj_index (1 … n) within the input iconic object parameter. Thus, obj_index can be seen as a reference parameter of the macro and therefore is notated19) with '&obj_index'.
The macros return all regions as pointers to the original region data within the HALCON database. So the programmer is only allowed to read them. The only exception is again HAllFilter2 that computes the intersection of the region data of both input images and stores it in a new region.
| 19) Note, that this is a specific
notation only - do not pass pointers to the macros!
|