PROJECT 04-01

本项目旨在开发一套2-D FFT程序包,用于后续多个项目的实施。该程序包需具备中心化变换、与实数滤波函数相乘、计算逆变换及谱等功能,并考虑图像填充与简化处理。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

PROJECT 04-01 [Multiple Uses]

Two-Dimensional Fast FourierTransform

The purpose of this project is to develop a 2-D FFTprogram "package" that will be used in several other projects thatfollow. Your implementation must have the capabilities to:

(a) Multiply the input image by (-1)^x+y to center thetransform for filtering.

(b) Multiply the resulting (complex) array by a realfilter function (in the sense that the the real coefficients multiply both thereal and imaginary parts of the transforms). Recall that multiplication of twoimages is done on pairs of corresponding elements.

(c) Compute the inverse Fourier transform.

(d) Multiply the result by (-1)^x+y and take the realpart.

(e) Compute the spectrum.

 

Basically, this project implements the steps in Section4.7.3.  If you are using MATLAB, thenyour Fourier transform program will not be limited to images whose size areinteger powers of 2. If you are implementing the program yourself, then the FFTroutine you are using may be limited to integer powers of 2. In this case, youmay need to zoom or shrink an image to the proper size by using the program youdeveloped in Project 02-04. See the Software section of the book web site tofind a 1-D FFT routine. Then use the method discussed in Sections 4.11.1 and4.11.2 for computing the 2-D FFT.

An approximation:To simplify this and the followingprojects (with the exception of Project 04-05), you may ignore image padding(Section 4.6.6).  Although your resultswill not be strictly correct, significant simplifications will be gained notonly in image sizes, but also in the need for cropping the final result. Theprinciple swill not be affected by this approximation.

           

function g=TD_FFTs(f,H)
[M,N]=size(f);
P=2*M;Q=2*N;
%图像填充
fp=zeros(P,Q);
fp(1:M,1:N)=f(1:M,1:N);
%用(-1)^(x+y)乘以输入图像,来实现中心化变换
[Y,X]=meshgrid(1:Q,1:P);
ones=(-1).^(X+Y);
 
f=ones.*fp;
F=fft2(f);
 
%(-1)^(x+y)*f(x,y)的傅里叶变换等于fftshift(fft2(f,P,Q));
%以上可用F=fftshift(fft2(f,P,Q));  
 
G=H.*F;%频率域相乘
g=real(ifft2(G));%反变换并取结果的实部
g=ones.*g;
g=g(1:M,1:N);%在g(x,y)左上象限提取M*N
end


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值