image - Python 2D Autocorrelation fft - subtract mean or no? -


i'm trying compute 2d auto , cross correlation of images using python (scipy.sig.fftconvolve). in terms of correlation 1 wants subtract off mean. equation covariance says

e[(x-e[x])(y-e[y])] == e[xy]-e[x]e[y].

this means should theoretically able same results if subtract mean before doing auto correlation or if subtract mean squared after correlation. true case of peak, or dc component, not rest of image. , different, heres example autocorrelation mean^2 subtracted off

enter image description here

and autocorrelation mean subtracted off image before doing correlation

enter image description here

so way right way??

the math show doesn't consider boundaries, real data 1 has consider issue.

first consider case of constant data, , calculating autocorrelation using zero-padding @ boundaries. result triangle in 1d or pyramid in 2d. if super-impose small ripple on data, you'll still see triangle or pyramid.

but if subtract mean, triangle/pyramid go away, , you'll left autocorrelation of ripple. want.

note difference in scale of colorbars 2 figures. you're unlikely see underlying structure of second figure within first figure, pyramidal structure dominates.

so, in short, zero-padded autocorrelations, want subtract mean first step of calculation.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -