【问题标题】:Plotting phase and magnitude image Fourier绘制相位和幅度图像傅立叶
【发布时间】:2014-03-06 20:20:29
【问题描述】:

如何在 MATLAB 中绘制二维图像傅里叶变换的相位和幅度? 我正在使用angleabs,然后使用imshow,但我得到一个黑色图像。
fftshift 在这个绘图中有什么用?

【问题讨论】:

  • 试试 imagesc(abs(fftshift(fft2(I))));
  • 我试过了,但它只显示黑色图像,中间有一个白点。

标签: image matlab plot fft phase


【解决方案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?

【讨论】:

  • 我见过这个神,但我不明白为什么我们使用 log 和 fftshift 为什么我们不使用它而不只是显示?
  • 谢谢你救了我!我花了好几个小时来搜索那个日志(F+1):D 如果你通过 f = imread(imPath);你需要这个 F = fft2(double(f));由于图像已以 unit8 格式读取,因此在执行 FFT 之前应将它们转换为双数组。引用自matlabgeeks.com/tips-tutorials/…
【解决方案2】:

根据您的评论,您需要删除 DC 偏移量。 比如:

imagesc(abs(fftshift(fft2(I - mean(I(:))))));

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-01-20
    • 1970-01-01
    • 2011-09-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多