# Name

acfpl - calculate the autocorrelation function of an image using padding with zeroes, multiplication in Fourier space, and normalization of the result by the actual number of pixels used for calculating the acf coefficients.

# Usage

output = acfpl(image, center=True)

## Input

- image
- 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
- autocorrelation function of the input image. Real. The origin of the autocorrelation 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

In order to calculate the lag-normalized autocorrelation function of an image

*f*, first the image is padded with zeroes to twice the size. Next, Fourier transform is calculated, then modulus squared in Fourier space as``|hat(f)|^2``, then the inverse Fourier transform, the*acfpl*is windowed out using the size of original images, and the resulting autocorrelation function is normalized by the lag, i.e., the actual number of pixels in image that entered the calculation.- In real space, this corresponds to:
``a\cfpl(n)=(nx)/(nx-|n|)sum_(k=0)^(nx-1)f(k+n)f(k)````n = -(nx)/2, ..., (nx)/2``with the assumption that

``f(k)=0 fo\r k<0 or kgenx``Note:

*acfpl*is free from "wrap around" artifacts.

# Reference

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

# Author / Maintainer

Pawel A. Penczek

# Keywords

- category 1
- FUNDAMENTALS
- category 2
- FOURIER

# Files

fundamentals.py

# Maturity

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

# Bugs

None. It is perfect.