acfnp - calculate the normalized autocorrelation function of an image using padding with zeroes and multiplication in Fourier space.
output = acfnp(image, center=True)
- input image (real)
- 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
- normalized 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.
Calculation of the normalized autocorrelation function of an image f is performed by first normalization of the image by subtracting its average and by dividing it by its standard deviation. Next, theh image is padded with zeroes to twice the size in real space, Fourier transform is calculated, its modulus squared in Fourier space calculated as `|hat(f)|^2`, then the inverse Fourier transform, and finally the acfnp is windowed out using the size of original images.
- In real space, this corresponds to:
`n = -(nx)/2, ..., (nx)/2`
with the assumption that `f(k)=0 fo\r k<0 or kgenx`
Note: acfnp is free from "wrap around" artifacts, although coefficients with large lag n have large error (statistical uncertainty).
Pratt, W. K., 1992. Digital image processing. Wiley, New York.
Author / Maintainer
Pawel A. Penczek
- category 1
- category 2
- works for most people, has been tested; test cases/examples available.
None. It is perfect.