Image:Dandelion clock dft dct.png

From Wikipedia, the free encyclopedia

Wikimedia Commons logo This is a file from the Wikimedia Commons. The description on its description page there is shown below.
Commons is attempting to create a freely licensed media file repository. You can help.

[edit] Summary

Description

the picture shows the difference between the DFT and a DCT of an image

Source

I made it by myself

Date

13/05/2006

Author

Alessio Damato

Permission

multilicensed (see below)

Other versions the original image that was processed was Image:Dandelion_clock.jpg


I used Image:Dandelion_clock.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 other figures. The first one on the top is just the original image: I used its gray-scale version. On the second line there is the DFT: its magnitude on the left, its histogram on the right. On the third line there is the DCT, with both magnitude and histogram.

The spectrum of the DFT has the lowest frequencies on the center of the image, while the DCT has the lowest frequencies on the top-left of the picture. It is clear how the DCT concentrates most of the energy into the lowest frequencies.

I created the single images with the following Matlab code:


% read the image
RGB = imread('Dandelion_clock.jpg');
% convert pixels to the [0 1] range
RGB = im2double(RGB);
% convert to grayscale
I = rgb2gray(RGB);

% preprocessing of I to show the spectrum poperly
[X Y] = size(I);
I2 = zeros(X,Y);
for i=1:X
    for j=1:Y
    I2(i,j)=I(i,j)*(-1)^(i+j); 
    end
end

% evaluate magnitude of the DFT
F = abs(fft2(I2));
% use log scale
F = log(1 + F);
F = log(1 + F);
% normalize
F = F/max(F(:));

% evaluate magnitude of the DCT
C = abs(dct2(I));
% use log scale
C = log(1 + C);
C = log(1 + C);
% normalize
C = C/max(C(:));

% show all the results
imshow(F), colorbar, colormap(jet);
figure, imhist(F);
figure, imshow(C), colorbar, colormap(jet);
figure, imhist(C);

First it imports the RGB image and converts it to gray-scale. Then the picture is changed to be Fourier-transformed properly. If (i,j) is the index of any pixel, multiplying all the pixels by (-1)i+j shifts the spectrum so that the DC frequency will be in the center of the image, showing its symmetry. I didn't make anything similar with the DCT because it has no symmetry. Both pictures had a huge dynamic, so I calculated the logarithm of both, twice, in order to be able to show the transforms properly. Once all the pictures were shown on the screen, I just selected File -> Save as on Matlab to save all the pictures. I put them all together using Gimp.

[edit] Licensing

I, the author of this work, hereby publish it under the following licenses:
GNU head Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".

العربية | Asturianu | Български | বাংলা | ইমার ঠার | Brezhoneg | Bosanski | Català | Sinugboanong Binisaya | Česky | Dansk | Deutsch | Ελληνικά | English | Esperanto | Español | Eesti | Euskara | فارسی | Suomi | Français | Galego | עברית | Hrvatski | Magyar | Bahasa Indonesia | Ido | Íslenska | Italiano | 日本語 | ქართული | 한국어 | Kurdî / كوردي | Latina | Lëtzebuergesch | Lietuvių | Bahasa Melayu | Nnapulitano | Nederlands | Norsk (nynorsk) | Norsk (bokmål) | Polski | Português | Română | Русский | Slovenčina | Slovenščina | Shqip | Српски | Svenska | తెలుగు | ไทย | Türkçe | Українська | اردو | Tiếng Việt | Volapük | 中文(简体) | 中文(繁體) | +/-

Some rights reserved
Creative Commons Attribution iconCreative Commons Share Alike icon
This file is licensed under the Creative Commons Attribution ShareAlike license versions 2.5, 2.0, and 1.0

العربية | Česky | Dansk | Deutsch | English | Español | فارسی | Français | Italiano | 日本語 | Nederlands | Polski | Português | Русский | Svenska | Türkçe | 简体中文 | 正體中文 | +/-

You may select the license of your choice.

The following pages on the English Wikipedia link to this file (pages on other projects are not listed):