Sei sulla pagina 1di 8

Image and Video Compression

Abstract
Image compression and video compression are a very useful tool to help eliminate the
amount of resources image files and video files consume. This is because of space required
to hold unadulterated images can be prohibitively large in terms of cost .There are several
methods of image/video compression are available. One compression method is called
discrete cosine transform (DCT). DCT expresses a sequence of finitely many data
points in terms of a sum of cosine functions oscillating at different frequencies. In image
processing it is an algorithm that facilitates intra-frame coding, by concentrating the signal
energy in only a few coefficients. Discrete cosine transform is common for spatial
redundancies. This objective to this project was to demonstrate a compression algorithm,
discuss its process and display its results.

2.1 Background and Motivation


Image compression and video compression are playing an important role in
modern multimedia applications. All several methods for compression are falling into
two general categories : lossless and lossy image compression. The JPEG processis a
widely used form of lossy image compression that centers around the DCT which works
by separating images into parts of different frequencies. During a step called
quantization, where part of compression actually occurs, the less important frequencies
are discarded, hence the use of term lossy .Then only the most important frequencies
that remain are used retrieve the image in the decompression process .As a result
,reconstructed image contain some distortion but this is adjustable during the
compression stage .
The idea behind video compression is to save time and the number of bits sent
between images by taking the difference between them instead of sending each frame
again. With video streaming and storage becoming so popular this is a very useful tool to
have. Compression can be lossy or lossless. Lossless compression means that that when
the data is decompressed, the result is a bit-for-bit perfect match with the original. While
lossless compression of video is possible, it is rarely used, as lossy compression results in
far higher compression ratios at an acceptable level of quality.

One common method for video or image compression is discrete cosine


transform. DCT is a lossy compression algorithm that samples an image at regular
intervals, analyzes the frequency components present in the sample, and discards those
frequencies which do not affect the image as the human eye perceives it. However, if the
video is over compressed in a lossy manner, visible (and sometimes distracting) artifacts
can appear.

2.2 Research Goals and Objectives


For this project, my goal was to demonstrate a method of image compression and video
compression. I have implemented image compression and video compression algorithm
using discrete cosine transform. Comparing this method with other methods such as block
matching I found that this is probably not the most efficient method but research shows that it
is often used. The algorithm I am using can take as many jpeg frames as it needs to and
compress a image or video of any size. Below are flow charts layout of the process I use for
image compression and video compression .
Image comression

Input image
(BMP format)

Find an Array
of img

Read img&save
as text file

Read and compressed text file


using DCT and save as text file

Find Quantized
Array

Read and decompressed text


file using IDCT and save as text
file
Find an Array
of img

Read image by Array and this


our compressed image

Video compression

2.3 Research Methods and Algorithm Description


To implement my algorithm I used Matlab. For my algorithm I read in a video and
split the video into separate frames as jpeg images and then performed DCT
compression for each frame. After this the images were put back together as a video.
The video I used was originally an mpeg4 so before I could read in the video I had to
convert it to an acceptable format for Matlab. I converted the video to avi via a online
video format converter. Everything else is performed using functions provided by
Matlab and simple code I created.

Discrete cosine transform works by using an 8 x 8 DCT transform matrix, T.


Then the DCT is performed using a built in Matlab function called blkproc(A, [m,n], T,
T). DCT of x_n is

This function returns a DCT coefficients are real .Then we remove less important
coefficients from Array which having less information. Finally the images are
reconstructed using the IDCT. An example of this using an image is displayed below.

Fig.

Original image

Reconstructed image

Fig: DCT result

compression result

Quantizer : note that we can quantize some frequency coefficients more heavily than others
by simply increasing Q . This leads to the idea of a quantization matrix .We start with an image
block (e.g. 8x8 pixels) .Note that higher frequencies quantized more heavily .

DCT Image

Original image

Original image

al image

DCT Image
Original image

al image

In Video compassion, Simulink results are

After DCT and


quantized
compressed image

2.4 Results and Discussion


DCT compression is somewhat simplistic. Results proved that DCT was not the
best compression method but it does seem to work ok. Other methods utilize the

difference between images more efficiently. Although I was unable to implement such
methods I do feel if I would have had more time to put into it I could have executed
something more efficient.
2.5 Conclusion and Future Work

Video compression is a tradeoff between disk space, video quality, and the cost of hardware
required to decompress the video in a reasonable time. Several ideas for improving this
code could be to improve the algorithm and include block matching or motion
compensation for video compression.

Reference
http://www.wave-report.com/tutorials/VC.htm
http://encyclopedia.jrank.org/articles/pages/6794/Motion-Compensation-for-VideoCompression.html
http://en.wikipedia.org/wiki/Video_compression
http://ossidian.com/glossary/d.html

Potrebbero piacerti anche