blob: 71d9f3aab42cf42b206bddd3b56ed4a9f1dc71d7 [file] [log] [blame]
.TH CONVOLUTION 3 "2 May 1991"
.SH NAME
im_conv, im_conv_raw, im_convf, im_convf_raw,
im_convsep, im_convsep_raw, im_convsepf, im_convsepf_raw,
im_convsub \- convolves an image with a generalised mask
.SH SYNOPSIS
#include <vips/vips.h>
int im_conv(in, out, mask)
.br
IMAGE *in, *out;
.br
INTMASK *mask;
int im_conv_raw(in, out, mask)
.br
IMAGE *in, *out;
.br
INTMASK *mask;
int im_convf(in, out, mask)
.br
IMAGE *in, *out;
.br
DOUBLEMASK *mask;
int im_convf_raw(in, out, mask)
.br
IMAGE *in, *out;
.br
DOUBLEMASK *mask;
int im_convsep(in, out, mask)
.br
IMAGE *in, *out;
.br
INTMASK *mask;
int im_convsep_raw(in, out, mask)
.br
IMAGE *in, *out;
.br
INTMASK *mask;
int im_convsepf(in, out, mask)
.br
IMAGE *in, *out;
.br
DOUBLEMASK *mask;
int im_convsepf_raw(in, out, mask)
.br
IMAGE *in, *out;
.br
DOUBLEMASK *mask;
int im_convsub(in, out, mask, xskip, yskip)
.br
IMAGE *in, *out;
.br
INTMASK *mask;
.br
int xskip, yskip;
int im_shrink(in, out, xfactor, yfactor)
.br
IMAGE *in, *out;
.br
double xfactor, yfactor;
.SH DESCRIPTION
These functions
convolve the image
.B in
with the matrix
.B mask
and put the result in the image
.B out.
Input should be non-complex. The size and type of the output image are
the same as the size of the input. To output a larger type (for example,
to output an int image from convolution of a byte image, avoiding clipping),
cast the input image up with
.B im_clip2fmt(3).
The output image is the same size as the input. The edge pixels are calculated
by expanding the input image using
.B im_embed(3)
in mode 1 (replicating edge pixels) just enough so that the output can match
the input.
The output at each point is divided by scale and then the offset is added.
Both offset and scale are held in mask.
The
.B im_conv*(3)
functions have 'raw' versions which do not add the border: instead the
output image is smaller than the input.
.B im_conv(3)
and
.B im_conv_raw(3)
convolve any non-complex input image to make an output image of the same
type. Rounding is appropriate to the image type.
.B im_convf(3)
and
.B im_convf_raw(3)
convolves to float (double if the input is double).
The function expects a double mask.
.B im_convsep(3)
and
.B im_convsep_raw(3)
carry out convolution using an 1xN or Nx1 separable mask.
The function scales the output result by dividing it with scale*scale. The
scale factor should therefore be the sqrt of the scale of the square NxN mask.
Rounding is appropriate to the image type. It works on any non-complex image,
and writes the output in the same format as the input.
The function expects integer mask.
.B im_convsepf(3)
and
.B im_convsepf_raw(3)
convolves to float (double if the input is double).
The function expects a double mask.
.B im_convsub(3)
convolves the byte image pointed by in and writes the result as a byte output.
Using this function the input image is subsampled on
both directions by an integer factor of xskip horizontally and
an integer factor of yskip vertically.
During the covolution, values are rounded before division.
Both input and output are bytes. Output is clipped between 0 and 255.
The function expects an integer mask.
.SH RETURN VALUE
The functions returns 0 on success and -1 on error.
.SH SEE ALSO
im_read_imask(3), im_compass(3), im_fastcor(3), im_log_dmask(3),
im_clip2fmt(3)