MATLAB Based Image Compression Technology Lu Jinhua (Shanxi Fenxi Coal advanced technical schools) Abstract This paper describes research in image compression MATLAB application of BP artificial neural network-based image compression The MATLAB implementation and wavelet-based image compression technology. MATLAB software uses MATLAB R2007a version, and through the After a computer experiment proved that wavelet transform and BP neural

haremboingAI and Robotics

Oct 20, 2013 (4 years and 8 months ago)


MATLAB Based Image Compression Technology

Lu Jinhua

(Shanxi Fenxi Coal advanced technical schools)

Abstract This paper describes research in image compression MATLAB
application of BP artificial neural network
based image compression

The MATLAB imple
mentation and wavelet
based image compression
technology. MATLAB software uses MATLAB R2007a version, and through the

After a computer experiment proved that wavelet transform and BP neural
network encoding and decoding of images to achieve high compressi
on ratio
can be guaranteed under very

Good image quality, with good visual effects.

Key words MATLAB R2007a; image compression; wavelet transform; BP
neural network

CLC number: TD679 Abstract: A Article ID :1672
0652 (2008) 12

Digital image inf
ormation to make electronic and information technology
sector's most

Major problem is the huge amount of data storage and transmission problems,
image data compression

Reduction technology is the key to solving the problem. As the image data are
often ex

All kinds of information redundancy, such as spatial redundancy, information
entropy redundancy, visual redundancy

And structural redundancy, and therefore can be said that image compression
is to remove the map

Like the various redundant to retain

useful information for the process ¨ J.

MATLAB is introduced by the United States for the Math Works Inc.

Numerical computing and graphics processing in scientific computing software,
which combines numerical sub

Analysis, matrix calculations, signal

processing and graphical display a variety
of functions in one.

In March 2007, Math Works Inc. MATLAB launched

R2007a version of the latest products, this version adds a lot of new power

Be able to, basically a lot of typical applications include the c
urrent number of
graphics processing

Li. The neural network toolbox in MATLAB provides a lot of use

In the image processing functions.
MATLAB R2007a in the wavelet tools

Box (Wavelet Toolbox 3.0) in the letter that contains a variety of wavelet

Number, can be used to signal and image compression processing,
compression can maintain

Signal and image features remain basically unchanged, compression is high
and compression speed,

And in the transfer process that has anti
jamming capability. This

discusses the application of

MATLAB neural network toolbox in the BP function and wavelet tools

Box (Wavelet Toolbox 3.0) function is the principle of image compression,

And examples of its implementation method is given and the corresponding

One based on BP artificial neural network image compression principle

BP network is currently the most commonly used an artificial neural network

Type, it can directly provide data compression capability. Using multilayer
feedforward netw

Network model transformation capabilities for data transformation (encoding)
the basic idea of

Is: to a group of input patterns by a small number of hidden layer unit is
mapped to a

Output mode, and to output mode is equal to input mode as much as


Than the number of hidden layer unit came from a number of input mode, it
means that the hidden layer

Better performance in input mode, and to transmit to the output of this

Layer, output layer nodes and input nodes is the sa
me. Study, the graph

Like the data sent to both the input layer, but also sent to the output layer as a
teacher signal,

The learning algorithm used in network training algorithm is good after the
input layer to the

Hidden layer network coding process, t
he image data, linear or

linear transformation, from the hidden layer to output layer for the network
decoding process,

Pairs of compressed transform coefficients after the linear or nonlinear inverse

Change to restore the image of the origin
al data.

Considered for study are N × N image pixel points, each pixel

Gray value is quantified as m Bit (a total of 2m possible values). 2m

A gray
scale by a linear relationship into a value between 0 and 1 as the

The input and desired output
(teacher mode). Network randomly drawn each

nxn image block (after [0,1] interval of the transformation) as a learning model

Type, with the BP learning algorithm.
By adjusting the neural network of the

Connection weights, so that the training s
et the image reconstruction error E =.
Plant 1 g, mean

To a minimum.
Trained network hidden layer neuron vector (after

Quantitative) is the result of data compression, while the output neurons is the

Reconstruction of data.

2 Based on BP artifici
al neural network implementation
of image compression

With the basic BP network for image compression is divided into two bands

Section: Training and coding.
The first phase, the sample image data set as a

Signal input and teacher training BP network; s
econd stage: entropy series

Yards. Using BP artificial neural network image compression steps, such as


A) Training sample structure.
To an image pixel for all

For the compression network input should be properly control the size of the
, therefore, the first

First division of the image.
Compressed image to be set up by the N × N pixels

Point of composition, be divided into M sub
image blocks, each sub
block are

By P × P sub
pixel block constituted.
Here to 128 × 128 of

The imag
e pixel matrix is divided into 4 × 4 sub
pixel block matrix as an
example to illustrate the

The generation of training samples.

[32] 44

[64] 44

i; 0 i

0 i

[993] [994]

[1024]. 4 x4

= [[1] 4 X4, [2]

, [1024]]. ]

By the above method to generate t
he pixel block matrix must also be

A treatment, this paper is the mean of the distribution of pre
treatment; pending

Like the gray range [,], transform domain [Y, y], so that

The current gray value of pixels to be processed as follows:, t
hen the map Y is:

: Dan Zhu Tang. = +

, M f

m I



. m m

type the original image pixel value is designated to the [0,1] range

In doing so, constitutes all the pretreatment process of training samples.

2) Create a neural network. Samples of
the image data set as input

And teacher training BP network signals, BP network image compression bit

Rate is defined as:

Bit Rate: (6, such as / pi, ez)

l "tL

Here the input image is divided into an n
dimensional vector, and f,

H on beh
alf of encoding a number of bits needed and encoding a coupling

