HAllComp performs a loop over all gray value channels (components) of the image object denoted by the database key obj_key. Within the loop, image_in_key is set to the database key of the current image object and the corresponding image data is delivered in image_in. Using HAllComp is equivalent to programming an explicit loop over all channels of an image object using HGetDImage. This also implies that the raw image data, i.e., the image matrix itself, is not copied. Instead, only a pointer to this data is inserted in image_in. So please restrict yourself to reading this data. Any write access to the image matrix will cause unpredictable side effects.
Note that HAllComp does not check, whether the image object contains at least one channel. Note further, that any region processing should be performed outside the loop (otherwise you will process the same region again and again for each channel).
Hkey obj_in; Hkey obj_out; Hkey image_in_key; INT4_8 comp_index; Himage image_in,image_out; ... HAllObj(proc_handle,1,obj_in,j) { HCrObj(proc_handle,1,&obj_out); HAllComp(proc_handle,obj_in,image_in_key,image_in,comp_index) { HCkP(HCrImage(proc_handle,image_in_key,1,BYTE_IMAGE, image_in.width,image_in.height, &im_out_key,&image_out)); HCkP(IPBRot90(image_in.pixel.b,image_in.width,region_in, image_out.pixel.b,width,height)); HDefObj(proc_handle,obj_out,im_out_key,comp_index); } }
Figure 5.17: Application of HAllComp: Rotate all channels of all image objects of the first input iconic parameter.
Figure 5.17 shows an example of how to use HAllComp. Within the HAllObj loop for each input image object, an output image object is created and added to the iconic object list of the first output iconic parameter (HCrObj, see section “HCrObj”). After that, a loop over all gray value channels of the current image object is performed (HAllComp). Within this loop, for every gray value channel a new image matrix is created (HCrImage, see section “HCrImage”) and filled with the rotated input matrix (IPBRot90). Finally, this matrix is installed as a new gray value channel of the output image object (HDefObj, see section “HDefObj”). The corresponding region transformation (rotating the region and defining the rotated region as new domain, i.e., area of definition, of the output image object via HDefObj) is omitted in this example.