Other Alias

im_fastcor## SYNOPSIS

**#include <vips/vips.h>**

**int im_fastcor(in, ref, out)**

**IMAGE *in, *ref, *out;**

**int im_spcor(in, ref, out)**

**IMAGE *in, *ref, *out;**

## DESCRIPTION

These functions calculate spatial correlation between two one-band images held by the image descriptors**in**and

**ref.**The sizes of

**ref**should be smaller than the sizes of

**in.**The correlation is carried out by overlapping

**ref**on the top left corner of

**in**and moving it over

**in.**

The output image is the same size as the input. The edge pixels are calculated
by expanding the input image using
**im_embed(3)**
in mode 1 (replicating edge pixels) just enough so that the output can match
the input.

**im_spcor(3) **
calculates the spatial correlation between
**in**
and
**ref**
using the
correlation coefficient from Niblack "An Introduction to Digital Image
Processing,", Prentice/Hall, pp 138. The resultant coefficients are written
as float numbers in
**out. **
The images must be char, short or ushort.

**im_fastcor(3) **
simply returns the sum of squares of differences between
**in**
and
**ref. **
This is much faster, but less useful. The resultant coefficients are written
as unsigned int numbers in out which has a size of in.

## BUGS

The functions do not check for integer overflow.## RETURN VALUE

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

The National Gallery and Birkbeck College, 1990-1997.