Sie sind auf Seite 1von 69

1.

INTRODUCTION
1.1 GENERAL INTRODUCTION
In todays digital world, when we see digital movie, listen digital music, read
digital mail, store documents digitally, making conversation digitally, we have to deal
with huge amount of digital data. So, data compression plays a very significant role to
keep the digital world realistic. If there were no data compression techniques, we
would have not been able to listen to songs over the Internet, see digital pictures or
movies, or we would have not heard about video conferencing or telemedicine. How
data compression made it possible? What are the main advantages of data
compression in digital world? There may be many answers but the three obvious
reasons are the saving of memory space for storage, channel bandwidth and the
processing time for transmission. Every one of us might have experienced that before
the advent MP3, hardly 4 or 5 songs of wav file could be accommodated. And it was
not possible to send a wav file through mail because of its tremendous file size. Now,
we can easily accommodate 50 to 60 songs of MP3 in a music CD of same capacity.
Because, the uncompressed audio files can be compressed 10 to 15 times using MP3
format and we have no problem in sending any of our favorite music to our distant
friends in any corner of the world. Also, we can download a song in MP3 in a matter
of seconds.
Similar compression schemes were developed for other digital data like
images and videos. Videos are nothings but the animations of frames of images in a
proper sequence at a rate of 30 frames per second or higher. A huge amount of
memory is required for storing video files. The possibility of storing 4/5 movies in
DVD CD now rather than we used 2/3 CDs for a movie file is because compression.
We will consider here mainly the image compression techniques.

1.2 MOTIVATION
Image compression is an important issue in digital image processing and finds
extensive applications in many fields. This is the basic operation performed
frequently by any digital photography technique to capture an image. For longer use
of the

portable

photography device it should consume less power so that battery

life will be more. To improve the Conventional techniques of image compressions


1

using the DW T have already been reported and sufficient literatures are available on
this.The JPEG is a lossy compression scheme, which employs the DWT as a tool and
used mainly in digital cameras for compression of images. In the recent past the
demand for low power image compression is growing. As a result various research
workers are actively engaged to evolve efficient methods of image compression using
latest digital signal processing techniques. The objective is to achieve a reasonable
compression ratio as well as better quality of reproduction of image with a low power
consumption. Keeping these objectives in mind the research work in the present
thesis has been undertaken. In sequel the following problems have been investigated.

1.3 OBJECTIVE OF THE PROJECT


Image Compression addresses the problem of reducing the amount of data
required to represent the digital image. Compression is achieved by the removal of
one or more of three basic data redundancies: (1) Coding redundancy, which is
present when less than optimal (i.e.the smallest length) code words are used; (2)
Interpixel redundancy, which results from correlations between the pixels of an
image; &/or (3) psycho visual redundancy which is due to data that is ignored by the
human visual system (i.e. visually nonessential information).Huffman codes contain
the smallest possible number of code symbols (e.g., bits) per source symbol (e.g., grey
level value) subject to the constraint that the source symbols are coded one at a time.
So, Huffman coding when combined with technique of reducing the image
redundancies using Discrete Wavelet Transform (DWT) helps in compressing the
image data to a very good extent.

1.4 ORGANIZATION OF DOCUMENTATION


In this project documentation we have initially put the definition and
objective of the project as well as the design of the project which is followed by
the implementation and testing phases. Finally the project has been concluded
successfully and also the future enhancements of the project were given in this
Documentation.

1.5 JPEG IMAGE


2

JPEG is the most common image format used by digital cameras and other
photographic image capture devices for storing and transmitting photographic images
on the World Wide Web. JPEG compression is used in a number of image file formats
these format variations are often not distinguished and are simply called JPEG. The
term "JPEG" is an acronym for the Joint Photographic Experts Group which created
the standard
Image data compression is concerned with minimizing the number of bits
required to represent an image with no significant loss of information. Image
compression algorithms aim to remove redundancy present in the data (correlation of
data) in a way which makes image reconstruction possible; this is called information
preserving compression Perhaps the simplest and most dramatic form of data
compression is the sampling of band limited images, where an infinite number of
pixels per unit area are reduced to one sample without any loss of information.
Transform based methods better preserve subjective image quality, and are
less sensitive to statistical image property changes both inside a single images and
between images. Prediction methods provide higher compression ratios in a much less
expensive way. If compressed images are transmitted an important property is
insensitivity to transmission channel noise. Transform based techniques are
significantly less sensitivity to channel noise. If transform coefficients are corrupted
during transmission, the resulting image is spread homogeneously through the image
or image part and is not too disturbing.

2. LITERATURE SURVEY
3

2.1 INTRODUCTION
For the past few years, a joint ISO/CCITT committee known as JPEG (Joint
Photographic Experts Group) has been working to establish the first international
compression standard for continuous-tone still images, both grayscale and color.
JPEGs proposed standard aims to be generic support a wide variety of applications
for continuous-tone images. To meet the differing needs of many applications, the
JPEG standard includes two basic compression methods, each with various modes of
operation. A DWT-based method is specified for lossy compression, and a
predictive method for lossless compression. JPEG features a simple lossy technique
known as the Baseline method, a subset of the other DWT-based modes of operation.
The Baseline method has been by far the most widely implemented JPEG method to
date, and is sufficient in its own right for a large number of applications. This article
provides an overview of the JPEG standard, and focuses in detail on the Baseline
method.
Advances over the past decade in many aspects of digital technology
especially devices for image acquisition, data storage, and bitmapped printing and
display - have brought about many applications of digital imaging. However, these
applications tend to be specialized due to their relatively high cost. With the possible
exception of facsimile, digital images are not commonplace in general-purpose
computing systems the way text and geometric graphics are. The majority of modern
business and consumer usage of photographs and other types of images take place
through more traditional analog means.

2.2 EXISTING SYSTEM


Discrete cosine transform (DCT) is widely used in image processing, especially
for compression. Some of the applications of two-dimensional DCT involve still
image

compression and compression of individual video frames, while

multidimensional DCTis mostly used for compression of video streams. DCT is also
useful for transferring multi dimensional data to frequency domain, where different
operations, like spread spectrum, data compression, data watermarking, can be
performed in easier and more efficient manner. A number of papers discussing DCT
algorithms is available in the literature that signifies its importance and application
4

2.3 DISADVANTAGES OF EXISTING SYSTEM


1. Assuming a periodic input, the magnitude of the DFT coefficients is spatially

invariant .This is not true for the DCT.


2. Only spatial correlation of the pixels inside the single 2-D block is considered
and the correlation from the pixels of the neighboring blocks is neglected
3. Impossible to completely decor relate the blocks at their boundaries using
DCT
4. Undesirable blocking artifacts affect the reconstructed images or video frames.
(high compression ratios or very low bit rates)

2.4 PROPOSED SYSTEM


The Discrete wavelet transform (DWT) has gained widespread acceptance in
signal processing and image compression. Because of their inherent multi-resolution
nature, wavelet-coding schemes are especially suitable for applications where
scalability and tolerable degradation are important. Recently the JPEG committee has
released its new image coding standard, JPEG- 2000, which has been based upon
DWT .

DWT has a good localization property in the time domain

and frequency domain.


Number of encoding bits is less compare to existing
method.

2.5 CONCLUSION
Image compression is of prime importance in Real time applications like video
conferencing where data are transmitted through a channel.Using JPEG standard DCT
is used for mapping which reduces the

inter pixel redundancies followed by

quantization which reduces the psychovisual redundancies then coding redundancy is


reduced by the use of optimal code word having minimum average length.

3. ANALYSIS
3.1 INTRODUCTION
5

The of the project is to compress the image the image by using SPIHT with
entrophy encoder. Traditional image coding technology mainly uses the statistical
redundancy between pixels to reach the goal of compressing. The research on wavelet
transform image coding technology has made a rapid progress. Because of its high
speed, low memory requirements and complete reversibility, digital wavelet transform
(IWT) has been adopted by new image coding standard, JPEG 2000. The embedded
zero tree wavelet (EZW) algorithms have obtained not bad effect in low bit-rate image
compression. Set Partitioning in Hierarchical Trees (SPIHT) is an improved version of
EZW and has become the general standard of EZW.

3.2 SOFTWARE REQUIRMENT SPECIFICATIONS


The software used for compressing the image is Matlab (matrix laboratory)
which means language of technical computing.
3.2.1 Software Requirements
If you are new to MATLAB, you should start by reading Manipulating
Matrices. The most important things to learn are how to enter matrices, how to use
the: (colon) operator, and how to invoke functions. After you master the basics, you
should read the rest of the sections below and run the demos.
At the heart of MATLAB is a new language you must learn before you can
fully exploit its power. You can learn the basics of MATLAB quickly, and mastery
comes shortly after. You will be rewarded with high productivity, high-creativity
computing power that will change the way you work.
Introduction - describes the components of the MATLAB system.
Development Environment - introduces the MATLAB development environment,
including information about tools and the MATLAB desktop.
Manipulating Matrices - introduces how to use MATLAB to generate matrices and
perform mathematical operations on matrices.
Graphics - introduces MATLAB graphic capabilities, including information about
plotting data, annotating graphs, and working with images.

