signDiff

[ XITE Reference Manual | XITE home ]

Name

signDiff - signed difference between two bands

Syntax

 #include <xite/arithmetic.h>

 int signDiff( IBAND input1, IBAND input2,
    IBAND output, double scale, double offset );

Description

signDiff calculates, pixel by pixel, the signed difference between the two input images:

 output(x,y) =
     (input1(x,y)-input2(x,y))*scale + offset

For complex and double-complex bands, the result is

 output(x,y).re =
     (input1(x,y).re-input2(x,y).re)*scale + offset
 output(x,y).im =
     (input1(x,y).im-input2(x,y).im)*scale + offset

If the result is outside the pixeltype range, the result is truncated. Within the pixeltype range, the result is rounded to the nearest possible pixelvalue.

Restrictions

All bands must be of the same type. Only the largest rectangle common to alle three bands is processed.

Return value

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

See also

signDiff(1), absDiff(3), addw(3), multiply(3), divide(3)

Author

Tor Lønnestad, BLAB, Ifi, UiO

Revised

Svein Bøe, Ifi, UiO. Implemented for all pixel types, not only unsigned byte.

Id

$Id: signDiff.c,v 1.32 1997/05/27 12:36:39 svein Exp $