版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
相关滤波跟踪算法鼻祖MOSEE的源代码中有一个函数window2()
% This function creates a 2 dimentional window for a sample image, it takes
% the dimension of the window and applies the 1D window function
% This is does NOT using a rotational symmetric method to generate a 2 window
%
% Disi A ---- May,16, 2013
% [N,M]=size(imgage);
% ---------------------------------------------------------------------
% w_type is defined by the following
% @bartlett - Bartlett window.
% @barthannwin - Modified Bartlett-Hanning window.
% @blackman - Blackman window.
% @blackmanharris - Minimum 4-term Blackman-Harris window.
% @bohmanwin - Bohman window.
% @chebwin - Chebyshev window.
% @flattopwin - Flat Top window.
% @gausswin - Gaussian window.
% @hamming - Hamming window.
% @hann - Hann window.
% @kaiser - Kaiser window.
% @nuttallwin - Nuttall defined minimum 4-term Blackman-Harris window.
% @parzenwin - Parzen (de la Valle-Poussin) window.
% @rectwin - Rectangular window.
% @taylorwin - Taylor window.
% @tukeywin - Tukey window.
% @triang - Triangular window.
%
% Example:
% To compute windowed 2D fFT
% [r,c]=size(img);
% w=window2(r,c,@hamming);
% fft2(img.*w);
function w=window2(N,M,w_func)
wc=window(w_func,N);
wr=window(w_func,M);
[maskr,maskc]=meshgrid(wr,wc);
%maskc=repmat(wc,1,M); Old version
%maskr=repmat(wr',N,1);
w=maskr.*maskc;
end
函数作用:This function creates a 2 dimentional window for a sample image, it takes the dimension of the window and applies the 1D window function. This is does NOT using a rotational symmetric method to generate a 2 window
翻译成中文就是:这个函数为采样图像生成一个2维的窗,它获取窗的维度,同时使用了1维窗函数。该函数并不是使用旋转对称的方法生成2维窗。
使用示例:
% Example:
% To compute windowed 2D fFT
% [r,c]=size(img);
% w=window2(r,c,@hamming);
% fft2(img.*w);
具体来看函数的具体实现部分:
function w=window2(N,M,w_func)
wc=window(w_func,N);
wr=window(w_func,M);
[maskr,maskc]=meshgrid(wr,wc);%maskc=repmat(wc,1,M); Old version
%maskr=repmat(wr',N,1);w=maskr.*maskc;
end
分析:
以N和M为分辨率,调用两个1维的窗函数,得到一个二维的窗函数。