Programming with MATLAB - describes how to use the MATLAB language to create
scripts and functions, and manipulate data structures, such as cell arrays and
multidimensional arrays.

3.2.2 Introduction
MATLAB is a high-performance language for technical computing. It
integrates computation, visualization, and programming in an easy-to-use
environment where problems and solutions are expressed in familiar mathematical
notation. Typical uses include:

Math and computation

Algorithm development

Modeling, simulation, and prototyping

Data analysis, exploration, and visualization

Scientific and engineering graphics

Application development, including graphical user interface building


MATLAB is an interactive system whose basic data element is an array that

does not require dimensioning. This allows you to solve many technical computing
problems, especially those with matrix and vector formulations, in a fraction of the
time it would take to write a program in a scalar no interactive language such as C or
FORTRAN.
The name MATLAB stands for matrix laboratory. MATLAB was originally
written to provide easy access to matrix software developed by the LINPACK and
EISPACK projects. Today, MATLAB uses software developed by the LAPACK and
ARPACK projects, which together represent the state-of-the-art in software for matrix
computation.
MATLAB has evolved over a period of years with input from many users. In
university environments, it is the standard instructional tool for introductory and
advanced courses in mathematics, engineering, and science. In industry, MATLAB is
the tool of choice for high-productivity research, development, and analysis.
MATLAB features a family of application-specific solutions called toolboxes.
Very important to most users of MATLAB, toolboxes allow you to learn and apply
7

specialized technology. Toolboxes are comprehensive collections of MATLAB


functions (M-files) that extend the MATLAB environment to solve particular classes
of problems. Areas in which toolboxes are available include signal processing, control
systems, neural networks, fuzzy logic, wavelets, simulation, and many others.
The MATLAB System The MATLAB system consists of five main parts:
Development Environment This is the set of tools and facilities that help you
use MATLAB functions and files. Many of these tools are graphical user interfaces. It
includes the MATLAB desktop and Command Window, a command history, and
browsers for viewing help, the workspace, files, and the search path.
The MATLAB Mathematical Function Library This is a vast collection of
computational algorithms ranging from elementary functions like sum, sine, cosine,
and complex arithmetic, to more sophisticated functions like matrix inverse, matrix
eigenvalues, Bessel functions, and fast Fourier transforms.
The MATLAB Language

This is a high-level matrix/array language with

control flow statements, functions, data structures, input/output, and object-oriented


programming features. It allows both "programming in the small" to rapidly create
quick and dirty throw-away programs, and "programming in the large" to create
complete large and complex application programs.
Handle Graphics

This is the MATLAB graphics system. It includes high-

level commands for two-dimensional and three-dimensional data visualization, image


processing, animation, and presentation graphics. It also includes low-level
commands that allow you to fully customize the appearance of graphics as well as to
build complete graphical user interfaces on your MATLAB applications.
This is a library that allows you to write C and FORTRAN programs that
interact with MATLAB. It include facilities for calling routines from MATLAB
(dynamic linking), calling MATLAB as a computational engine, and for reading and
writing MAT-files.
Development Environment

This chapter provides a brief introduction to

starting and quitting MATLAB, and the tools and functions that help you to work with
MATLAB variables and files. For more information about the topics covered here, see
8

the corresponding topics under Development Environment in the MATLAB


documentation, which is available online as well as in print.
Starting MATLAB On a Microsoft Windows platform, to start MATLAB,
double-click the MATLAB shortcut icon on your Windows desk.
On a UNIX platform, to start MATLAB, type mat lab at the operating system
promp.
After starting MATLAB, the MATLAB desktop opens - see MATLAB
Desktop.You can change the directory in which MATLAB starts, define startup
options including running a script upon startup, and reduce startup time in some
situations.
Quitting MATLAB To end your MATLAB session, select Exit MATLAB from
the File menu in the desktop, or type quit in the Command Window. To execute
specified functions each time MATLAB quits, such as saving the workspace, you can
create and run a finish m. script.
3.2.3 MATLAB Desktop
When you start MATLAB, the MATLAB desktop appears, containing tools
(graphical user interfaces) for managing files, variables, and applications associated
with MATLAB.
The first time MATLAB starts, the desktop appears as shown in the following
illustration, although your Launch Pad may contain different entries. You can change
the way your desktop looks by opening, closing, moving, and resizing the tools in it.
You can also move tools outside of the desktop or return them back inside the desktop
(docking). All the desktop tools provide common features such as context menus and
keyboard shortcuts.
You can specify certain characteristics for the desktop tools by selecting
Preferences from the File menu. For example, you can specify the font characteristics
for Command Window text. For more information, click the Help button in the
Preferences dialog box.

Desktop Tools this section provides an introduction to MATLAB's desktop


tools. You can also use MATLAB functions to perform most of the features found in
the desktop tools. The tools are:

Current Directory Browser

Workspace Browser

Array Editor

Editor/Debugger

Command Window

Command History

Launch Pad

Help Browser
Command Window Use the Command Window to enter variables and run

functions and M-files.


Command History Lines you enter in the Command Window are logged in the
Command History window. In the Command History, you can view previously used
functions, and copy and execute selected lines. To save the input and output from a
MATLAB session to a file, use the diary function.
Running External Programs You can run external programs from the
MATLAB Command Window. The exclamation point character! is a shell escape and
indicates that the rest of the input line is a command to the operating system. This is
useful for invoking utilities or running other programs without quitting MATLAB. On
Linux, for example! Emacs magik.m invokes an editor called emacs for a file named
magik.m. When you quit the external program, the operating system returns control to
MATLAB.
Launch Pad MATLABs Launch Pad provides easy access to tools, demos, and
documentation.
Help Brower Use the Help browser to search and view documentation for all
your Math Works products. The Help browser is a Web browser integrated into the
MATLAB desktop that displays HTML documents.
10

To open the Help browser, click the help button in the toolbar, or type help
browser in the Command Window. The Help browser consists of two panes, the Help
Navigator, which you use to find information, and the display pane, where you view
the information.
Help Navigator Use to Help Navigator to find information. It includes
Product filter - Set the filter to show documentation only for the products you
specify. Contents tab - View the titles and tables of contents of documentation for
your products. Index tab - Find specific index entries (selected keywords) in the Math
Works documentation for your products. Search tab- Look for a specific phrase in the
documentation. To get help for a specific function, set the Search type to Function
Name. Favorites tab - View a list of documents you previously designated as
favorites.
Display Pane After finding documentation using the Help Navigator, view it
in the display pane. While viewing the documentation, you can:
Browse to other page - Use the arrows at the tops and bottoms of the pages, or
use the back and forward buttons in the toolbar.
Bookmark pages-Click the Add to Favorites button in the toolbar.
Print pages - Click the print button in the toolbar.
Find a term in the page - Type a term in the Find in page field in the toolbar
and click Go.
Other features available in the display pane are: copying information,
evaluating a selection, and viewing Web pages.
Current Directory MATLAB file operations use the current directory and the
search path as reference points. Any file you want to run must either be in the current
directory or on the search path.
Search path To determine how to execute functions you call, MATLAB uses a
search path to find M-files and other MATLAB-related files, which are organized in
directories on your file system. Any file you want to run in MATLAB must reside in
11

the current directory or in a directory that is on the search path. By default, the files
supplied with MATLAB and Math Works toolboxes are included in the search path.
Workspace Browser The MATLAB workspace consists of the set of variables
(named arrays) built up during a MATLAB session and stored in memory. You add
variables to the workspace by using functions, running M-files, and loading saved
workspaces.
To view the workspace and information about each variable, use the
Workspace browser, or use the functions who and whos.To delete variables from the
workspace, select the variable and select Delete from the Edit menu. Alternatively,
use the clear function.
The workspace is not maintained after you end the MATLAB session. To
save the workspace to a file that can be read during a later MATLAB session, select
Save Workspace As from the File menu, or use the save function. This saves the
workspace to a binary file called a MAT-file, which has a .mat extension. There are
options for saving to different formats. To read in a MAT-file, select Import Data from
the File menu, or use the load function.
Array editor Double-click on a variable in the Workspace browser to see it in
the Array Editor. Use the Array Editor to view and edit a visual representation of oneor two-dimensional numeric arrays, strings, and cell arrays of strings that are in the
workspace.
Editor/Debugger Use the Editor/Debugger to create and debug M-files, which
are programs you write to runMATLAB functions. The Editor/Debugger provides a
graphical user interface for basic text editing, as well as for M-file debugging.
You can use any text editor to create M-files, such as Emacs, and can use
preferences (accessible from the desktop File menu) to specify that editor as the
default. If you use another editor, you can still use the MATLAB Editor/Debugger for
debugging, or you can use debugging functions, such as dbstop, which sets a
breakpoint. If you just need to view the contents of an M-file, you can display it in the
Command Window by using the type function.

12

Manipulating Matrices, Entering Matrices The best way for you to get started
with MATLAB is to learn how to handle matrices. Start MATLAB and follow along
with each example.
You can enter matrices into MATLAB in several different ways:

