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)