Name
acfn - calculate the normalized circulant autocorrelation function of an image using multiplication in Fourier space.
Usage
output = acfn(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
- normalized circulant autocorrelation function of an 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
Calculation of the circulant autocorrelation function of an image f is performed by first normalization of the input image by subtracting its average and by dividing it by its standard deviation. Next, Fourier transform is calculated, squared as `|hat(f)_"normalized"|^2`, and an inverse Fourier transform is calculated to yield acfn.
- In real space, this corresponds to:
`\a\c\f\n(n)=(1/(nx)(sum_(k=0)^(nx-1)(f((k+n+nx)mod\nx)-Ave_f)(f(k)-Ave_g)))/(sigma_f^2`
`n = -(nx)/2, ..., (nx)/2`
Note: for image size nx and object size m, the circulant acfn is valid only within `+//- (nx-m/2)` pixels from the origin. More distant acfn values are corrupted by the "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.