Enter an explicit list of elements.

Load matrices from external data files.

Generate matrices using built-in functions.

Create matrices with your own functions in M-files.

Start by entering Durers matrix as a list of its elements. You have only to follow a
few basic conventions:

Separate the elements of a row with blanks or commas.

Use a semicolon, ; , to indicate the end of each row.

Surround the entire list of elements with square brackets, [ ].

To enter Durers matrix, simply type in the Command Window


A = [16 3; 5 10]
MATLAB displays the matrix you just entered.
A = 16
5

10
This exactly matches the numbers in the engraving. Once you have entered the

matrix, it is automatically remembered in the MATLAB workspace. You can refer to it


simply as A.
Expressions Like most other programming languages, MATLAB provides
mathematical expressions, but unlike most programming languages, these expressions
involve entire matrices. The building blocks of expressions are:

Variables

Numbers

Operators
13

Functions
Variables MATLAB does not require any type declarations or dimension

statements. When MATLAB encounters a new variable name, it automatically creates


the variable and allocates the appropriate amount of storage. If the variable already
exists, MATLAB changes its contents and, if necessary, allocates new storage.
Variable names consist of a letter, followed by any number of letters, digits, or
underscores. MATLAB uses only the first 31 characters of a variable name. MATLAB
is case sensitive; it distinguishes between uppercase and lowercase letters. A and a are
not the same variable. To view the matrix assigned to any variable, simply enter the
variable name.
Numbers MATLAB uses conventional decimal notation, with an optional
decimal point and leading plus or minus sign, for numbers. Scientific notation uses
the letter e to specify a power-of-ten scale factor. Imaginary numbers use either i or j
as a suffix. Some examples of legal numbers are
3

-99

0.0001

9.6397238

1.60210e-20

6.02252e23

1i

-3.14159j

3e5i

All numbers are stored internally using the long format specified by the IEEE
floating-point standard. Floating-point numbers have a finite precision of roughly 16
significant decimal digits and a finite range of roughly 10-308 to 10+308.
Operators Expressions use familiar arithmetic operators and precedence rules.
+

Addition

Subtraction

Multiplication

Division

Left division (described in "Matrices and Linear Algebra" in Using MATLAB)

Power

'

Complex conjugate transpose


14

()

Specify evaluation order


Functions MATLAB provides a large number of standard elementary

mathematical functions, including abs, sqrt, exp, and sin. Taking the square root or
logarithm of a negative number is not an error; the appropriate complex result is
produced automatically. MATLAB also provides many more advanced mathematical
functions, including Bessel and gamma functions. Most of these functions accept
complex arguments. For a list of the elementary mathematical functions, typehelp
elfun
For a list of more advanced mathematical and matrix functions, type
help specfun
help elmat
Some of the functions, like sqrt and sin, are built-in. They are part of the
MATLAB core so they are very efficient, but the computational details are not readily
accessible. Other functions, like gamma and sinh, are implemented in M-files. You
can see the code and even modify it if you want. Several special functions provide
values of useful constants.
Pi

3.14159265...

Imaginary unit, -1

Same as i

Eps

Floating-point relative precision, 2-52

Realmin

Smallest floating-point number, 2-1022

Realmax

Largest floating-point number, (2- ) 21023

Inf

Infinity

NaN

Not-a-number

3.3 GUI
A graphical user interface (GUI) is a user interface built with graphical
objects, such as buttons, text fields, sliders, and menus. In general, these objects
already have meanings to most computer users. For example, when you move a slider,
15

value changes; when you press an OK button, your settings are applied and the dialog
box is dismissed. Of course, to leverage this built-in familiarity, you must be
consistent in how you use the various GUI-building components.
Applications that provide GUIs are generally easier to learn and use since the
person using the application does not need to know what commands are available or
how they work. The action that results from a particular user action can be made clear
by the design of the interface.
The sections that follow describe how to create GUIs with MATLAB. This
includes laying out the components, programming them to do specific things in
response to user actions, and saving and launching the GUI; in other words, the
mechanics of creating GUIs. This documentation does not attempt to cover the "art"
of good user interface design, which is an entire field unto itself. Topics covered in
this section include.
Creating GUIs with GUIDE MATLAB implements GUIs as figure windows
containing various styles of control objects. You must program each object to perform
the intended action when activated by the user of the GUI. In addition, you must be
able to save and launch your GUI. All of these tasks are simplified by GUIDE,
MATLAB's graphical user interface development environment.
GUI Development Environment: The process of implementing a GUI involves two
basic tasks:

Laying out the GUI components

Programming the GUI components


GUIDE primarily is a set of layout tools. However, GUIDE also

generates an M-file that contains code to handle the initialization and launching of the
GUI. This M-file provides a framework for the implementation of the callbacks - the
functions that execute when users activate components in the GUI.
The Implementation of a GUI While it is possible to write an M-file that
contains all the commands to lay out a GUI, it is easier to use GUIDE to lay out the
components interactively and to generate two files that save and launch the GUI:An
16

M-file - contains the functions that launch and control the GUI and the callbacks,
which are defined as sub functions. This M-file is referred to as the application M-file
in this documentation.
Note that the application M-file does not contain the code that lays out the
controls; this information is saved in the FIG-file.
Features of the GUIDE-Generated Application M-File
GUIDE simplifies the creation of GUI applications by automatically
generating an M-file framework directly from your layout. You can then use this
framework to code your application M-file. This approach provides a number of
advantages:
The M-file contains code to implement a number of useful features (see
Configuring Application Options for information on these features). The M-file
adopts an effective approach to managing object handles and executing callback
routines (see Creating and Storing the Object Handle Structure for more information).
The M-files provides a way to manage global data (see Managing GUI Data for more
information).
You can elect to have GUIDE generate only the FIG-file and write the
application M-file yourself. Keep in mind that there are no control creation commands
in the application M-file; the layout information is contained in the FIG-file generated
by the Layout Editor.

17

4. IMAGE COMPRESSION METHODOLOGY


4.1 OVERVIEW
The storage requirements for the video of a typical Angiogram procedure is
of the order of several hundred Mbytes

Transmission of this data over a low bandwidth network results in very high
latency

Lossless compression methods can achieve compression ratios of ~2:1

We consider lossy techniques operating at much higher compression ratios


(~10:1)

Key issues:
High quality reconstruction required
Angiogram data contains considerable high-frequency spatial texture

Proposed method applies a texture-modelling scheme to the high-frequency


texture of some regions of the image

This allows more bandwidth allocation to important areas of the image


18

4.2 DIFFERENT TYPES OF TRANSFORMS USED FOR


CODING

1. FT (Fourier Transform)

2. DCT (Discrete Cosine Transform)

3. DWT (Discrete Wavelet Transform)

4.2.1 FOURIER TRANSFORM

The Fourier transform's utility lies in its ability to analyze a signal in the time

domain for its frequency content. The transform works by first translating a function
in the time domain into a function in the frequency domain. The signal can then be
analyzed for its frequency content because the Fourier coefficients of the transformed
function represent the contribution of each sine and cosine function at each frequency.
An inverse Fourier transform does just what you'd expect, transform data from the
frequency domain into the time domain.
4.2.2

The Discrete Cosine Transform (DCT)


The discrete cosine transform (DCT) helps separate the image into parts (or

spectral sub-bands) of differing importance (with respect to the image's visual


quality). The DCT is similar to the discrete Fourier transform: it transforms a signal or
image from the spatial domain to the frequency domain.
4.2.3 Discrete Wavelet Transform (DWT)
The discrete wavelet transform (DWT) refers to wavelet transforms for which
the wavelets are discretely sampled. A transform which localizes a function both in
space and

scaling and has some desirable properties compared to the Fourier

transform. The transform is based on a wavelet matrix, which can be computed more
quickly than the analogous Fourier matrix. Most notably, the discrete wavelet
transform is used for signal coding, where the properties of the transform are
19

exploited to represent a discrete signal in a more redundant form, often as a


preconditioning for data compression. The discrete wavelet transform has a huge
number of applications in Science, Engineering, Mathematics and Computer Science.
Wavelet compression is a form of data compression well suited for image
compression (sometimes also video compression and audio compression). The goal is
to store image data in as little space as possible in a file. A certain loss of quality is
accepted (lossy compression).
Using a wavelet transform, the wavelet compression methods are better at
representing transients, such as percussion sounds in audio, or high-frequency
components in two-dimensional images, for example an image of stars on a night sky.
This means that the transient elements of a data. signal can be represented by a
smaller amount of information than would be the case if some other transform, such
as the more widespread discrete cosine transform, had been used. First a wavelet
transform is applied. This produces as many coefficients as there are pixels in the
image (i.e.: there is no compression yet since it is only a transform). These
coefficients can then be compressed more easily because the information is
statistically concentrated in just a few coefficients. This principle is called transform
coding. After that, the coefficients

are

quantized and the quantized values are

entropy encoded and/or run length encoded.


Examples for Wavelet Compressions:
JPEG 2000
Ogg
Tarkin
SPIHT
MrS

4.3 QUANTIZATION
Quantization involved in image processing. Quantization techniques generally
compress by compressing a range of values to a single quantum value. By reducing
the number of discrete symbols in a given stream, the stream becomes more
compressible. For example seeking to reduce the number of colors required to

20

represent an image. Another widely used example DCT data quantization in JPEG
and DWT data quantization in JPEG 2000.

4.4 QUANTIZATION IN IMAGE COMPRESSION


The human eye is fairly good at seeing small differences in brightness over a
relatively large area, but not so good at distinguishing the exact strength of a high
frequency brightness variation. This fact allows one to get away with greatly reducing
the amount of information in the high frequency components. This is done by simply
dividing each component in the frequency domain by a constant for that component,
and then rounding to the nearest integer. This is the main lossy operation in the whole
process. As a result of this, it is typically the case that many of the higher frequency
components are rounded to zero, and many of the rest become small positive or
negative numbers.

4.5 ENTROPY ENCODING


An entropy encoding is a coding scheme that assigns codes to symbols so as to
match code lengths with the probabilities of the symbols. Typically, entropy encoders
are used to compress data by replacing symbols represented by equal-length codes
with symbols represented by codes proportional to the negative logarithm of the
probability. Therefore, the most common symbols use the shortest codes. According
to Shannon's source coding theorem, the optimal code length for a symbol logbP,
where b is the number of symbols used to make output codes and P is the probability
of the input symbol. Three of the most common entropy encoding techniques are
Huffman coding, range encoding, and arithmetic coding. If Arithmetic Coding - a
relatively new variable length coding scheme that can combine the best features of
Huffman and run-length coding, and also adapt to data with non-stationary statistics.
the approximate entropy characteristics of a data stream are known in advance
(especially for signal compression), a simpler static code such as unary coding, Elias
gamma coding, Fibonacci coding, Golomb coding, or Rice coding may be useful.
There are three main techniques for achieving entropy coding:

1 Huffman Coding - one of the simplest variable length coding schemes.


2 Run-length Coding (RLC) - very useful for binary data containing long runs
of ones of zeros.
21

We shall concentrate on the Huffman and RLC methods for simplicity. Interested
readers may find out more about Arithmetic Coding in chapters 12 and 13 of the
JPEG Book.
First we consider the change in compression performance if simple Huffman Coding
is used to code the subimages of the 4-level Haar transform.

22

5. IMAGE CLASSIFICATION AND DIGITIZATION


In general images can be defined as any two dimensional function f(x, y) where x,
y are spatial coordinates, and amplitude of f at any pair of coordinates(x,y) is called
intensity or gray level of the image at that point.

5.1 DIGITAL IMAGE


When x, y and the amplitude values of f are all finite, discrete quantities, we call
the image a digital image.

Figure.5.1: A Digital Image


5.1.1 Pixel
A pixel is a single point in a graphic image. Graphics monitors display pictures by
dividing the display screen into thousands (or millions) of pixels, arranged in rows and
columns. The pixels are so close together that they appear connected. The number of bits
used to represent each pixel determines how many colors or shades of gray can be
displayed. For example, in 8-bit color mode, the color monitor uses 8 bits for each pixel,
making it possible to display 2 to the 8th power (256) different colors or shades of gray.

5.2 IMAGE TYPES


23

The different types of images are


1. Binary Images
2. Indexed Images
3. Intensity Images
4. Multi-frame Images
5. RGB Images.
5.2.1 Binary image
An image contains only black and white pixels. In MATLAB, a binary image is
represented by a uint8 or double logical matrix containing 0's and 1's (which usually
represent black and white, respectively). A matrix is logical when its "logical flag" is
turned "on." We often use the variable name BW to represent a binary image in memory.
Figure.5.2: Binary image Figure .5.3: Intensity image
im2bw

Figure.5.4: RGB image

rgb2gray

rgb2ind

5.2.2 Indexed image


An image pixel values are direct indices into an RGB color map. In MATLAB, an
indexed image is represented by an array of class uint8, uint16, or double. The color map
is always an m-by-3 array of class double. We often use the variable name X to represent
an indexed image in memory, and map to represent the color map.

5.2.3 Intensity image

24

An image consists of intensity (grayscale) values. In MATLAB, intensity images


are represented by an array of class uint8, uint16, or double. While intensity images are
not stored with color maps, MATLAB uses a system color map to display them. We often
use the variable name I to represent an intensity image in memory. This term is
synonymous with the term "grayscale."
5.2.4 Multi-frame image
An image file contains more than one image, or frame. When in MATLAB
memory, a multiframe image is a 4-Darray where the fourth dimension specifies the
frame number. This term is synonymous with the term "multipage image."
5.2.5 RGB image
In an image each pixel is specified by three values -- one each for the red, blue,
and green components of the pixel's color. In MATLAB, an RGB image is represented by
an m-by-n-by-3 array of class uint8, uint16, or double. We often use the variable name
RGB to represent an RGB image in memory.

5.3 IMAGE DIGITIZATION


An image captured by a sensor is expressed as a continuous function f(x, y) of
two coordinates in the plane. Image digitization means that the function f(x, y) is sampled
into a matrix with m rows and n columns. The image quantization assigns to each
continuous sample an integer value. The continuous range of image functions f(x, y) is
split into k intervals. The finer the sampling (i.e. the larger m and n) and quantization
(larger k) the better the approximation of the continuous image f(x, y).

5.4 SAMPLING AND QUANTIZATION


To be suitable for computer processing an image function must be digitized both
spatially and in amplitude. Digitization of spatial coordinates is called image sampling
and amplitude digitization is called gray level quantization.

6. WAVELET TRANSFORM
25

6.1 OVERVIEW OF WAVELET TRANSFORM


The fundamental idea behind wavelets is to analyze according to scale. Indeed,
some researchers in the wavelet field feel that, by using wavelets, one is adopting a whole
new mindset or perspective in processing data.
Wavelets are functions that satisfy certain mathematical requirements and are
used in representing data or other functions. This idea is not new. Approximation using
superposition of functions has existed since the early 1800's, when Joseph Fourier
discovered that he could superpose sine and cosines to represent other functions.
However, in wavelet analysis, the scale that we use to look at data plays a special role.
Wavelet algorithms process data at different scales or resolutions. If we look at a signal
with a large "window," we would notice gross features. Similarly, if we look at a signal
with a small "window," we would notice small features. The result in wavelet analysis is
to see both the forest and the trees, so to speak.
This makes wavelets interesting and useful. For many decades, scientists have
wanted more appropriate functions than the sine and cosines which comprise the bases of
Fourier analysis, to approximate choppy signals .By their definition, these functions are
non-local (and stretch out to infinity). They therefore do a very poor job in approximating
sharp spikes. But with wavelet analysis, we can use approximating functions that are
contained neatly in finite domains. Wavelets are well-suited for approximating data with
sharp discontinuities.
The wavelet analysis procedure is to adopt a wavelet prototype function, called an
analyzing wavelet or mother wavelet. Temporal analysis is performed with a contracted,
high-frequency version of the prototype wavelet, while frequency analysis is performed
with a dilated, low-frequency version of the same wavelet. Because the original signal or
function can be represented in terms of a wavelet expansion (using coefficients in a linear
combination of the wavelet functions), data operations can be performed using just the
corresponding wavelet coefficients. And if you further choose the best wavelets adapted
to your data, or truncate the coefficients below a threshold, your data is sparsely
26

represented. This sparse coding makes wavelets an excellent tool in the field of data
compression.
Other applied fields that are making use of wavelets include astronomy, acoustics,
nuclear engineering, sub-band coding, signal and image processing, neurophysiology,
music, magnetic resonance imaging, speech discrimination, optics, fractals, turbulence,
earthquake-prediction, radar, human vision, and pure mathematics applications such as
solving partial differential equations.

6.2 BASIS FUNCTIONS


It is simpler to explain a basis function if we move out of the realm of analog
(functions) and into the realm of digital (vectors) (*). Every two-dimensional vector (x,y)
is a combination of the vector (1,0) and (0,1). These two vectors are the basis vectors for
(x,y). Why? Notice that x multiplied by (1,0) is the vector (x,0), and y multiplied by (0,1)
is the vector (0,y). The sum is (x,y).
The best basis vectors have the valuable extra property that the vectors are
perpendicular, or orthogonal to each other. For the basis (1,0) and (0,1), this criteria is
satisfied.
Now let's go back to the analog world, and see how to relate these concepts to
basis functions. Instead of the vector (x,y), we have a function f(x). Imagine that f(x) is a
musical tone, say the note A in a particular octave. We can construct A by adding sines
and cosines using combinations of amplitudes and frequencies. The sines and cosines are
the basis functions in this example, and the elements of Fourier synthesis. For the sines
and cosines chosen, we can set the additional requirement that they be orthogonal. How?
By choosing the appropriate combination of sine and cosine function terms whose inner
product add up to zero. The particular set of functions that are orthogonal and that
construct f(x) are our orthogonal basis functions for this problem.
6.2.1 Scale-Varying Basis Functions
27

