Image Processing Toolbox User's Guide |
Design two-dimensional FIR filter using one-dimensional window method
Syntax
Description
fwind1
designs two-dimensional FIR filters using the window method. fwind1
uses a one-dimensional window specification to design a two-dimensional FIR filter based on the desired frequency response Hd
. fwind1
works with one-dimensional windows only; use fwind2
to work with two-dimensional windows.
h = fwind1(Hd,win)
designs a two-dimensional FIR filter h
with frequency response Hd
. (fwind1
returns h
as a computational molecule, which is the appropriate form to use with filter2
.) fwind1
uses the one-dimensional window win
to form an approximately circularly symmetric two-dimensional window using Huang's method. You can specify win
using windows from the Signal Processing Toolbox, such as boxcar
, hamming
, hanning
, bartlett
, blackman
, kaiser
, or chebwin
. If length(win)
is n
, then h
is n
-by-n
.
Hd
is a matrix containing the desired frequency response sampled at equally spaced points between -1.0 and 1.0 (in normalized frequency, where 1.0 corresponds to half the sampling frequency, or radians) along the x and y frequency axes. For accurate results, use frequency points returned by freqspace
to create Hd
. (See the entry for freqspace
for more information.)
h = fwind1(Hd,win1,win2)
uses the two one-dimensional windows win1
and win2
to create a separable two-dimensional window. If length(win1)
is n
and length(win2)
is m
, then h
is m
-by-n
.
h = fwind1(f1,f2,Hd,...)
lets you specify the desired frequency response Hd
at arbitrary frequencies (f1
and f2
) along the x- and y-axes. The frequency vectors f1
and f2
should be in the range -1.0 to 1.0, where 1.0 corresponds to half the sampling frequency, or radians. The length of the windows controls the size of the resulting filter, as above.
Class Support
The input matrix Hd
can be of class double
or of any integer class. All other inputs to fwind1
must be of class double
. All outputs are of class double
.
Example
Use fwind1
to design an approximately circularly symmetric two-dimensional bandpass filter with passband between 0.1 and 0.5 (normalized frequency, where 1.0 corresponds to half the sampling frequency, or radians):
Hd
that contains the desired bandpass response. Use freqspace
to create the frequency range vectors f1
and f2
.
[f1,f2] = freqspace(21,'meshgrid');Hd = ones(21);
r = sqrt(f1.^2 + f2.^2);
Hd((r<0.1)|
(r>0.5))= 0;
colormap(jet(64)) mesh(f1,f2,Hd)
Algorithm
fwind1
takes a one-dimensional window specification and forms an approximately circularly symmetric two-dimensional window using Huang's method,
where w(t) is the one-dimensional window and w(n1,n2) is the resulting two-dimensional window.
Given two windows, fwind1
forms a separable two-dimensional window.
fwind1
calls fwind2
with Hd
and the two-dimensional window. fwind2
computes h
using an inverse Fourier transform and multiplication by the two-dimensional window.
See Also
conv2
, filter2
, fsamp2
, freqspace
, ftrans2
, fwind2
Reference
[1] Lim, Jae S., Two-Dimensional Signal and Image Processing, Englewood Cliffs, NJ, Prentice Hall, 1990.
ftrans2 | fwind2 |
© 1994-2005 The MathWorks, Inc.