addw

[ XITE Reference Manual | XITE home ]

Name

addw - add two bands pixel by pixel, with weights

Syntax

 addw [-t <title>] [-w1 <w1>] [-w2 <w2>]
      [-offset <offset>] <input1> <input2> <output>

Description

addw calculates, pixel by pixel, for each pair of bands, the weighted sum of input1 and input2.

 output(x,y) = w1*input1(x,y) + w2*input2(x,y) + offset

For complex or double complex bands, the result is

 output(x,y).re = w1*input1(x,y).re + w2*input2(x,y).re
                  + offset
 output(x,y).im = w1*input1(x,y).im + w2*input2(x,y).im
                  + 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.

Options

-t title
title of the new image. Default: "Weighted sum"

-w1 w1
Weight of input1. Default: 0.5.

-w2 w2
Weight of input2. Default:0.5.

-offset offset
Default: 0.0

Restrictions

Corresponding bands of the two input images must be of the same pixel type. Only the largest rectangle common to two input bands are added.

See also

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

Author

Tor Lønnestad, BLAB, ifi, UiO

Revised

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

Examples

 addw mona1.img mona2.img monaBoth.img
 addw -w1 0.3 -w2 0.7 i1.img i2.img sum.img

Id

$Id: addw.c,v 1.36 1997/04/23 20:44:28 svein Exp $