How do I generate a two dimensional Fourier Transform with a given image in a .mat file?

조회 수: 2 (최근 30일)
I don't even know how to start. Help will be much appreciated.
Thank you

답변 (2개)

Konstantinos Sofos
Konstantinos Sofos 2015년 3월 9일
Hi,
Mathworks documentation is excellent and is always a good point to start. Have a look here Fourier Transform and Image Transforms
Assuming that I is your input image and F is its Fourier Transform (i.e. F = fft2(I))
You can use this code:
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
Regards
  댓글 수: 1
sean darmadi
sean darmadi 2015년 3월 9일
Hi, I am given a mat file called A.mat. So I am assuming I need to first open the file first. So i wrote,
fid=load('A.mat');
After that, I am not sure what to do with the opened file. I am confused on how to use the fft2 function cause every time I tried it says undefined function 'fttn' for input arguments of type 'struct'.
Am I doing something wrong?

댓글을 달려면 로그인하십시오.


Image Analyst
Image Analyst 2015년 3월 9일
Attached are two of my FFT2 demos for you.
  댓글 수: 2
sean darmadi
sean darmadi 2015년 3월 9일
Hi,
I am just given a file in the .mat format. When I try to do ftt2, I am unable to convert the file. When I use the load function, it says that I have a 300x300 double.
Image Analyst
Image Analyst 2015년 3월 9일
You forgot to attach your .mat file and your .m file so I'm unable to do anything to help you (yet).

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by