im_lintra(3) performs a linear transformation on an image

Other Alias

im_lintra_vec

SYNOPSIS

#include <vips/vips.h>

int im_lintra_vec(n, a, in, b, out)
int n;
double *a, *b;
IMAGE *in, *out;

int im_lintra(a, in, b, out)
double a, b;
IMAGE *in, *out;

DESCRIPTION

im_lintra_vec(3) performs a linear transform on image in, that is, it calculates


  out = a * in + b

a and b are vectors, ie. arrays of constants of length n. If in has one band, then the vectors may be any length and the output image will have the same number of bands as the length of the vector. If in has many bands, then the vector must be length 1, or have the same length as the number of bands in the image.

If the input format is one of the integer types then output is float. In all other cases the output is the same as the input.

im_lintra(3) is a convenience function which calls im_lintra_vec(3) with a vector of length 1.

RETURN VALUE

The function returns 0 on success and -1 on error.

BUGS

The function does not check for under/overflow

SEE ALSO

im_exptra(3), im_logtra(3)

AUTHOR

N. Dessipris - 24/04/1991
J. Cupitt (rewrite) - 21/7/93