Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
21Activity
0 of .
Results for:
No results containing your search query
P. 1
Image Compression Using DCT

Image Compression Using DCT

Ratings:

5.0

(1)
|Views: 881|Likes:
Published by api-3853770

More info:

Published by: api-3853770 on Oct 19, 2008
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

03/18/2014

pdf

text

original

Image Compression Using the Discrete
Cosine Transform
Andrew B. Watson
NASA Ames Research Center
Abstract

The discrete cosine transform (DCT) is a technique for converting a signal into elementary
frequency components. It is widely used in image compression. Here we develop some simple
functions to compute the DCT and to compress images.
These functions illustrate the power ofMathematica in the prototyping of image processing
algorithms.

The rapid growth of digital imaging applications, including desktop publishing, multimedia,
teleconferencing, and high-definition television (HDTV) has increased the need for effective and

standardized image compression techniques. Among the emerging standards are JPEG, for compression of still images [Wallace 1991]; MPEG, for compression of motion video [Puri 1992]; and CCITT H.261 (also known as Px64), for compression of video telephony and teleconferencing.

All three of these standards employ a basic technique known as the discrete cosine transform
(DCT). Developed by Ahmed, Natarajan, and Rao [1974], the DCT is a close relative of the
discrete Fourier transform (DFT). Its application to image compression was pioneered by Chen
and Pratt [1984]. In this article, I will develop some simple functions to compute the DCT and
show how it is used for image compression. We have used these functions in our laboratory to
explore methods of optimizing image compression for the human viewer, using information
about the human visual system [Watson 1993]. The goal of this paper is to illustrate the use of

Mathematica in image processing and to provide the reader with the basic tools for further
exploration of this subject.
The One-Dimensional Discrete Cosine Transform
The discrete cosine transform of a list ofn real numberss(x),x = 0, ...,n-1, is the list of lengthn
given by:
Mathematica Journal, 4(1), 1994, p. 81-88
S u
( )=2 n Cu
( )
s x
( )cos2x+1
(
)u\u03c0
2n
x= 0
n\u22121
\u03b5
u= 0,...,n
where Cu
( )=2\u22121 2
for u= 0
=1
otherwise
Each element of the transformed listS(u) is the inner (dot) product of the input lists(x) and a
basis vector. The constant factors are chosen so that the basis vectors are orthogonal and

normalized. The eight basis vectors forn = 8 are shown in Figure 1. The DCT can be written as the product of a vector (the input list) and then xn orthogonal matrix whose rows are the basis vectors. This matrix, forn = 8, can be computed as follows:

DCTMatrix =
Table[ If[ k==0,
Sqrt[1/8],
Sqrt[2/8] Cos[Pi (2j + 1) k/16] ],
{k, 0, 7}, {j, 0, 7}] // N;
We can check that the matrix is orthogonal:
DCTMatrix . Transpose[DCTMatrix] // Chop // MatrixForm
1.
0
0
0
0
0
0
0
0
1.
0
0
0
0
0
0
0
0
1.
0
0
0
0
0
0
0
0
1.
0
0
0
0
0
0
0
0
1.
0
0
0
0
0
0
0
0
1.
0
0
0
0
0
0
0
0
1.
0
0
0
0
0
0
0
0
1.
Each basis vector corresponds to a sinusoid of a certain frequency:
Mathematica Journal, 4(1), 1994, p. 81-88
Show[GraphicsArray[Partition[
ListPlot[#, PlotRange -> {-.5, .5}, PlotJoined -> True,
DisplayFunction -> Identity]&
/@ DCTMatrix, 2] ]];
2345678
-0.4
-0.2
0.2
0.4
2345678
-0.4
-0.2
0.2
0.4
2345678
-0.4
-0.2
0.2
0.4
2345678
-0.4
-0.2
0.2
0.4
2345678
-0.4
-0.2
0.2
0.4
2345678
-0.4
-0.2
0.2
0.4
2345678
-0.4
-0.2
0.2
0.4
2345678
-0.4
-0.2
0.2
0.4
Figure 1. The eight basis vectors for the discrete cosine transform of length eight.
The lists(x) can be recovered from its transformS(u) by applying the inverse cosine transform
(IDCT):
s x
( )=2 n
C u
( )
u=0
n\u22121
\u03b5
S u
( )cos2x+1
(
)u\u03c0
2n
x= 0,...,n
where Cu
( )=2\u22121 2
for u= 0
=1
otherwise

This equation expressess as a linear combination of the basis vectors. The coefficients are the
elements of the transformS, which may be regarded as reflecting the amount of each frequency
present in the inputs.

We generate a list of random numbers to serve as a test input:
input1 = Table[Random[Real, {-1, 1}], {8}]
{0.203056, 0.980407, 0.35312, -0.106651, 0.0399382, 0.871475,
-0.648355, 0.501067}
The DCT is computed by matrix multiplication:
Mathematica Journal, 4(1), 1994, p. 81-88

Activity (21)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
dragonhunk2368 liked this
Maninder Nirman liked this
sarapurohit liked this
smile0life liked this
Maziar Khosravi liked this

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->