FFT2 command error
13 views (last 30 days)
Show older comments
I have written a program implementing the fft2 command to get the Fourier transformation of an image along with other changes and i keep recieving an out put error for:
Error in fft2 (line 17)
F=fft2(imdata);
Below is my code for this program. I also wrote the program another way and had the same error fo the same function.
clear all; close all; clc
imdata = imread('BluOrn Star.jpg');
figure(1);imshow(imdata);
originalRGBImage = imdata; % Save original image for later display in figure (7)
title('Original Image');
imdata = rgb2gray(imdata);
figure(2); imshow(imdata); title('Gray Image');
%Get Fourier Transform of an image
F = fft2(imdata);
% Fourier transform of an image
S = abs(F);
figure(3);imshow(S,[]);title('Fourier transform of an image');
%get the centered spectrum
Fsh = fftshift(F);
figure(4);imshow(abs(Fsh),[]);title('Centered fourier transform of Image')
%apply log transform
S2 = log(1+abs(Fsh));
figure(5);imshow(S2,[]);title('log transformed Image')
%reconstruct the Image
F = ifftshift(Fsh);
f = ifft2(F);
figure(6);imshow(f,[]),title('reconstructed Image')
h7 = figure(7);
imshow(originalRGBImage);
Answers (0)
See Also
Categories
Find more on Fourier Analysis and Filtering in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!