相位相关法求图像平移量

lailaigu 2011-04-26 03:27:03
大家好,我用相位相关法求图像之间的平移量,
%%%
function [row,col] = PCdemo(I,I2);
%I,I2 are reference and target images
%[row, col] are row, column shifts
%

%Fourier transform both images
fi = fft2(double(I));
fr = fft2(double(I2));

%Perform phase correlation (amplitude is normalized)
fc = fi.*conj(fr);
fcn = fc./abs(fc);

%Inverse fourier of peak correlation matrix and max location
peak_correlation_matrix = abs(ifft2(fcn));
[peak, idx] = max(peak_correlation_matrix(:));

%Calculate actual translation
[row,col] = ind2sub(size(peak_correlation_matrix),idx);

if row < size(peak_correlation_matrix,1)/2
row = -(row -1);
else
row = size(peak_correlation_matrix,1) - (row -1);
end;
if col < size(peak_correlation_matrix,2)/2;
col = -(col-1);
else
col = size(peak_correlation_matrix,2) - (col -1);

end
end

这一段程序中的蓝色部分是什么意思,我没有看懂。
...全文
504 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
niubenbenxuexi 2013-03-02
  • 打赏
  • 举报
回复
用来计算图像的偏移量。

19,468

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 图形处理/算法
社区管理员
  • 图形处理/算法社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