A basis function varies in scale by chopping up the same function or data space
using different scale sizes. For example, imagine we have a signal over the domain from
0 to 1. We can divide the signal with two step functions that range from 0 to 1/2 and 1/2
to 1. Then we can divide the original signal again using four step functions from 0 to 1/4,
1/4 to 1/2, 1/2 to 3/4, and 3/4 to 1. And so on. Each set of representations code the
original signal with a particular resolution or scale.

6.3 FAST FOURIER TRANSFORM


To approximate a function by samples, and to approximate the Fourier integral by
the discrete Fourier transform, requires applying a matrix whose order is the number
sample points n. Since multiplying an

matrix by a vector costs on the order of

arithmetic operations, the problem gets quickly worse as the number of sample points
increases. However, if the samples are uniformly spaced, then the Fourier matrix can be
factored into a product of just a few sparse matrices, and the resulting factors can be
applied to a vector in a total of order

arithmetic operations. This is the so-called fast

Fourier transform or FFT.

6.4 SIMILARITIES BETWEEN FOURIER AND WAVELET


TRANSFORM
The fast Fourier transform (FFT) and the discrete wavelet transform (DWT) are
both linear operations that generate a data structure that contains

segments of various

lengths, usually filling and transforming it into a different data vector of length

The mathematical properties of the matrices involved in the transforms are similar
as well. The inverse transform matrix for both the FFT and the DWT is the transpose of
the original. As a result, both transforms can be viewed as a rotation in function space to
a different domain. For the FFT, this new domain contains basis functions that are sines
and cosines. For the wavelet transform, this new domain contains more complicated basis
functions called wavelets, mother wavelets, or analyzing wavelets.

28

Both transforms have another similarity. The basis functions are localized in frequency,
making mathematical tools such as power spectra (how much power is contained in a
frequency interval) and scale grams (to be defined later) useful at picking out frequencies
and calculating power distributions.

6.5 DISSIMILARITIES BETWEEN FOURIER AND WAVELET


TRANSFORM
The most interesting dissimilarity between these two kinds of transforms is that
individual wavelet functions are localized in space. Fourier sine and cosine functions are
not. This localization feature, along with wavelets' localization of frequency, makes many
functions and opera tors using wavelets "sparse" when transformed into the wavelet
domain. This sparseness, in turn, results in a number of useful applications such as data
compression, detecting features in images, and removing noise from time series.

6.6 LIST OF WAVELET RELATED TRANSFORM

Continuous wavelet transform


A continuous wavelet transform is used to divide a continuous-time function into

wavelets. Unlike Fourier transform, the continuous wavelet transform possesses the
ability to construct a time frequency represented of a signal that offers very good time
and frequency localization.

Multi resolution analysis


A multi resolution analysis (MRA) or multi scale approximation (MSA) is the

design methods of most of the practically relevant discrete wavelet transform (DWT) and
the justification for the algorithm of the fast Fourier wavelet transform (FWT)

Discrete wavelet transform

29

In numerical analysis and functional analysis, a discrete wavelet transform


(DWT) is any wavelet transform for which the wavelets are discretely sampled. As with
other wavelet transforms, a key advantage it has over Fourier transforms is temporal
resolution: it captures both frequency and location information.

Fast wavelet transform


The Fast Wavelet Transform is a mathematical algorithm designed to turn a

waveform or signal in the time domain into a sequence of coefficients based on an


orthogonal basis of small finite waves, or wavelets. The transform can be easily extended
to multidimensional signals, such as images, where the time domain is replaced with the
space domain

7. DESIGN
30

7.1 INTRODUCTION
In this project we propose the image compression using SPIHT with entrophy
encoder that is supposed to replace existing software and the proposed

method is

advanced.

7.2 BLOCK DIAGRAM

Figure.7.1: Block diagram of image compression

7.3 BLOCK DIAGRAM EXPLANATION


A block diagram of a wavelet based image compression system is shown in
Figure .At the heart of the analysis (or compression) stage of the system is the forward
discretewavelet transform (DWT). Here, the input image is mapped from a spatial
domain, to a scale-shift domain. This transform separates the image information into
octave frequency sub bands. The expectation is that certain frequency bands will have
zero or negligible energy content; thus, information in these bands can be thrown away or
reduced so that the image is compressed without much loss of information.
The DWT coefficients are then quantized to achieve compression. Information
lost during the quantization process cannot be recovered and this impacts the quality of
31

the reconstructed image. Due to the nature of the transform, DWT coefficients exhibit
spatial correlation,that are exploited by quantization algorithms like the embedded zerotree wavelet (EZW) and set partitioning in hierarchical trees (SPIHT) for efficient
quantization. The quantized coefficients may then be entropy coded; this is a reversible
process that eliminates any redundancy at the output the Quantize.
In the synthesis (or decompression) stage, the inverse discrete wavelet transform
recovers the original image from the DWT coefficients. In the absence of any
quantization the reconstructed image will be identical to the input image. However, if any
information was discarded during the quantization process, the reconstructed image will
only be an approximation of the original image. Hence this is called lossy compression.
The more an image is compressed, the more information is discarded by the quantizer;
the result is a reconstructed image that exhibits increasingly more artifacts. Certain
integer wavelet transforms exist that result in DWT coefficients that can be quantized
without any loss of information. These result in lossless compression, where the
reconstructed image is an exact replica of the input image. However, compression ratios
achieved by these transforms are small compared to lossy transforms .

8. IMAGE COMPRESSION USING DISCRETE WAVELET


TRANSFORM
32

The wavelet transform (WT) has gained widespread acceptance in signal


processing and image compression. Because of their inherent multi-resolution nature,
wavelet-coding schemes are especially suitable for applications where scalability and
tolerable degradation are important. Recently the JPEG committee has released its new
image coding standard, JPEG- 2000, which has been based upon DWT .

8.1 WAVELET TRANSFORM


Wavelets are functions defined over a finite interval and having an average value
of zero. The basic idea of the wavelet transform is to represent any arbitrary function (t)
as a superposition of a set of such wavelets or basis functions. These basis functions or
baby wavelets are obtained from a single prototype wavelet called the mother wavelet, by
dilations or contractions (scaling) and translations (shifts). The Discrete Wavelet
Transform of a finite length signal x(n) having N components, for example, is expressed
by an N x N matrix.

8.2 WAVELET-BASED COMPRESSION


Despite all the advantages of JPEG compression schemes based on DCT namely
simplicity, satisfactory performance, and availability of special purpose hardware for
implementation, these are not without their shortcomings. Since the input image needs to
be ``blocked,'' correlation across the block boundaries is not eliminated. This results in
noticeable and annoying ``blocking artifacts'' particularly at low bit rates as shown in Fig
2.6 . Lapped Orthogonal Transforms (LOT) attempt to solve this problem by using
smoothly overlapping blocks. Although blocking effects are reduced in LOT compressed
images, increased computational complexity of such algorithms do not justify wide
replacement of DCT by LOT.

33

Figure.8.1: Original Lena Image

Figure.8.2: Reconstructed Lena with DC


Component

To show blocking artifacts Over the past several years, the wavelet transform has
gained widespread acceptance in signal processing in general, and in image compression
research in particular. In many applications wavelet-based schemes (also referred as
subband coding) outperform other coding schemes like the one based on DCT. Since
there is no need to block the input image and its basis functions have variable length,
wavelet coding schemes at higher compression avoid blocking artifacts. Wavelet-based
coding is more robust under transmission and decoding errors, and also facilitates
progressive transmission of images. In addition, they are better matched to the HVS
characteristics. Because of their inherent multiresolution nature [9], wavelet coding
schemes are especially suitable for applications where scalability and tolerable
degradation are important.

8.3 SUBBAND CODING


The fundamental concept behind Subband Coding (SBC) is to split up the
frequency band of a signal (image in our case) and then to code each subband using a
coder and bit rate accurately matched to the statistics of the band. SBC has been used
extensively first in speech coding and later in image coding [12] because of its inherent
advantages namely variable bit assignment among the subbands as well as coding error
confinement within the subbands.
34

Figure.8.3: Separable 4-subband Filterbank,


.
ods and O'Neil used a separable combination of one-dimensional Quadrature Mirror
Filter banks (QMF) to perform a 4-band decomposition by the row-column approach as
shown in Fig.Corresponding division of the frequency spectrum is shown in Fig. 2.8 .
The process can be iterated to obtain higher band decomposition filter trees. At the
decoder, the subband signals are decoded, upsampled and passed through a bank of
synthesis filters and properly summed up to yield the reconstructed image.
8.3.1 From Subband to Wavelet Coding
Over the years, there have been many efforts leading to improved and efficient
design of filter banks and subband coding techniques. Since 1990, methods very similar
and closely related to subband coding have been proposed by various researchers under
the name of Wavelet Coding (WC) using filters specifically designed for this purpose
Such filters must meet additional and often conflicting requirements . These include short
35

