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.
Conditions d’utilisation
Moi, en tant que détenteur des droits d’auteur sur cette œuvre, je la publie sous les licences suivantes :
Vous avez la permission de copier, distribuer et modifier ce document selon les termes de la GNU Free Documentation License version 1.2 ou toute version ultérieure publiée par la Free Software Foundation, sans sections inaltérables, sans texte de première page de couverture et sans texte de dernière page de couverture. Un exemplaire de la licence est inclus dans la section intitulée GNU Free Documentation License.http://www.gnu.org/copyleft/fdl.htmlGFDLGNU Free Documentation Licensetruetrue
de partager – de copier, distribuer et transmettre cette œuvre
d’adapter – de modifier cette œuvre
Sous les conditions suivantes :
paternité – Vous devez donner les informations appropriées concernant l'auteur, fournir un lien vers la licence et indiquer si des modifications ont été faites. Vous pouvez faire cela par tout moyen raisonnable, mais en aucune façon suggérant que l’auteur vous soutient ou approuve l’utilisation que vous en faites.
partage à l’identique – Si vous modifiez, transformez, ou vous basez sur cette œuvre, vous devez distribuer votre contribution sous la même licence ou une licence compatible avec celle de l’original.
Ce bandeau de licence a été ajouté à ce fichier dans le cadre de la procédure de mise à jour des licences des images sous GFDL.http://creativecommons.org/licenses/by-sa/3.0/CC BY-SA 3.0Creative Commons Attribution-Share Alike 3.0truetrue
de partager – de copier, distribuer et transmettre cette œuvre
d’adapter – de modifier cette œuvre
Sous les conditions suivantes :
paternité – Vous devez donner les informations appropriées concernant l'auteur, fournir un lien vers la licence et indiquer si des modifications ont été faites. Vous pouvez faire cela par tout moyen raisonnable, mais en aucune façon suggérant que l’auteur vous soutient ou approuve l’utilisation que vous en faites.
partage à l’identique – Si vous modifiez, transformez, ou vous basez sur cette œuvre, vous devez distribuer votre contribution sous la même licence ou une licence compatible avec celle de l’original.
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 is made of three other figures. The first one is just the original image: I