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

HxDiv

Synopsis

HxImageRep HxDiv(HxImageRep im1, HxImageRep im2)

Input

HxImageRep im1
The first input image

HxImageRep im2
The second input image

Return value

HxImageRep
The division of the input images

Description

The function HxDiv divides two images on a pixel-by-pixel basis. Vector pixel types of the same dimension are divided component wise. Pixel types of different dimensions can be divided, as long as the pixel dimensionality of one of the input images is 1. The image with pixeldimensionality 1 is then treated as an image with the same pixeldimensionality as the other image (with equal values per pixel). The pixel values of the second input image may not be zero, or have zero valued components.

Remarks

Admissable image types
The two input images should have the same dimensionality, the same pixeldimensionality (or the pixeldimensionality of one of the pixels should be 1) and the same size.

Restriction on the second input image
The pixel values of the second input image may not be zero, or have zero valued components.

Overflow error
The function HxDiv can result in an overflow error.

Examples

Dividing two images

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

HxImageRep HxDivExample1(HxImageRep im1, HxImageRep im2) {
   im1 = HxImageAsDouble(im1);
   im2 = HxImageAsDouble(im2);
   im2 = HxDivVal(im2, 150.0);
   im2 = HxAddVal(im2, 1.0);
   im1 = HxDiv(im1, im2);
   im1 = HxContrastStretch(im1, 255.0);
   im1 = HxImageAsByte(im1);

   return im1;
}

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

    return 0;
}

exampleImage1.gif

First input image for the HxDiv example.

exampleImage2.gif

Second input image for the HxDiv example.

HxDivResult1.gif

Output image of the HxDiv example.

In this example we divide two (scalar) images. After dividing the images, we stretch the result for visualization purposes.

See also

HxSub, HxMul, HxAdd,

Keywords

Binary, Arithmetic,


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