This is just a 1D example that shows the idea (I can't seem to get
scilab to cooperate with real images; at least not yet).
The top plot in blue shows the "image". The "patch" is indicated by the red dots. I've selected the location of the "patch" randomly throughout the "image".
The bottom plot shows the cross-correlation between the patch and the image (in green), and the red dot indicates the actual location (start position) of the patch.
The code below does no prewhitening because the "image" is generated using white noise. Apart from the mean-correction, that is.
NIM = 100;
IM = rand(1,NIM,"uniform");
IM = (IM - min(IM))/(max(IM) - min(IM))*255;
NPT = 24;
idx = ceil(rand(1,1,"uniform")*75);
PT = IM(idx + [0:NPT-1]);
title('Original and patch')
NFFT = NIM + NPT - 1;
IMFFT = fft([IM-mean(IM),zeros(1,NPT-1)]);
PTFFT = fft([PT-mean(PT),zeros(1,NIM-1)]);
CORR = ifft(IMFFT.*conj(PTFFT));
title('Cross correlation and actual patch position')