# Name

cnvp - calculate the convolution function between two images using padding with zeroes and multiplication in Fourier space.

# Usage

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

## Input

image
input image (real)
ref
second input image (real).
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
convolution function between image and ref. Real. The origin of the convolution 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 convolution function between image f and reference image g is performed farst by padding with zeroes to twice the size in real space,

next by calculating Fourier transforms of both images, then the product in Fourier space as `hat(f)hat(g)`, then the inverse Fourier transform, and finally the ccf is windowed out using the size of original images.

• In real space, this corresponds to:
• `\cnvp(n)=sum_(k=0)^(nx-1)f(-k+n)g(k)`

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

• with the assumption that `g(k)=0 fo\r k<0 or kgenx`

• Note: cnvp is free from "wrap around" artifacts, although coefficients with large lag n have large error (statistical uncertainty).

# 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.

cnvp (last edited 2013-07-01 13:12:44 by localhost)