divide

[ XITE Reference Manual | XITE home ]

Name

divide - divide two bands pixel by pixel

Syntax

 #include <xite/arithmetic.h>

 int divide( IBAND band1, IBAND band2,
    IBAND output, double scale );

Description

divide divides, pixel by pixel, band1 on band2, and multiplies the result by scale. The result is assigned to output.

 output(x,y) = band1(x,y) / band2(x,y) * scale

If divisor is zero, we look at dividend. If dividend is zero, result is set to zero, otherwise result is set to "max", where "max" is the maximum allowed positive value for the particular pixeltype.

All pixeltypes are accepted, as long as all three bands have the same pixeltype. Resulting values outside the domain of the actual pixel type are truncated to the nearest legal value.

Restrictions

Only the largest rectangle common to all three bands is multiplied.

Return value

 0 => ok
 1 => bands have different pixel types
 2 => unknown pixel type

See also

divide(1), multiply(3), scale(3)

Author

Tor Lønnestad, BLAB, Ifi, UiO

Id

$Id: divide.c,v 1.34 1997/05/27 14:47:50 svein Exp $