-
Notifications
You must be signed in to change notification settings - Fork 1
/
window2.m
44 lines (39 loc) · 1.44 KB
/
window2.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
% 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