在網上很粗略地搜了一下,沒發現比較好的例子。先自己用matlab做了一些供參考。
matlab對應的代碼:
% clc; clear; c1 = imread('../images/symmetric1.jpg'); c2 = imread('../images/symmetric2.png'); c3 = imread('../images/exp_fft2.jpeg'); F1 = fft2(c1); F2 = fft2(c2); F3 = fft2(c3); fft2_visualization(F1); fft2_visualization(F2); fft2_visualization(F3);
可視化代碼
function fft2_visualization(F) % 可視化代碼,用的是stackoverflow上的回答 % http://stackoverflow.com/questions/13549186/how-to-plot-a-2d-fft-in-matlab figure; 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 end
圖與可視化如下
圖像一:斜方向的周期性比較多
結果如下,可以看到對角方向比較強
圖像二:水平豎直方向的周期性較多,斜方向的周期性減弱
結果如下
圖像三:經典圖像
傅里葉變換后的可視化如下,可以看到就不那么有規律可言了。