在这里,亚像素图像配准算法是采用的方法是相位相关和重采样,实现的程序参考网址为:http://www.mathworks.com/matlabc ... t/dftregistration.m,所有的程序将在下面贴出来,程序中有几个地方看了很长时间看不明白,所以写了这个帖子,希望研究过亚像素图像配准算法或者看懂程序的前辈能给小弟指教一下,疑惑的问题将在附件中的程序疑惑1,2,3,具体的疑惑为:
疑惑1:
在讨论中,有多个地方出现了(出现的位置在程序疑惑1和2用红色方框标记出来了)
if rloc > md2
row_shift = rloc - m - 1;
else
row_shift = rloc - 1;
end
if cloc > nd2
col_shift = cloc - n - 1;
else
col_shift = cloc - 1;
end
这里的代码的意思,好像是平移的意思,但是具体为什么这样操作思索了很长时间还是不明白????
疑惑2:(出现的位置在程序疑惑3用红色方框标记出来了)
程序中
buf1ft是基准图像,buf2ft待匹配的图像,usfac是图像的采样倍数,程序中讨论了usfac=1时,用FFT计算,而usfac不等于1的计算方法不同于usfac==1的情况,另外usfac>2时是用DFT计算的,所以这里我就疑惑了,为什么讨论usfac不同的值时,计算的方法不一样???
为了方便大家理解,我截出了亚像素图像配准的计算过程图,见附件 亚像素图像匹配算法的计算过程.PNG
程序的全部代码:
function [output Greg] = dftregistration(buf1ft,buf2ft,usfac)
% function [output Greg] = dftregistration(buf1ft,buf2ft,usfac);
% Efficient subpixel image registration by crosscorrelation. This code
% gives the same precision as the FFT upsampled cross correlation in a
% small fraction of the computation time and with reduced memory
% requirements. It obtains an initial estimate of the crosscorrelation peak
% by an FFT and then refines the shift estimation by upsampling the DFT
% only in a small neighborhood of that estimate by means of a
% matrix-multiply DFT. With this procedure all the image points are used to
% compute the upsampled crosscorrelation.
% Manuel Guizar - Dec 13, 2007
% Portions of this code were taken from code written by Ann M. Kowalczyk
% and James R. Fienup.
% J.R. Fienup and A.M. Kowalczyk, "Phase retrieval for a complex-valued
% object by using a low-resolution image," J. Opt. Soc. Am. A 7, 450-458
% (1990).
% Citation for this algorithm:
% Manuel Guizar-Sicairos, Samuel T. Thurman, and James R. Fienup,</