impulse response of the analysis filters to preserve the localization of image features as
well as to have fast computation, short impulse response of the synthesis filters to prevent
spreading of artifacts (ringing around edges) resulting from quantization errors, and linear
phase of both types of filters since nonlinear phase introduce unpleasant waveform
distortions around edges. Orthogonality is another useful requirement since orthogonal
filters, in addition to preservation of energy, implement a unitary transform between the
input and the subbands. But, as in the case of 1-D, in two-band Finite
Impulse Response (FIR) systems linear phase and orthogonality are mutually exclusive,
and so orthogonality is sacrificed to achieve linear phase.

8.4 LINK BETWEEN WAVELET TRANSFORM AND FILTER BANK


Construction of orthonormal families of wavelet basis functions can be carried out
in continuous time. However, the same can also be derived by starting from discrete-time
filters. Daubechies was the first to discover that the discrete-time filters or QMFs can be
iterated and under certain regularity conditions will lead to continuous-time wavelets.
This is a very practical and extremely useful wavelet decomposition scheme, since FIR
discrete-time filters can be used to implement them. It follows that the orthonormal bases
in correspond to a subband coding scheme with exact reconstruction property, using the
same FIR filters for reconstruction as for decomposition. So, subband coding developed
earlier is in fact a form of wavelet coding in disguise. Wavelets did not gain popularity in
image coding until Daubechies established this link . In late 1980s. Later a systematic
way of constructing a family of compactly supported biorthogonal wavelets was
developed by Cohen, Daubechies, and Feauveau (CDF) . Although the design and choice
of various filters and the construction of different wavelets from the iteration of such
filters are very important, it is beyond the scope of this article.

8.5 EXAMPLE OF WAVELET DECOMPOSITION


36

There are several ways wavelet transforms can decompose a signal into various
subbands. These

include uniform decomposition, octave-band decomposition, and

adaptive or wavelet-packet decomposition [12]. Out of these, octave-band decomposition


is the most widely used. This is a non-uniform band splitting method that decomposes the
lower frequency part into narrower bands and the high-pass output at each level is left
without any further decomposition.

LL1

HL1

LH1

HH1

LH2

HL3
HH2

LH3

Figure.8.4: Octave level octave band

HL2

HH3

Figure.8.5: Spectral decomposition and

decomposition

Odering
37

Figure shows the various subband images of a 3-level octave-band decomposed


Lena using the popularCDF-9/7 [7] biorthogonal wavelet.
Most of the subband and wavelet coding schemes can also be described in terms
of the general framework depicted as in Fig. 1. The main difference from the JPEG
standard is the use of DWT rather than DCT. Also, the image need not be split into 8 x 8
disjoint blocks. Of course, many enhancements have been made to the standard
quantization and encoding techniques to take advantage of how the wavelet transforms
works on an image and the properties and statistics of transformed coefficients so
generated.

8.6 RESULT
Image size Decomposition Level Threshhold Compression ratio
256 x 256 3 40 16.1759
256 x 256 3 60 21.6558
256 x 256 3 80 25.9193
256 x 256 4 40 15.7964
256 x 256 4 60 22.4193
256 x 256 4 80 28.9469
256 x 256 5 40 14.9430
256 x 256 5 60 21.3887
256 x 256 5 80 28.1812

38

9. IMAGE PROCESSING
The field of digital image processing refers to processing of digital image by
means of a digital computer. A digital image is an image f(x, y) that has been discretized
both in spatial coordinates and brightness. A digital image can be considered as a matrix
whose row and column indices identifies a point in the image and corresponding matrix
element value identifies the gray level at that point. The elements of such a digital array
are called image elements, picture elements, pixels or pels. The last two being commonly
used abbreviations of pictures elements.
The term digital processing generally refers to a two dimensional picture by a
digital computer. In a broader context it implies digital processing of any two
dimensional data.
In the form in which they usually occur, images are not directly amenable to
computer analysis. Since computers work with numerical rather than pictorial data, an
image must be converted to numerical form before processing. This conversion process is
called digitization. The image is divided into small regions called picture elements or
pixels . At each pixel location the image brightness is sample and quantized. This step
generates an integer at each pixel representing the brightness or darkness of the image at
that point.
When this has been done for all pixels the image is represented by rectangular
array of integers. Each location has allocation or address, and an integer value called
gray level. This array digital data is now candidate for computer processing.
39

9.1 APPLICATIONS OF DIGITAL IMAGE PROCESSING

Office automation: optical character recognition; document processing cursive


script recognition; logo and icon recognition; etc.

Industrial automation: automation inspection system; non destructive testing;


automatic assembling; process related to VLSI manufacturing; PCB checking;
etc.

Robotics: Oil and natural gas exploration; etc

Bio-medical: ECG, EEG, EMG analysis; cytological, histological and


stereological applications; automated radiology and pathology; x-ray image
analysis; etc

Remote sensing: natural resources survey and management; estimation related to


agriculture, hydrology forestry, mineralogy; urban planning; environment control
and pollution control; etc

Criminology: finger print identification; human face registration and matching;


forensic investigation; etc.

Astronomy and space applications: restoration of images suffering from


geometric and photometric distortions; etc.

Information technology: facsimiles image transmission, video text; Video


conferencing and video phones; etc.

Entertainment and consumer electronics: HDVT; multimedia and video


editing.

Military applications: missile guidance and detection; target identification;


navigation of pilot less vehicle; reconnaissance; and range finding; etc.

Printing and graphics art: color fidelity in desktop publishing; art conservation
and dissemination; etc.

9.2 IMAGE COMPRESSION


40

Image Compression is a technology for reducing the quantity of data used to


represent any content without excessively reducing the quality of the picture. It also
reduces the number of bits required to store and/or transmit digital media. Compression is
a technique that makes storing easier for large amount of data.

9.3 PRINCIPLES OF IMAGE COMPRESSION


An ordinary characteristic of most images is that the neighboring pixels are
correlated and therefore hold redundant information. The foremost task then is to find out
less correlated representation of the image. Two elementary components of compression
are redundancy and irrelevancy reduction.
Redundancy reduction aims at removing duplication from the signal source
image. Irrelevancy reduction omits parts of the signal that is not noticed by the signal
receiver, namely the Human Visual System (HVS).
In general, three types of redundancy can be identified:
1. Spatial Redundancy or correlation between neighboring pixel values,
2. Spectral Redundancy or correlation between different color planes or spectral
bands and
3. Temporal Redundancy or correlation between adjacent frames in a sequence of
images especially in video applications.
Image compression research aims at reducing the number of bits needed to
represent an image by removing the spatial and spectral redundancies as much as
possible.

41

Figure.9.1: Coding

Figure.9.2: Spatial

Redundancy

Figure.9.3: Irrelevant

Redundancy

Information

9.4 NEED OF COMPRESSION


The figures in Table1 show the qualitative transition from simple text to full
motion video data and the disk space needed to store such uncompressed data
Multimedia
Data

Size/Duration

Bits/Pixel
or
Bits/Sample

Uncompressed

A page of
text

11'' x 8.5''

Varying
resolution

16-32Kbits

Telephone
quality
speech

1 sec

8bps

64Kbits

8bpp

Size

Gray scale
Image

512 x 512

Color
Image

512 x 512

Medical
Image

2048 x 1680

12 bpp

41.3Mbits

SHD Image

2048 x 2048

24 bpp

100Mbits

Full-motion
Video

640 x 480,
10sec

24 bpp

24 bpp

2.1Mbits
6.29Mbits

2.21Gbits

Table 9.1: Multimedia data types and uncompressed storage space required

42

The examples above clearly illustrate the need for large storage space for digital
image, audio, and video data. So, at the present state of technology, the only solution is to
compress these multimedia data before its storage and transmission, and decompress it at
the receiver for play back.

9.5 FRAMEWORK OF GENERAL IMAGE COMPRESSION


METHOD
A typical lossy image compression system is shown in Fig. 3. It consists of three
closely

connected

components namely
(a)

Source Encoder (b)


Quantizer and (c)
Entropy

Encoder.

Compression
achieved

is
by

applying a linear transform in order to decorrela the image data, quantizing the resulting
transform coefficients and entropy coding the quantized values.

Figure.9.4: A Typical Lossy Image Encoder

9.5.1 Source Encoder (Linear Transformer)

43

A variety of linear transforms have been developed which include Discrete


Fourier Transform (DFT), Discrete Cosine Transform (DCT), Discrete Wavelet
Transform (DWT) and many more, each with its own advantages and disadvantages.

9.5.2 Quantizer
A quantizer is used to reduce the number of bits needed to store the transformed
coefficients by reducing the precision of those values. As it is a many-to-one mapping, it
is a lossy process and is the main source of compression in an encoder. Quantization can
be performed on each individual coefficient, which is called Scalar Quantization (SQ).
Quantization can also be applied on a group of coefficients together known as Vector
Quantization (VQ). Both uniform and non-uniform quantizers can be used depending on
the problems.
9.5.3 Entropy Encoder
An entropy encoder supplementary compresses the quantized values losslessly to
provide a better overall compression. It uses a model to perfectly determine the
probabilities for each quantized value and produces an appropriate code based on these
probabilities so that the resultant output code stream is smaller than the input stream. The
most commonly used entropy encoders are the Huffman encoder and the arithmetic
encoder, although for applications requiring fast execution, simple Run Length Encoding
(RLE) is very effective. It is important to note that a properly designed quantizer and
entropy encoder are absolutely necessary along with optimum signal transformation to
get the best possible compression.

