Application of FFT in digital image processing (using fft2 function)

Source: Internet
Author: User
Application of FFT in Digital Image Processing




Generally, one-dimensional transformations can be implemented by FFT in communication and other fields. However, in image processing, two-dimensional transformations are required. fft2is required in this case.



When using the fft2 () function in Ave ave (or Matlab), we can observe that the image in the frequency field still has some additional techniques. the image below is what we want and what we humans can understand (the center of the image indicates the low-frequency area. The more we stay away from the center, the higher the frequency. In the image below, the center area is very bright, the value is very high, and the center is getting darker and darker, indicating that the low-frequency signal is strong and the high-frequency signal is gradually weakened)





> Result = fft2 (dark_channel );
> Imshow (uint8 (real (result )));
The output result of fft2 is as follows (normal people cannot see anything ~)


How can we get the previous results?



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% code writer :EOF% code date    :2014.09.27% code file    :fft2_demo.m% e-mail      :[email protected]%%If there is something wrong with my code, please% touch me by e-mail. Thank you :)%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%clear allclcOriginal_img = imread('/home/jasonleaster/Picture/hand.png');float_Orignal_img = double(Original_img);F64_WHITE = 255.0;F64_BLACK = 0.000;Original_img_row = size(Original_img,1);Original_img_col = size(Original_img,2);Original_img_channel = size(Original_img,3);for row = 1:Original_img_rowfor col = 1:Original_img_colmin_piexl = F64_WHITE;for channel = 1: Original_img_channel if(min_piexl > Original_img(row,col,channel))min_piexl = Original_img(row,col,channel);endenddark_channel(row,col) = min_piexl;endendresult = fft2(dark_channel);%spectrum = fftshift(abs(result));spectrum = result;figure(1);spectrum = spectrum*255/max(spectrum(:));imshow(spectrum);


Here, you must remember fftshift. Otherwise, the following results will appear, and the low-frequency results will be scattered in four corners.




The correct result is as follows:





Application of FFT in digital image processing (using fft2 function)

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.