如何在MATLAB中绘制2D图像的傅立叶变换的相位和幅度?
我使用angle
和abs
,然后使用imshow
,但我得到一张黑色图片。
在这个绘图中fftshift
有什么用?
答案 0 :(得分:1)
F = fft2(I); where I is the input
F = fftshift(F); % Center FFT
F = abs(F); % Get the magnitude
F = log(F+1); % Use log, for perceptual scaling, and +1 since log(0) is undefined
F = mat2gray(F); % Use mat2gray to scale the image between 0 and 1
imshow(F,[]); % Display the result
试试这个。代码取自:How to plot a 2D FFT in Matlab?
答案 1 :(得分:1)
根据您的评论,您需要删除DC偏移。 类似的东西:
imagesc(abs(fftshift(fft2(I - mean(I(:))))));