(Ie, W: and b ') the number of bits required, k is the hidden layer neurons of the


Image data compression ratio = input layer node / hidden layer nodes.

After a good n
eural network training, network coupling weights in this pressure

Reduction process remains unchanged. Newff function in MATLAB, is used

Create back
propagation network.

3) The neural network training. Used to build an input matrix,

Each column represe
nts an input model, with the input matrix as a target

Matrix, began training the network. The training process can be used in a
different school

Learning algorithm. In the MATI AB function is realized using train neural


4) enco
ding simulation. Algorithm with a given training network, and then

True. If the hidden layer neurons to K, then the network hidden layer generate

× 1024 matrix, between the hidden layer and output layer produce the 16 × K

Weight matrix, the
output layer produces the threshold 16 × 1 vector,
respectively, of the imitation

True results are entropy coded. MATLAB using sire function implementation of

Neural network simulation.

5) The image reconstruction.
Right entropy encoded bit stream t
o decode

Be the hidden layer output hj and weight (with b), substituting into the formula

Out the network output Y, which is a 16 × 1024 matrix, each matrix

Elements were multiplied by 255, to each pixel value from [0,1] restored to [0,

255], then each

column to the quantitative formation of the image block, all

Combined into a complete image, thus completing the image reconstruction ¨].

The following experiment to prove that using BP neural network image

Neural networ
k input nodes as the l6, respectively, the hidden layer S

For 8,4,2, representing the compression ratio of 2,4,8.
Lack of space

Procedures and operating processes omitted. The results shown in Figure 1

Figure 1 Original image and compressed reconst
ructed image

Effect from the
reconstructed image can be seen, when the number of hidden layer neurons

Less (S = 2), the compression is relatively high, but the reconstructed image
quality than the

Poor, so simulation process, by increasing the God of the

hidden layer

After a few yuan to improve the reconstructed image quality.

3 Wavelet
based image compression

Wavelet decomposition method is a window size (ie, the window area) solid

Fixed, but its shape can change, time window and frequency window c
an be
asked to change the time

Frequency localization analysis method, namely, low
frequency part of the
high frequency sub

Identified rate and a lower time resolution, in the high
frequency part of the
high time

Between the resolution and lower frequ
ency resolution, it is called "math

Mirror. "It is this feature, so that wavelet transform has the right signals from


Wavelet Transform for image compression The basic idea is: put the image
into the

The multi

decomposition, broken down into. Different space,
different frequency sub

Like, and then pairs the image coefficients are encoded. Coefficient of wavelet
encoding is

Transform core for image compression, compression coefficient of the
substance is

the amount of

Of compression. Image is generated after the wavelet transform of the number
of wavelet image

According to the original image data on the total amount equal to the wavelet
transform itself

Does not have compression. The reason to use it f
or image compression,

The resulting wavelet image has different characteristics with the original
image, shown in Figure

Like the energy concentrated in the low
frequency part, while the horizontal,
vertical and diagonal

Line part of the energy
is less; horizontal, vertical and diagonal part of the
characterization of

The original image in the horizontal, vertical and diagonal part of the edge
information, with

A clear direction of features. Brightness of the image can be called
frequency p
art of the water

Flat, vertical and diagonal part of the details of the image can be called.

Wavelet multi
resolution analysis process will be through an image into

Approximation and details of two parts, the details of the corresponding
scale tra
nsient, it

In this scales very stable. Therefore, the details stored on the approximation

Part of the next scale, break it down, repeat the process can be.

Application of MATLAB wavelet toolbox for image compression, there are two


1) Use wave
dec2 function of the image wavelet decomposition, then

With appcodf2 function decomposition image reconstruction, and finally

wcodemat function quantization coding, to get results images (procedures and

Running omitted). The results of operations shown
in Figure 2.

Figure 2 Wavelet image compression based on the results of

Here you can see, the first extract the original image compression

Wavelet decomposition of the first layer of low
frequency information, this time
a better compression, pressure

eduction is relatively small (about 1 / 4 size). The second is to extract the first

Layer decomposition of low
frequency part of the low
frequency part (ie the
second layer of the low
frequency Division

Points), compressed relatively large (a
bout 1 / 12), compression in the visual

Also can be basically. As the decomposition level increases, the compression
ratio is decreasing


Above the low
frequency information to preserve the original image
compression method is only

One of the most
simple compression methods, which eliminate the need for
other treatment can be

Get better compression results. For the above example can also be extracted

Wavelet decomposition of the third and fourth floor of the low
information. In theo

Availability of any compression ratio of the compressed image. In the
compression ratio and image

Have high quality requirements, as other coding method.

2) the use of wavelet toolbox in the exclusive function of the threshold value of
compressed im

wdencmp for a given image compression. First, applications are given

Function wdencmp compression efficiency, that is, decomposition coefficient
set 0

Number of coefficients and retention of the percentage of the energy
percentage (procedures and op

Process omitted).
The results of operations shown in Figure 3.

4 Conclusion

MATLAB softwares were introduced to obtain the majority of users on the

Gaze, with the version of the continuous improvement of functions more and
more powerful,
especially the

March 2007 launch of MATLAB R2007a an increase of 350

New features, easy to use, easy to learn.
The calculation of the user from the

And programming freed. Therefore, the use of MATLAB software can be a

In order to achieve a mu
ltiplier effect.
This article is in the use of MATLAB

Based on the convenience of the application of BP neural network toolbox
functions and small

Wave function is easily achieved toolbox image compression, and has gone
through real

Verify Ming, compress
ion and can be better guaranteed than high image

Received Date 2008


[1] Ai
Ling Wang, Ye
sheng, Deng Qiuxiang.
MATLAB R2007 image
processing technology and application [M].
Beijing: Electronic Industry Press.

[2] Li Yong.








; BP