affine.asv
来自「语音信号处理。例如:滤波、检测、增强、估计、识别、谱分析」· ASV 代码 · 共 49 行
ASV
49 行
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Affine Parameter Calculation
% ----------------------------
% AUTHOR: Maher Khoury
% DATE: March 1, 1999
% PURPOSE:
% Calculates affine motion parameters
%
% Notes on called subroutines:
% -warp.m warps frame2 back onto frame1 using the calculated parameters
% -grad.m calculates the image spatio-temporal gradients
% -Parametric.m calculates the values of the parameters
%
% Variables:
% -pyrIter = level of the pyramid
% -step = sampling step
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function k = affine(image1,image2); % image1是参考图像,image2是待配准图像
%% Initialize values of k to be zero %%
% k(1:4) = 0;
%%%%% Hierarchical loop %%%%%
for pyrIter=2:-1:0,
step=2.^pyrIter;
%% Double the value of the transitional parameters %%
k = [k(1) k(2) 2.*k(3) 2.*k(4)];
im1 = corrDn(image1, step);
im2 = corrDn(image2, step);
for l=1:3
%%% Motion compensate frame 2 %%%
warped = warp(im2,k);
%%% Get image gradients %%%
[Ix Iy It] = grad(im1,warped);
%%% Find residual k's %%%
resid_k = Parametric(Ix,Iy,It);
%%% Update the k values %%%
k = k + resid_k;
end
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?