Main Content

ftrans2

2-D FIR filter using frequency transformation

Description

h = ftrans2(b,t) produces the two-dimensional FIR filter h that corresponds to the one-dimensional FIR filter b using the transform t. The transform matrix t contains coefficients that define the frequency transformation to use.

h = ftrans2(b) uses the McClellan transform matrix t.

t = [1 2 1; 2 -4 2; 1 2 1]/8;

example

Examples

collapse all

Use ftrans2 to design an approximately circularly symmetric two-dimensional bandpass filter with passband between 0.1 and 0.6 (normalized frequency, where 1.0 corresponds to half the sampling frequency, or π radians). Since ftrans2 transforms a one-dimensional FIR filter to create a two-dimensional filter, first design a one-dimensional FIR bandpass filter using the Signal Processing Toolbox function firpm.

colormap(jet(64))
b = firpm(10,[0 0.05 0.15 0.55 0.65 1],[0 0 1 1 0 0]);
[H,w] = freqz(b,1,128,'whole');
plot(w/pi-1,fftshift(abs(H)))

Figure contains an axes object. The axes object contains an object of type line.

Use ftrans2 with the default McClellan transformation to create the desired approximately circularly symmetric filter.

h = ftrans2(b);
freqz2(h)

Figure contains an axes object. The axes object with xlabel F indexOf x baseline F_x, ylabel F indexOf y baseline F_y contains an object of type surface.

Input Arguments

collapse all

FIR filter, specified as a numeric matrix. b must be a 1-D Type I (even symmetric, odd-length) filter such as can be returned by fir1 (Signal Processing Toolbox), fir2 (Signal Processing Toolbox), or firpm (Signal Processing Toolbox).

Data Types: double

Transform matrix, specified as a numeric matrix. t contains coefficients that define the frequency transformation to use. By default, ftrans2 uses a McClellan transform matrix.

Data Types: double

Output Arguments

collapse all

2-D FIR filter, returned as a numeric matrix. ftrans2 returns h as a correlation kernel, which is the appropriate form to use with filter2. If t is m-by-n and b has length Q, then h is size ((m-1)*(Q-1)/2+1)-by-((n-1)*(Q-1)/2+1).

Algorithms

The transformation below defines the frequency response of the two-dimensional filter returned by ftrans2.

H(ω1,ω2)=B(ω)|cosω=T(ω1,ω2),

where B(ω) is the Fourier transform of the one-dimensional filter b:

B(ω)=n=NNb(n)ejωn

and T(ω1,ω2) is the Fourier transform of the transformation matrix t:

T(ω1,ω2)=n2n1t(n1,n2)ejω1n1ejω2n2.

The returned filter h is the inverse Fourier transform of H(ω1,ω2):

h(n1,n2)=1(2π)2ππππH(ω1,ω2)ejω1n1ejω2n2dω1dω2.

References

[1] Lim, Jae S., Two-Dimensional Signal and Image Processing, Englewood Cliffs, NJ, Prentice Hall, 1990, pp. 218-237.

Version History

Introduced before R2006a