# Name

ccfn - calculate the normalized circulant cross-correlation function between two images using multiplication in Fourier space.

# Usage

output = ccfn(image, ref, center=True)

## Input

image
input image (real)
ref
second input image (real) (in the alignment problems, it should be the reference image).
center
if set to True (default), the origin of the result is at the center; if set to False, the origin is at (0,0), the option is much faster, but the result is difficult to use

## Output

output
normalized circulant cross-correlation function between image and ref. Real. The origin of the cross-correlation function (term ccf(0,0,0)) is located at (int[n/2], int[n/2], int[n/2]) in 3D, (int[n/2], int[n/2]) in 2D, and at int[n/2] in 1D.

# Method

• Calculation of the circulant cross-correlation function between image f and reference image g is performed by

first normalization of both images by subtracting their respective averages and by dividing them by their respective

• standard deviations. Next, Fourier transforms are calculated, multiplied as `hat(f)_"normalized"hat(g)_"normalized"^**`, and an inverse Fourier

transform is calculated to yield ccfn.

• In real space, this corresponds to:
• `\c\c\f\n(n)=(1/(nx)(sum_(k=0)^(nx-1)(f((k+n+nx)mod\nx)-Ave_f)(g(k)-Ave_g)))/(sigma_f sigma_g`

• `n = -(nx)/2, ..., (nx)/2`

• Note: for image size nx and object size m, the circulant ccfn is valid only within `+//- (nx-m/2)` pixels

from the origin. More distant ccfn values are corrupted by the "wrap around" artifacts.

# Reference

Pratt, W. K., 1992. Digital image processing. Wiley, New York.

Pawel A. Penczek

category 1
FUNDAMENTALS
category 2
FOURIER

fundamentals.py

# Maturity

stable
works for most people, has been tested; test cases/examples available.

# Bugs

None. It is perfect.

ccfn (last edited 2013-07-01 13:13:02 by localhost)