Horus Doc || Global Function Guide || General documentation   | Function documentation  

HxAnd

Synopsis

HxImageRep HxAnd(HxImageRep im1, HxImageRep im2)

Input

HxImageRep im1
The first input image.

HxImageRep im2
The second input image.

Return value

HxImageRep
The logical `and' of the input images.

Description

The function HxAnd takes the logical `and' of corresponding pixels in the two images. The `and' of two vectors is taken component wise.

Remarks

Valid input images
The input images should have the same dimensionality, the same size, the same pixel dimensionality and the same pixel type. The numerical values of the pixels, or its components, should be HxShort, HxByte, HxInt .

Examples

Taking the logical `and'

#include "HxImageRepGlobalFuncs.h"
#include "HxImageRep.h"

HxImageRep HxAndExample1(HxImageRep im1, HxImageRep im2) {
   im1 = HxImageAsDouble(im1);
   im2 = HxImageAsDouble(im2);
   im1 = HxContrastStretch(im1, 1.0);
   im2 = HxContrastStretch(im2, 1.0);
   im1 = HxImageAsByte(im1);
   im2 = HxImageAsByte(im2);
   im1 = HxAnd(im1, im2);
   im1 = HxContrastStretch(im1, 255);

   return im1;
}

int main(int argc, char* argv[])
{
    HxImageRep im1 = HxMakeFromFile(argv[1]);
    HxImageRep im2 = HxMakeFromFile(argv[2]);
    im1 = HxAndExample1(im1, im2);
    HxWriteFile(im1, argv[3]);

    return 0;
}

exampleImage3.gif

First input image for the HxAnd example.

exampleImage4.gif

Second input image for the HxAnd example.

HxAndResult1.gif

Output image of the HxAnd example.

In this example we take the logical `and' of the two input images. We first convert them to binary format after which the logical `and' is taken.

See also

HxOr, HxXor, HxAndVal,

Keywords

Binary, Logical,


Generated on Mon Jan 27 15:44:58 2003 for GlobalFunctionGuide by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001