9.6 TYPES OF COMPRESSION

Lossless vs. Lossy compression

There are different ways of classifying compression techniques. Two of these would be
mentioned here. The first categorization is based on the information content of the
reconstructed image. They are 'lossless compression' and 'lossy compression schemes. In
lossless compression, the reconstructed image after compression is numerically identical
44

to the original image on a pixel by-pixel basis. However, only a modest amount of
compression is achievable in this technique. In lossy compression on the other hand, the
reconstructed image contains degradation relative to the original, because redundant
information is discarded during compression. As a result, much higher compression is
achievable, and under normal viewing conditions, no visible loss is perceived (visually
lossless).

Predictive vs. Transform coding


The second categorization of various coding schemes is based on the 'space'

where the compression method is applied. These are 'predictive coding' and 'transform
coding'. In predictive coding, information already sent or available is used to predict
future values, and the difference is coded. Since this is done in the image or spatial
domain, it is relatively simple to implement and is readily adapted to local image
characteristics. Differential Pulse Code Modulation (DPCM) is one particular example of
predictive coding.
Transform coding, also called block quantization, is an alternative to predictive
coding. A block of data is unitarily transformed so that a large fraction of its total energy
is packed in relatively few transform coefficients, which are quantized independently the
optimum transform coder is defined as one that minimizes the mean square distortion of
the reproduced data for a given number of total bits. Transform coding, on the other hand,
first transforms the image from its spatial domain representation to a different type of
representation using some well-known transforms mentioned later, and then codes the
transformed values (coefficients). The primary advantage is that, it provides greater data
compression compared to predictive methods, although at the expense of greater
computations.

9.7 OBJECTIVE
This process aims to study and understand the general operations used to
compress a two dimensional gray scale images and to develop an application that allows
the compression and reconstruction to be carried out on the images. The application
developed aims to achieve:
45

1. Minimum distortion
2. High compression ratio
3. Fast compression time
To compress an image the operations include linear transform, quantization and
entropy encoding. The thesis will study the wavelet and cosine transformation and
discuss the superior features that it has over Fourier transform. This helps to know how
quantization reduces the volume of an image data before packing them efficiently in the
entropy coding operation. To reconstruct the image, an inverse operation is performed at
every stage of the system in the reverse order of the image decomposition.

9.8 DATA COMPRESSION VERSUS BANDWIDTH


The mere processing of converting an analog signal into digital signal results in
increased bandwidth requirements for transmission. For example a 5 MHz television
signal sampled at nyquist rate with 8 bits per sample would require a bandwidth of 40
MHz when transmitted using a digital modulation scheme

9.9 DATA REDUNDANCY


Data redundancy is the central issue in digital image compression. It is a
mathematically quantifiable entity.
If n1 and n2 represent the number of information carrying units in two data sets
that represent the same information, the relative data redundancy Rd of the first data set
can be defined as
Rd=1-1/Cr
Where Cr, commonly called the compression ratio, is
Cr=n1/n2
For the case n2=n1, Cr=1 and Rd=0 indicating that the first representation
contains no redundant data.
When n2<<n1, Cr>infinite and Rd>1 implying significant compression and
highly redundant data.
In other case n2>>n1, Cr>0 and Rd>infinite, indicates that the second data set
contains much more data than the original representation.
46

9.10 COMPRESSION RATIO


The degree of data reduction as a result of the compression process is known as
compression ratio. The ratio measures the quantity of compressed data.
Compression ratio (C.R) =

Length of original data string


Length of compressed data string

Increase of C>R causes more efficient the compression technique employed and vice
versa.

9.11 APPLICATIONS OF IMAGE COMPRESSION


The many benefits of image compression include less required storage space, quicker
sending and receiving of images, and less time lost on image viewing and loading.

Telecommunication Industries
Just as image compression has increased the efficiency of sharing and viewing

personal images, it offers the same benefits to just about every industry in existence.
Early evidence of image compression suggests that this technique was, in the beginning,
most commonly used in the printing, data storage, and telecommunications industries.
Today however, the digital form of image compression is also being put to work in
industries such as fax transmission, satellite remote sensing, and high definition
television, to name but a few.

Health Industry
In certain industries, the archiving of large numbers of images is required. A good

example is the health industry, where the constant scanning and/or storage of medical
images and documents take place. Image compression offers many benefits here, as
information can be stored without placing large loads on system servers. Depending on
the type of compression applied, images can be compressed to save storage space, or to
send to multiple physicians for examination. And conveniently, these images can

47

uncompress when they are ready to be viewed, retaining the original high quality and
detail that medical imagery demands.

Federal Government Agency


Image compression is also useful to any organization that requires the viewing

and storing of images to be standardized, such as a chain of retail stores or a federal


government agency. In the retail store example, the introduction and placement of new
products or the removal of discontinued items can be much more easily completed when
all employees receive, view and process images in the same way. Federal government
agencies that standardize their image viewing, storage and transmitting processes can
eliminate large amounts of time spent in explanation and problem solving. The time they
save can then be applied to issues within the organization, such as the improvement of
government and employee programs.

Security Industry
In the security industry, image compression can greatly increase the efficiency of

recording, processing and storage. However, in this application it is imperative to


determine whether one compression standard will benefit all areas. For example, in a
video networking or closed-circuit television application, several images at different
frame rates may be required. Time is also a consideration, as different areas may need to
be recorded for various lengths of time. Image resolution and quality also become
considerations, as does network bandwidth, and the overall security of the system.

Museums and galleries


Museums and galleries consider the quality of reproductions to be of the utmost

importance. Image compression, therefore, can be very effectively applied in cases where
accurate representations of museum or gallery items are required, such as on a Web site.
Detailed images that offer short download times and easy viewing benefits all types of
visitors, from the student to the discriminating collector. Compressed images can also be
used in museum or gallery kiosks for the education of that establishments visitors. In a
library scenario, students and enthusiasts from around the world can view and enjoy a
multitude of documents and texts without having to incur traveling or lodging costs to do
so.
48

10. SIMULATION RESULTS


The steps to be followed for compressing the image are
Step1: Browse the image to be compressed
Step 2: Apply encoding process for the image to be compressed
Step 3: After encoding Decoding process has to be applied for the image
Step 4: Click on validate to know the values of compressed image that is peak signal to
noise ratio (PSNR),encoding time,decoding time,compressed ratio(CR)
Step 5:clearing the images.

49

Step1

Figure.10.1: Browsing image from files

step2

50

Figure .10.2: Encoding process

Step3
51

Figure .10.3: Decoding process

Step4

52

Figure.10.4: Validating process

Step5

53

Figure.10.5: Clearing image after compression

11.ADVANTAGES
54

DWT has a good localization property in the time


domain and frequency domain.

Number of encoding bits is less compare to existing


method

12. APPLICATIONS
55

Image compression is mainly used in Transmission Application

Compressions used in Storage Application for providing security

Image compression is mainly used in navy purposes because they uses low
bandwidth.

13. CONCLUSION
56

Image compression using Discrete wavelet Transform (DWT) produces a good


clarity image. Even though there is no loss in information the output Image looks similar
to the input image. Human eyes cannot make out the loss of information. Also DWT
reduces the memory required to store the image without altering the dimension of the
image.
DWT takes the advantage of redundancies in the data by grouping pixels with
similar frequencies together and more over if we observe as the resolution of the image is
very high even after sufficient compression and decompression there is very less change
in the original and decompressed image. Thus we can also conclude that at the same
compression ratio the difference between the original and decompressed image goes on
decreasing as there is increase in image resolution

14. FUTURE SCOPE

57

In the future, efficient utilization of image processing capabilities in the service of


plastic surgery will be achieved by the emerging capabilities for many complicated
procedures. These include huge image data base processing, automatic detection of
pathologic cases by enhancement of details and recognition of patterns, accurate
measurements of the changes and distortions in the processed images, prediction of
results to allow planning of treatment, simulation, and training on computerized cases.

BIBLIOGRAPHY
58

Yushin Cho, W. A. Pearlman Low complexity resolution progressive image


coding algorithm: PROGRES (Progressive Resolution Decompression), in Proc.
IEEE International Conference on Image Processing, September 2005.

J. Oliver, M. P. Malumbres, Fast and efficient spatial scalable image compression


using wavelet lower trees, in Proc. IEEE Data Compression Conference,
Snowbird, UT, March 2003.

C. Chrysafis, A. Said, A. Drukarev, A. Islam, W. A. Pearlman, SBHP- A low


complexity wavelet coder, in Proc. IEEE Int. Conference on Acoustics, Speech,
and Signal Processing, 2000.

Websites

The Mathworks (company that release Mat lab) documentation website:


http://www.mathworks.com/access/helpdesk/help/helpdesk.shtml

Mat lab Help Desk online:


http://www-ccs.ucsd.edu/matlab/

http://www.jpeg.org

http://cnx.rice.edu

http://www.datacompression.info

