blob: 2962752e3230c966509cafe42528602c7a67dceb [file] [log] [blame]
.TH IM_MULTIPLY 3 "24 April 1991"
.SH NAME
im_cmulnorm, im_multiply \- multiply two images
.SH SYNOPSIS
.B #include <vips/vips.h>
.B int im_cmulnorm(in1, in2, out)
.br
.B IMAGE *in1, *in2, *out;
.B int im_multiply(in1, in2, out)
.br
.B IMAGE *in1, *in2, *out;
.SH 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 sizes; however they can be of
different types. Only the history of the image descriptor pointed by in1 is
copied to out.
.B im_multiply(3)
applied to two integer images multiplies the two images and writes 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 FMTCOMPLEX,
unless one or more of the inputs is FMTDPCOMPLEX, in which case the output is
also FMTDPCOMPLEX.
For complex input pels (x1,y1) and (x2,y2), im_multiply() writes
(x1*x2 - y1*y2, x1*y2 + x2*y1).
.B im_cmulnorm(3)
multiplies two complex images. The complex output is normalised to 1 by
dividing both the real and the imaginary part of each pel with the norm; for
instance if the complex multiplication produces (a,b) then the output written
by this function is (a/norm, b/norm), where norm=a*a+b*b. Result is checked
for norm=0. The function is useful for phase correlation. Both inputs should
be complex.
Result is float complex if both inputs are float complex. In any other case
the result is double complex.
.SH BUGS
None of the functions checks the result for over/underflow.
.SH RETURN VALUE
All functions return 0 on success and -1 on error.
.SH SEE ALSO
im_subtract(3), im_lintra(3), im_add(3).
.SH AUTHOR
N. Dessipris \- 22/04/1991
.br
J. Cupitt (im_multiply) \- 22/04/1991