Forming a 2D window from a 1D Function

I came to this question because of the Kaiser window used for my BM3D implementation. I used Matlab to generate the Kaiser window I want for my C code so I don’t bother to write that function in my project. However, Matlab only has 1D version of the window functions. The following demonstrates two ways to generate the 2D window from its 1D function.


There are basically two ways of forming a 2D window from a 1D function. The
first is the outer product formulation; the second is the rotational
formulation. To create a outer product window (which your kaiser examples
look like they are trying to do), you can use

w1D = hamming(16); % Some 1D window
w2D = w1D(:) * w1D(:).’; % Outer product

To use a rotational formulation (which generally gives more circular
contours), you can use

L = 16;
w1D = hamming(L); % Some 1D window
M = (L-1)/2;
xx = linspace(-M,M,L);
[x,y] = meshgrid(xx);
r = sqrt( x.^2 + y.^2 );
w2D = zeros(L);
w2D(r<=M) = interp1(xx,w1D,r(r<=M));


2 thoughts on “Forming a 2D window from a 1D Function

  1. Pingback: Trying to create a 2d taper in python that has an elliptical shape | MQ

  2. Alonzo

    I read a lot of interesting content here. Probably
    you spend a lot of time writing, i know how to save you a lot of work, there is an online tool that creates readable, google friendly posts in seconds, just
    search in google – laranitas free content source


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s