http://www.cs.sfu.ca

http://www.wikipedia.org

APPENDIX
59

function varargout = GUIFINAL(varargin)


% GUIFINAL M-file for GUIFINAL.fig
%
GUIFINAL, by itself, creates a new GUIFINAL or raises the existing
%
singleton*.
%
%
H = GUIFINAL returns the handle to a new GUIFINAL or the handle to

%
the existing singleton*.
%
%
GUIFINAL('CALLBACK',hObject,eventData,handles,...) calls the local
%
function named CALLBACK in GUIFINAL.M with the given input arguments.
%
%
GUIFINAL('Property','Value',...) creates a new GUIFINAL or raises the
%
existing singleton*. Starting from the left, property value pairs are
%
applied to the GUI before GUIFINAL_OpeningFunction gets called. An
%
unrecognized property name or invalid value makes property application
%
stop. All inputs are passed to GUIFINAL_OpeningFcn via varargin.
%
%
*See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
%
instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help GUIFINAL
% Last Modified by GUIDE v2.5 06-Feb-2014 10:38:44
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',
mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @GUIFINAL_OpeningFcn, ...
'gui_OutputFcn', @GUIFINAL_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin & isstr(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
60

% End initialization code - DO NOT EDIT


% --- Executes just before GUIFINAL is made visible.
function GUIFINAL_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to GUIFINAL (see VARARGIN)
% Choose default command line output for GUIFINAL
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes GUIFINAL wait for user response (see UIRESUME)
% uiwait(handles.figure1);
a=ones(256,256);
axes(handles.one);
imshow(a);
b=ones(256,256);
axes(handles.two);
imshow(b);
% --- Outputs from this function are returned to the command line.
function varargout = GUIFINAL_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes on button press in Browse.
function Browse_Callback(hObject, eventdata, handles)
% hObject handle to Browse (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[filename, b] = uigetfile('*.*', 'Pick an Image');
if isequal(filename,0) | isequal(b,0)
61

warndlg('User pressed cancel')


else
a=imread(filename);
[row col plane]=size(a);
if (row>450)
a=imresize(a,[512 512]);
else
a=imresize(a,[256 256]);
end
[r c p]=size(a);
if p==3
a=rgb2gray(a);
end
axes(handles.one);
imshow(a,[]);
title('Original Image');
handles.filename=a;
% Update handles structure
guidata(hObject, handles);
end
% --- Executes on button press in Encoding.
function Encoding_Callback(hObject, eventdata, handles)
% hObject handle to Encoding (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
a = handles.filename;
global true;
global false;
true = 1;
false = 0;
% % parameters
bitbudget = 1000000;
% X = imread(filename);
sX = size(a);
% set wavelet filter to haar as it is the simplest
filter = 'haar';
62

% record start time


tic;
% perform single-level decomposition of X.
[cA1,cH1,cV1,cD1] = dwt2(a, filter);
% record wavelet transform time and output
dwttime = toc;
fprintf('\nDWT time: %6.3f seconds\n', dwttime);
% put it into the tree structure
dec2d = [...
cA1, cH1; ...
cV1, cD1
...
];
axes(handles.two);
imshow(dec2d,[]);
title('Transformed Image');
% round all coefficients
% bits1=2;
% dec2d = round(dec2d);
% dec2d=quant1(dec2d,bits1);
% reset start time
tic;
% perform SPIHT compression where encoded contains output and bits contains
% the amount of bits used.
[encoded bits] = cSPIHT(dec2d, 1, bitbudget);
% record cSPIHT time and output
enc_time = toc;
fprintf('Encoding time: %6.3f seconds\n',enc_time);
save enc_time enc_time;
save encoded encoded
save bits bits
save sX
warndlg('Encoding Process Completed');

63

% --- Executes on button press in Decoding.


function Decoding_Callback(hObject, eventdata, handles)
% hObject handle to Decoding (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
if ~exist ('encoded.mat')
msgbox ('start encoding first');
else
X=handles.filename;
% X=imread(filename);
load encoded
load bits
load sX
tic;
filter='haar';
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%
% perform inverse
[decoded level] = dSPIHT(encoded, bits);
nobits =bits;
% record cSPIHT time and output
dec_time= toc;
save dec_time dec_time;
fprintf('Decoding time: %6.3f seconds\n', dec_time);
% decoded=iquant1(decoded,bits1);
% put it back into the form wanted by idwt2
cA1 = decoded(1:(sX(1)/2), 1:(sX(1)/2));
cH1 = decoded(1:(sX(1)/2), (sX(1)/2 + 1):sX(1));
cV1 = decoded((sX(1)/2 + 1):sX(1), 1:(sX(1)/2));
cD1 = decoded((sX(1)/2 + 1):sX(1), (sX(1)/2 + 1):sX(1));
% cD1 = zeros(1,4096);
% cD1 = reshape(cH1,[64 64]);
% reset start time
tic;
% reconstruct image from wavelet coefficients
dec = idwt2(cA1,cH1,cV1,cD1,filter);
warndlg('Decoding Process Completed');
64

% calculate Mean Square Error and PSNR


dec=double(dec);
X=double(X);
axes(handles.two);
imshow(dec,[]);
title('reconstructed image');
figure,
subplot(1,2,1);imshow(X,[]);
title('original image');
subplot(1,2,2);imshow(dec,[]);
title('reconstructed image');
n=size(X);
M=n(1);
N=n(2);
InputFILESIZE = M * N *8;
CR = InputFILESIZE / nobits ;
MSE = sum(sum((X-dec).^2))/(M*N);
% MSE = sum(sum((X-dec).^2))/(size(X,1))/(size(X,2));
PSNR = 10*log10(255*255/MSE);
PSNR=num2str(PSNR);
CR=num2str(CR);
save PSNR PSNR;
save CR CR;
disp('PSNR');
disp(PSNR);
disp('MSE');
disp(MSE);

end
% --- Executes during object creation, after setting all properties.
function popupmenu1_CreateFcn(hObject, eventdata, handles)
% hObject handle to popupmenu1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
%
See ISPC and COMPUTER.
if ispc
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
65

% --- Executes on selection change in popupmenu1.


function popupmenu1_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns popupmenu1 contents as cell array
%
contents{get(hObject,'Value')} returns selected item from popupmenu1
% --- Executes during object creation, after setting all properties.
function psnr1_CreateFcn(hObject, eventdata, handles)
% hObject handle to psnr1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
%
See ISPC and COMPUTER.
if ispc
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end

function psnr1_Callback(hObject, eventdata, handles)


% hObject handle to psnr1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of psnr1 as text
%
str2double(get(hObject,'String')) returns contents of psnr1 as a double
% --- Executes during object creation, after setting all properties.
function cr1_CreateFcn(hObject, eventdata, handles)
% hObject handle to cr1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
%
See ISPC and COMPUTER.
if ispc
set(hObject,'BackgroundColor','white');
66

else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end

function cr1_Callback(hObject, eventdata, handles)


% hObject handle to cr1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of cr1 as text
%
str2double(get(hObject,'String')) returns contents of cr1 as a double
% --- Executes on button press in Clear.
function Clear_Callback(hObject, eventdata, handles)
% hObject handle to Clear (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
delete *.mat
PSNR = 0;
CR=0;
enc_time=0;
dec_time=0;
a=ones(256,256);
axes(handles.one);
imshow(a);
axes(handles.two);
imshow(a);
set(handles.enc,'String',enc_time);
set(handles.dec,'String',dec_time);
PSNR=num2str(PSNR);
CR=num2str(CR);
set(handles.psnr1,'String',PSNR);
set(handles.cr1,'String',CR);
warndlg('Files erased succesfully');
% --- Executes on button press in Exit.
function Exit_Callback(hObject, eventdata, handles)
% hObject handle to Exit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
67

close GUIFINAL;
% --- Executes on button press in validate.
function validate_Callback(hObject, eventdata, handles)
% hObject handle to validate (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
load PSNR;
load CR;
load enc_time;
load dec_time;
set(handles.enc,'String',enc_time);
set(handles.dec,'String',dec_time);
set(handles.psnr1,'String',PSNR);
set(handles.cr1,'String',CR);
% --- Executes during object creation, after setting all properties.
function enc_CreateFcn(hObject, eventdata, handles)
% hObject handle to enc (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
%
See ISPC and COMPUTER.
if ispc
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end

function enc_Callback(hObject, eventdata, handles)


% hObject handle to enc (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of enc as text
%
str2double(get(hObject,'String')) returns contents of enc as a double
% --- Executes during object creation, after setting all properties.
function dec_CreateFcn(hObject, eventdata, handles)
% hObject handle to dec (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
68

% Hint: edit controls usually have a white background on Windows.


%
See ISPC and COMPUTER.
if ispc
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end

function dec_Callback(hObject, eventdata, handles)


% hObject handle to dec (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of dec as text
%
str2double(get(hObject,'String')) returns contents of dec as a double
% --- Executes during object creation, after setting all properties.
function PSNR_CreateFcn(hObject, eventdata, handles)
% hObject handle to PSNR (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

69

Das könnte Ihnen auch gefallen