그림:Phalaenopsis fft dct.png
위키백과 ― 우리 모두의 백과사전.
[edit] Summary
I used Image:Phalaenopsis_(aka).jpg to create this image. I wanted to show clearly the different behavior between the DFT and the DCT in the frequency domain.
The pictures are made of three other figures. The first one is just the original image: I used its gray-scale version. The second one is the modulus of the DFT; the third one the modulus of the DCT.
I just wanted to give an idea of how they work, so I introduced some modifications in the code to make the differences clearer. I normalized both transforms using the same scale (the one related to the DCT), so that they could be easily compared. That is why I had to cut out some out-of-range values in the DFT. Moreover I calculated the square of each term in both the transforms: this way the dark pixels look darker and the bright ones look brighter. This way it is easy to see how the energy in the DCT is more concentrated in the lower frequency than the DFT.
Here is the Matlab code I used to create the three images:
% read the image RGB = imread('Phalaenopsis_(aka).jpg'); % convert pixels to the [0 1] range RGB = im2double(RGB); % convert to grayscale I = rgb2gray(RGB); % evaluate DFT (using log scale) F = log(abs(fft2(I))); % evaluate DCT (using log scale) C = log(abs(dct2(I))); % normalize C: immin = min(C(:)); immax = max(C(:)); C = (C - immin)/(immax - immin); % normalize F using the same scale as C F = (F - immin)/(immax - immin); F(find(F>immax)) = 1; F(find(F<immin)) = 0; % evaluate the square of each term % (to make dark darker and bright brighter) F = F.*F; C = C.*C; % save outputs imwrite(I,'flower_original.png'); imwrite(F,'flower_fft.png'); imwrite(C,'flower_dct.png');
Then I put the three output images all together using Gimp.
[edit] Licensing
|
그림 고리
다음 문서들이 이 그림을 사용하고 있습니다: