Reputation: 747
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
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:
Upvotes: 3