一维连续矩形函数的傅里叶变换
二维连续矩形函数的傅里叶变换
禹晶、肖创柏、廖庆敏《数字图像处理(面向新工科的电工电子信息基础课程系列教材)》P109
2D DFT
禹晶、肖创柏、廖庆敏《数字图像处理(面向新工科的电工电子信息基础课程系列教材)》P112
M = 128;
N = 128;
a = 30;
b = 10;
rect = zeros(M, N);
rect(M/2 - a/2 + 1: M/2 + a/2 + 1, N/2 - b/2 + 1: N/2 + b/2 + 1) = 1;
axis tight
magnitude = abs(fftshift(fft2(rect)));
scaled_magnitude = mat2gray(log(1+magnitude));
%%
magnitude_image = im2uint8(scaled_magnitude);
addpath(genpath('colormaps'))
cmap = nclCM('cmocean_balance',200);
magnitude_cmap = ind2rgb(magnitude_image, cmap);
%%
figure;
montage({rect, magnitude_cmap}, 'BorderSize', [0 1],'BackgroundColor','w')
title('FFT of Discrete Rectangular Function')