Table of Contents

## Name

im_fastcor, im_spcor - correlate two images

## 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 size of out is the same as in; however there out has a black (zero) border dictated by the sizes of ref according to the rules adopted by im_conv(3) .

im_spcor() 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() calculates the spatial correlation between in and ref. The correlation is calculated by overlapping the ref on the top left corner of in and moving it all over in, pixel by pixel. The correlation is calculated by taking absolute differences pixel by pixel without calculating the correlation coefficient. 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.

## See Also

im_conv(3) , im_lrmosaic(3) .

## Copyright

The National Gallery and Birkbeck College, 1990-1997.

Table of Contents

- Name
- Synopsis
- Description
- Bugs
- Return Value
- See Also
- Copyright