1ADDITION(3)                Library Functions Manual                ADDITION(3)
2
3
4

NAME

6       im_add, im_gadd, im_gaddim, im_gfadd - add two images
7

SYNOPSIS

9       #include <vips/vips.h>
10
11       int im_add(in1, in2, out)
12       IMAGE *in1, *in2, *out;
13
14       int im_gadd(a, in1, b, in2, c, out)
15       double a, b, c;
16       IMAGE *in1, *in2, *out;
17
18       int im_gaddim(a, in1, b, in2, c, out)
19       double a, b, c;
20       IMAGE *in1, *in2, *out;
21
22       int im_gfadd(a, in1, b, in2, c, out)
23       double a, b, c;
24       IMAGE *in1, *in2, *out;
25
26

DESCRIPTION

28       These functions operate on two images held by image descriptors in1 and
29       in2 and write the result to the image descriptor out.  Input images in1
30       and  in2  should have the same channels and the same size; however they
31       can be of different types.  Only the history of  the  image  descriptor
32       pointed by in1 is copied to out.
33
34       im_add(3)
35
36       For two integer images, add the two images and write the output as
37
38        in1    - uchar   char   ushort  short  uint  int
39        -------|-----------------------------------------
40        in2    |
41        uchar  | ushort  short  ushort  short  uint  int
42        char   | short   short  short   short  int   int
43        ushort | ushort  short  ushort  short  uint  int
44        short  | short   short  short   short  int   int
45        uint   | uint    int    uint    int    uint  int
46        int    | int     int    int     int    int   int
47
48       If  one  or  more of the images is a floating point type, the output is
49       FMTFLOAT, unless one or more of the inputs is FMTDOUBLE, in which  case
50       the output is also FMTDOUBLE.
51
52       If  one  or more of the images is a complex type, the output is FMTCOM‐
53       PLEX, unless one or more of the inputs is FMTDPCOMPLEX, in  which  case
54       the output is also FMTDPCOMPLEX.
55
56       im_gadd(3)  performs  generalised  addition  of  two  images by calling
57       im_gaddim(3) and im_gfadd(3).  These are very old and tired things, and
58       should not be used.
59
60       Input  should  be  non  complex.   Output depends on input according to
61       function called.  The result at each point is: a * pel1 + b * pel2 + c,
62       properly  rounded  if  necessary.   Pel1 and pel2 are the corresponding
63       pixels from in1 and in2 respectively.
64
65       im_gaddim() performs generalised addition of in1 and in2, on the condi‐
66       tion  they are neither float nor double nor complex.  The format of the
67       resultant image is given by the table:
68
69        in1    - uchar   char   ushort  short  uint  int
70        -------|-----------------------------------------
71        in2    |
72        uchar  | ushort  short  ushort  short  uint  int
73        char   | short   short  short   short  int   int
74        ushort | ushort  short  ushort  short  uint  int
75        short  | short   short  short   short  int   int
76        uint   | uint    int    uint    int    uint  int
77        int    | int     int    int     int    int   int
78
79       The result at each point is: a * pel1 + b * pel2 + c, properly rounded.
80       Pel1  and  pel2  are  the corresponding pixels from in1 and in2 respec‐
81       tively.
82
83       im_gfadd(3) adds the non-complex images pointed by in1 and in2.  Result
84       is  float except if one (or both) inputs is double.  In the latter case
85       the result is double.  The result at each point is: a * pel1 + b * pel2
86       +  c.   Pel1  and  pel2  are  the corresponding pixels from in1 and in2
87       respectively.
88
89

BUGS

91       None of the functions checks the result for over/underflow.
92

RETURN VALUE

94       All functions return 0 on success and -1 on error.
95

SEE ALSO

97       im_subtract(3), im_lintra(3), im_multiply(3).
98

AUTHOR

100       N. Dessipris - 22/04/1991
101       J. Cupitt, im_add(), - 21/7/93
102
103
104
105                                 24 April 1991                     ADDITION(3)
Impressum