


ref = rescale(ref);
subplot(1,2,1), imagesc(xcorr2(ref)), title('reference autocorrelation'), colorbar;
hold on, plot([120],[120],'kx'), hold off;

subplot(1,2,2),imagesc(xcorr2(ref,rot90(ref,2))), title('correlation with 180 deg rotation'),colorbar;
hold on, plot([120],[120],'kx'), hold off;
