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

HxXor

Synopsis

HxImageRep HxXor(HxImageRep im1, HxImageRep im2)

Input

HxImageRep im1
The first input image.

HxImageRep im2
The second input image.

Return value

HxImageRep
The logical `xor' of the input images.

Description

The function HxXor takes the logical `xor' of corresponding pixels in the two images. The `xor' 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 `xor'

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

HxImageRep HxXorExample1(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 = HxXor(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 = HxXorExample1(im1, im2);
    HxWriteFile(im1, argv[3]);

    return 0;
}

exampleImage3.gif

First input image for the HxXor example.

exampleImage4.gif

Second input image for the HxXor example.

HxXorResult1.gif

Output image of the HxXor example.

In this example we take the logical `xor' of the two input images.

See also

HxAnd, HxOr, HxXorVal,

Keywords

Binary, Logical,


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