For 1D signals, the autocorrelation of a rectangular pulse will be a triangular pulse.
For your image, the autocorrelation will be a triangular pulse in both directions.
The image below shows:
- The original image
- The autocorrelation without zero padding
- The autocorrelation with zero padding
- The autocorrelation with zero padding, viewed as a mesh.
For your example image, the zero padding is not required because the support of the non-zero pixels is way less than the image size. For non-zero pixels covering the whole image, you'll need to zero pad when using the FFT.
Your image does not appear to show the gradual change. I suspect you will need to normalize the pixel values manually. It's not clear to me that
'CDataMapping','scaled' does the right thing (it may, I'm just not familiar with it).
what does the output value in each pixel mean for the auto and the cross-correlation?
As calculated, not much. It would mean a little more if the mean was subtracted from the image before calculation. As it is, the most you are seeing is the auto-correlation of the mean pixel value (128?) over a limited range.
If the mean were subtracted, then it would tell you about how each pixel influences the pixels around it: if the autocorrelation values are close to zero, then that means "not much". If the autocorrelation values are high, then it means "greatly".
R Code Below
image <- array(0,c(20,20))
image[8:13,8:13] <- 1
image(image, col= grey(seq(0, 1, length = 256)))
fftimage <- fft(image)
congfft <- Conj(fftimage)
ans1 <- fftimage * congfft
ans2 <- Re(fft(ans1, inverse=TRUE))/20/20
image(ans2, col= grey(seq(0, 1, length = 256)))
title("Without zero padding")
imagePadded <- array(0,c(40,40))
imagePadded[11:30,11:30] <- image
fftimagePadded <- fft(imagePadded)
congfftPadded <- Conj(fftimagePadded)
ans1a <- fftimagePadded * congfftPadded
ans2a <- Re(fft(ans1a, inverse=TRUE))/40/40
image(ans2a/max(ans2a), col= grey(seq(0, 1, length = 256)))
title("WITH zero padding")
title('Mesh plot WITH zero padding')