und3rd06012
und3rd06012

Reputation: 747

2-Dimensional Fast Fourier Transform 3-D plot in Matlab

We want to plot in Matlab using mesh function the FFT2 of an image (we have applied fftshift, abs, and log).

So how do we do that?

imageB=imread('pic2', 'jpg');

figure, imshow(imageB)

fftB=fft2(double(imageB));

F1=fftshift(fftB);

F2=abs(F1);

F3=log(F2+1);

mesh(F3)

We want a 3-D plot of the FFT.

Upvotes: 2

Views: 3626

Answers (1)

Cape Code
Cape Code

Reputation: 3574

An option using surf:

imageB=rgb2gray(imread('http://upload.wikimedia.org/wikipedia/commons/d/db/Patern_test.jpg'));

Note that the original image is a RGB image, thus the FFT will also be a 3-channel array. Either convert to grayscale or access one channel with F1(:,:,1)

fftB=fft2(double(imageB));
F1=log(abs(fftshift(fftB)));

surf(F1), shading flat;

Result:

enter image description here

Upvotes: 3

Related Questions