Loading documents preview...
Discrete Cosine Transform By Rohit Tripathi
DFT Problems It is complex because it uses complex
computations. It has poor energy compaction. Note: Energy compaction -This means that the energy in the spatial or image domain , is typically concentrated in a smaller number of coefficients. If compaction is high, we have to transmit only a few coefficients.
DCT It overcomes the problems of DFT. Its coefficients are real because it uses
real computations.This makes DCT hardware simpler as compared to DFT. It has high energy compaction capability because its coefficient values are low that can be encoded at very low bit rates without degrading the image quality significantly. It can be computed using DFT or FFT also.
Types of DCT There are various versions of the
DCT. These are usually known as DCT-I to DCT-IV. The most popular is the DCT-II, also known as even symmetric DCT, or as “the DCT”.
Applications The DCT is the basis of the image-
compression standard issued by the Joint Photographic Experts Group (JPEG). The DCT is also used in the MPEG (Moving Picture Experts Group)standard for video compression and in many streaming video players.
1D DCT For an array of N data items,1D DCT
is defined by:
and the corresponding inverse 1D
DCT transform is
2D DCT For a 2D M by N array image 2D DCT
is defined :
2D DCT cont. The corresponding inverse 2D DCT transform is:
The transformed array X(k,l) obtained through the DCT
equation is also of the same size M x N, same as that of the original image block x(m,n). It should be noted here that the transform-domain indices k and l indicate the spatial frequencies in the directions of m and n respectively. The DCT transform operates on this block in a left-to- right, top-to-bottom manner.
2D DCT cont. Selection of block-size in DCT is an important
consideration. The images should be divided in a manner that the level of redundancies between the adjacent pixels are reduced to an acceptable level. Increasing the block size reduces adjacent pixel redundancies and reduces reconstruction error, but involves more computations. Most popular block sizes used in image compression are 8 x 8 pixels and 16 x 16 pixels.
2D DCT cont. 2D DCT can be computed using 1D DCT with the
row-column decomposition (No need to apply 2D form directly): – apply 1D DCT (Vertically) to Columns – apply 1D DCT (Horizontally) to resultant Vertical DCT above. – or alternatively Horizontal to Vertical.
Ex 1.Consider an 8x8 block from a standard black and white image, whose pixel intensities are shown in Fig. below
We subtract 128 from each pixel intensity and
then compute the DCT for each element using DCT.
The DCT values are shown below
It is worth noting that most of the transformed
coefficients have very small values and only a few coefficients have higher magnitudes. This shows the energy compaction capabilities of DCT.
Q.Why do level offsetting (subtracting by 128) is done on the pixel values before applying DCT on the image?
Ans. In JPEG process, pixel value of a black and white image range from 0 to 255 in steps of 1. Pure black is represented by 0. Pure white is represented by 255. Before computing DCT, the value 128 is subtracted from each entry to produce a data range that is centered around zero, so that the modified range is [-128, 127]. This step reduces reduces average DC value of DCT coefficents. DCT is designed to work on pixel values ranging from -128 to 127.
Ex 2. Consider an example of Figure 1, shows the 2D DCT for an 8 x 8 image matrix of pixels . Note that the lowest DCT coefficient is in upper left-hand corner while the highest DCT coefficient is in lower right-hand corner.
Figure 1
Figure 1 (a)–1(d) shows the progression of image quality, as the lowest 1, 3, 6, and 21 DCT coefficients are included in the reconstructed image. Note that even with 1 DCT coefficient, the image is recognizable, and the image with 21 reconstructed coefficients is virtually indistinguishable from the original image [Figure 1(e)].
Figure 1(a) with only one DCT coefficient
Figure 1(b) with 1st 3 DCT coefficients
Figure 1(c) with 1st 6 DCT coefficients
Figure 1(d) with 1st 21 DCT coefficients
Original Mandrill image
Limitation of DCT Limitation of DCT: Serious blocking artifacts are introduced
at the pixel boundaries Note: Blocking artifacts DCT involves discarding some of the media's
data so that it becomes simplified enough to be stored within the desired disk space or be transmitted within the bandwidth limitations (known as a data rate or bit rate ). If the compressed file could not reproduce enough data on decompression to reproduce the original, the result is a degraded quality media or introduction of artifacts.
Limitation of DCT Blocking artifact is the most
serious and objectionable at low bit rates. Blocking artifacts may be reduced by applying transforms like the Lapped Orthogonal Transform (LOT) or Discrete Wavelet Transforms (DWT)(not in our syllabus).
Questions Q1. Which of the following statements is wrong (A) An N-point DCT has N-periodicity. (B) DCT involves real computations only. (C) Forward and inverse DCT formulas are same. (D) DCT exhibits good energy compaction capability. Ans.(A)
2. DCT is applied on the following 2x2 pixel array:
The DCT coefficients obtained from the above array are
Ans.(C)
Q3.Determine 1D DCT of array x(n)=[ 5 4 3 2] Ans. X(k)=[7 2.23 0 0.16]
Q4. Determine 2D DCT of 4x4 array
Ans.
0
0
0
1
0
0
1
0
0
1
0
0
1
0
0
0
1
0
0
0
0
-1
0
0
0
0
1
0
0
0
0
-1
Q5.Determine 2D DCT of 2x2 array
Ans.
0
1
1
0
1
0
0
-1
Note: Here answer is opposite diagonal matrix with alternate 1s and -1s.