manpagez: man pages & more
man im_gaddim(3)
Home | html | info | man
ADDITION(3)                                                        ADDITION(3)




NAME

       im_add, im_gadd, im_gaddim, im_gfadd - add two images


SYNOPSIS

       #include <vips/vips.h>

       int im_add(in1, in2, out)
       IMAGE *in1, *in2, *out;

       int im_gadd(a, in1, b, in2, c, out)
       double a, b, c;
       IMAGE *in1, *in2, *out;

       int im_gaddim(a, in1, b, in2, c, out)
       double a, b, c;
       IMAGE *in1, *in2, *out;

       int im_gfadd(a, in1, b, in2, c, out)
       double a, b, c;
       IMAGE *in1, *in2, *out;



DESCRIPTION

       These functions operate on two images held by image descriptors in1 and
       in2 and write the result to the image descriptor out.  Input images in1
       and  in2  should have the same channels and the same size; however they
       can be of different types.  Only the history of  the  image  descriptor
       pointed by in1 is copied to out.

       im_add(3)

       For two integer images, add the two images and write the output as

        in1    - uchar   char   ushort  short  uint  int
        -------|-----------------------------------------
        in2    |
        uchar  | ushort  short  ushort  short  uint  int
        char   | short   short  short   short  int   int
        ushort | ushort  short  ushort  short  uint  int
        short  | short   short  short   short  int   int
        uint   | uint    int    uint    int    uint  int
        int    | int     int    int     int    int   int

       If  one  or  more of the images is a floating point type, the output is
       FMTFLOAT, unless one or more of the inputs is FMTDOUBLE, in which  case
       the output is also FMTDOUBLE.

       If  one  or more of the images is a complex type, the output is FMTCOM-
       PLEX, unless one or more of the inputs is FMTDPCOMPLEX, in  which  case
       the output is also FMTDPCOMPLEX.

       im_gadd(3)  performs  generalised  addition  of  two  images by calling
       im_gaddim(3) and im_gfadd(3).  These are very old and tired things, and
       should not be used.

       Input  should  be  non  complex.   Output depends on input according to
       function called.  The result at each point is: a * pel1 + b * pel2 + c,
       properly  rounded  if  necessary.   Pel1 and pel2 are the corresponding
       pixels from in1 and in2 respectively.

       im_gaddim() performs generalised addition of in1 and in2, on the condi-
       tion  they are neither float nor double nor complex.  The format of the
       resultant image is given by the table:

        in1    - uchar   char   ushort  short  uint  int
        -------|-----------------------------------------
        in2    |
        uchar  | ushort  short  ushort  short  uint  int
        char   | short   short  short   short  int   int
        ushort | ushort  short  ushort  short  uint  int
        short  | short   short  short   short  int   int
        uint   | uint    int    uint    int    uint  int
        int    | int     int    int     int    int   int

       The result at each point is: a * pel1 + b * pel2 + c, properly rounded.
       Pel1  and  pel2  are  the corresponding pixels from in1 and in2 respec-
       tively.

       im_gfadd(3) adds the non-complex images pointed by in1 and in2.  Result
       is  float except if one (or both) inputs is double.  In the latter case
       the result is double.  The result at each point is: a * pel1 + b * pel2
       +  c.   Pel1  and  pel2  are  the corresponding pixels from in1 and in2
       respectively.



BUGS

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


RETURN VALUE

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


SEE ALSO

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


AUTHOR

       N. Dessipris - 22/04/1991
       J. Cupitt, im_add(), - 21/7/93



                                 24 April 1991                     ADDITION(3)

im_add 7.14.5 - Generated Fri Sep 5 19:28:12 CDT 2008
© manpagez.com 2000-2024
Individual documents may contain additional copyright information.