Two-dimensional Fourier transform and two-dimensional Fourier inverse transformation

Source: Internet
Author: User
Tags abs
Two-dimensional Fourier transform and two-dimensional Fourier inverse transformationReprinted articles reproduced from: http://blog.sina.com.cn/s/blog_6c41e2f301016tpp.html

Transformation of images
1. Realization of Matlab with discrete Fourier transform
Matlab function FFT, fft2 and fftn can realize one-dimensional, two-dimension and N-dimensional DFT algorithm respectively; the invocation format of these functions is as follows:
A=fft (X,n,dim)
Where X represents the input image;

N represents the sampling interval, and if x is less than the value, then Matlab will fill the x 0,

Otherwise it will be intercepted, so that the length is N;

DIM indicates that you want to make a discrete Fourier transform.

A=FFT2 (X,mrows,ncols)
where Mrows and NCOLS specify an x size of 0 padding for x.

A=FFTN (X,size)
Where SIZE is a vector, each element will specify the length of the X corresponding dimension after 0 padding.

2. Matlab implementation of discrete Fourier inverse transform
Matlab functions Ifft, ifft2, and ifftn are used to calculate the inverse DFT. The call formats of the functions Ifft, ifft2, and ifftn are identical to the corresponding discrete Fourier transform functions.

Example: two-dimensional Fourier spectrum of images

% read in original image
Img=imread (' rabbit_0.bmp ');
I=rgb2gray (IMG); Imshow (I)
% seeking discrete Fourier spectrum
J=fftshift (fft2 (I));

K=log (ABS (J));
Figure
Subplot (1,2,1); Imshow (img,[]);
Subplot (1,2,2); Imshow (k,[]);

Six. For example

I=imread (' e:\w01.tif ');

Figure (1);

Imshow (i);

Colorbar;

J=FFT2 (i);

K=fftshift (j);

Figure (2);

L=log (ABS (k));

Imshow (l,[]);

Colorbar

N=IFFT2 (j)/255;

Figure (3);

Imshow (n);

Colorbar;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.