如何在Matlab中绘制2D FFT? [英] How to plot a 2D FFT in Matlab?

查看:601
本文介绍了如何在Matlab中绘制2D FFT?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用fft2来计算MATLAB中灰度图像的傅里叶变换。

I am using fft2 to compute the Fourier Transform of a grayscale image in MATLAB.

绘制结果大小的常用方法是什么?

What is the common way to plot the magnitude of the result?

推荐答案

假设是您的输入图像并且 F 是它的傅立叶变换(即 F = fft2(I)

Assuming that I is your input image and F is its Fourier Transform (i.e. F = fft2(I))

你可以使用此代码:

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

这篇关于如何在Matlab中绘制2D FFT?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