IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

Preview:

Citation preview

VISVESVARAYA TECHNOLOGICAL UNIVERSITY

Jnana Sangama, Belgaum, Karnataka-590 014

A FINAL YEAR PROJECT REPORT ON

“Implementation of Fractal Image Compression with GUI” SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENT FOR THE

AWARD OF DEGREE OF

BACHELOR OF ENGINEERING

IN

ELECTRONICS AND COMMUNICATION ENGINEERING

2018-2019

Submitted by

SNEHA S-1NH15EC108

THANUJA A-1NH15EC119

SREE RENUKAKSHITHA JM-1NH15EC112

Internal Guide

Prof. Mr. Karthik CV

Assistant Professor. Department of Electronics and Communication Engineering

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

2 | P a g e

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

CERTIFICATE

It is certified that the Project work entitled “Implementation of Fractal Image Compression

with GUI” carried out by SNEHA S (1NH15EC108),THANUJA A (1NH15EC119) and SREE

RENUKAKSHITHA JM (1NH15EC112), we the bonafide students of New Horizon College of

Engineering, Bengaluru, in partial fulfillment for the award of Bachelor of Engineering in

Electronics and Communication Engineering of the Visvesvaraya Technological University,

Belgaum during the year 2018-2019.It is further certified that all corrections/suggestions

indicated for internal assessment has been incorporated in the report deposited in the

department library. The Project Report has been approved as it satisfies the academic

requirements in respect of Project Work prescribed for the Bachelor of Engineering degree.

Signature of the Guide Signature of the HOD Signature of the Principal Mr.Karthik CV Dr. SANJEEV SHARMA Dr. MANJUNATHA Asst.Prof. Prof. and HOD-ECE Principal

Dept. of Electronics and Communication Engineering..

Dept. of Electronics and Communication Engineering.

NHCE

EExxtteerrnnaall VViivvaa EExxaammiinneerr SSiiggnnaattuurree wwiitthh ddaattee::

11..

22..

DECLARATION

We, SNEHA S (1NH15EC108) , THANUJA A (1NH15EC119) , SREE RENUKAKSHITHA JM

(1NH15EC112) students of 8th semester in Electronics and Communication Engineering ,

New Horizon College of Engineering, Bengaluru hereby declare that the project work

entitled “IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI “ submitted to

VISVESVARAYA TECHNOLOGICAL UNIVERSITY during the academic year 2018-2019 , is a

record of an original work done by us under the guidance of Mr.KARTHIK CV , Assistant

Professor, Department of Electronics and Communication , New Horizon College of

Engineering, Bengaluru . This project work is submitted in partial fulfillment of the

requirement for the award of the degree of Bachelor of Engineering in Electronics and

Communication. The result embodied in the thesis has not been submitted to any other

University or Institute for the award of any degree.

PLACE: BENGALURU

DATE:

SNEHA S THANUJA A SREE RENUKAKSHITHA JM

1NH15EC108 1NH15EC119 1NH15EC112

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

4 | P a g e

ACKNOWLEDGEMENTS

The satisfaction and exhilaration that accompany the successful completion of any task

would be incomplete without the mention of people who made it possible, whose

consistent guidance and encouragement crowned our efforts with success.

We consider it as our privilege to express gratitude to all those who guided us in the

completion of our project work.

First and foremost,we wish to express our profound gratitude to our respected Chairman

Dr. Mohan Manghnani,New Horizon College of Engineering,Bengaluru for giving us this

opportunity.

We wish to express our genuine gratitude to our Principal Dr. Manjunatha,New Horizon

College of Engineering,Bengaluru,for providing us with the congenial environment to work

in.

We would like to express our sincere thanks to Dr.Sanjeev Sharma,the HOD of Electronics

and Communication, New Horizon College of Engineering,for his continuous support and

encouragement.

We are greatly indebted to our guide Mr.Karthik CV,Assistant Professor, Department of

Electronics and Communication, New Horizon College of Engineering,who took great

interest in our project work.He motivated and guided us throughout the accomplishment of

this goal.We express our profound thanks for his meticulous guidance.

Last but not the least,heartfelt thanks to our parents and friends for direct and indirect

support.

Above all,we thank the Lord Almighty for his grace on us to succeed in this endeavor.

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

5 | P a g e

ABSTRACT

Fractal image compression is a lossy compression method for digital images based

on fractals rather than pixels,which are best suited for textures and natural images,it works

on self-similarity property in various fractions of images,relying on the fact that parts of an

image often ressemble other parts of the same image.It takes long encoding time and

affects the image quality.

This code introduces an improved model integrating quantized quad trees and

Huffman coding used for fractal image compression.Quantized quad tree method divides

the quantized original gray level and color image into various blocks depending on a

threshold value besides the properties of the features presented in image.Huffman coding

is applied for improving compression quality.Simulation results shows that the quantized

quad trees and Huffman coding improved compression ratio and quality derived from the

fractal image compression with range block.Different quantitative measures can be found

by passing images of different format and dimensions.

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

6 | P a g e

TABLE OF CONTENTS

CHAPTER 1

INTRODUCTION

1.1 OVERVIEW……………………………………………………………………….…………………………………9-10

1.1.1 COMPARISON OF LOSSY AND LOSSLESS METHODS………………………………10-11

1.1.2 COMPRESSION OF DIFFERENT IMAGE COMPRESSION FORMATS…………12-16

1.1.3 PURPOSE OF IMAGE COMPRESSION…………………………………………………….16

1.1.4 APPLICATIONS OF IMAGE COMPRESSION…………………………………………….17-18

CHAPTER 2

FRACTAL IMAGE COMPRESSION

2.1 ORIGIN OF FRACTAL IMAGE COMPRESSION……………………………………………………..19

2.2 INTRODUCTION………………………………………………………………………………………………..20

2.3 BASICS OF FRACTAL IMAGE COMPRESSION………………………………………………………20-21

2.3.1 FRACTALS-A BRIEF INTRODUCTION

2.3.1 SELF-SIMILARITY AND SELF-AFFINITY

CHAPTER 3

LITERATURE SURVEY

CHAPTER 4

SOFTWARE USED

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

7 | P a g e

4.1 ABOUT THE SOFTWARE

4.2 FEATURES OF MATLAB

4.3 GUI IN MATLAB

4.4 USES OF MATLAB

CHAPTER 5

METHODOLOGY

5.1 BLOCK DIAGRAM

5.2 QUADTREE PARTITIONING

5.3 HUFFMAN CODING

5.3.1 HUFFMAN ENCODING

5.3.2 HUFFMAN DECODING

CHAPTER 6

RESULTS

6.1 PERFORMANCE CHARACTERISTICS

6.2 FRACTAL IMAGE COMPRESSION OUTPUT

CHAPTER 7

CONCLUSION

CHAPTER 8

FUTURE SCOPE

REFERENCE

APPENDIX

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

8 | P a g e

LIST OF FIGURES

1.1.2(a) Image formats-BMP,TIFF LWZ,PNG and JPEG

1.1.2(b) Difference of JPEG and JPEG 2000 for color

images

4.1(a) Logo of Matlab

5.2(a) Shows an example of the quadtree

partitioning of an image

5.2(b) Shows its corresponding quadtree

5.2(c) Shows the partitioning of the Lena image

5.2(d) Is the decode image of a dog using the

quadtree algorithm.

6.2(a) Snapshot of the output screen

6.2(b) Snapshot of the results of a fractal image

6.2(c) Snapshot of the results of a fractal image of

a lotus

6.2(d)

Snapshot of the results of gray scale image

of a baboon

6.2(e) Snapshot of the results of a color image of

Lenna

6.2(f) Snapshot of the results of a satellite image

of The Earth

List of tables

6.2(a) Experimental Results

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

9 | P a g e

CHAPTER 1

INTRODUCTION

1.1 Overview

Information that can be viewed is very important for us to identify, recognize and

understand the surrounding world . An image consists of a two dimensional array of

numbers. The shade of the image whether gray or color displayed for a given image(pixel)

solely depends on the number that is stored in the array for the pixel. An image that takes

large amount of data requires more memory to store, takes longer time to be transfered,

and is difficult to process . Image compression becomes important due to the limit in the

communication bandwidth, CPU speed, time taken for transmission and size required to

store. The main aim of Image compression is to minimize the size of the image in bytes of

a graphics file by maintaining a good quality of the image. Image compression is a

challenging field in Image processing research. A common characteristic of most images is

that the neighboring pixels are correlated and therefore contain redundant information.

The foremost task then is to find less correlated representation of the image. Using the

compression algorithms, redundant bits are removed from the image so that image size is

reduced and the image is compressed. Two fundamental components of compression are

redundancy and irrelevancy reduction . It needs to represent an image by removing the

spatial and spectral redundancies as much as possible, while keeping the resolution and

visual quality of the reconstructed image as close to the original image by taking advantage

of these redundancies. An inverse process called decompression (decoding) is applied to the

compressed data to get the reconstructed image .

Image compression methods are classified into lossy and lossless compression. In

lossless compression there is no information loss; the reconstructed image is exactly the

same as the original, which is preferred for high value content, such as medical imagery or

image scans made for archival purposes, artificial images such as technical drawings, icons

or comics. Lossless compression methods include run length encoding, Huffman encoding,

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

10 | P a g e

LZW (Lempel-Ziv-Welch) coding and area coding . In lossy compression, the reconstructed

image contains degradation relative to the original because the compression scheme

completely discards redundant information. However, lossy schemes are capable of

achieving much higher compression. Under normal viewing conditions, no visible loss is

perceived (visually lossless). Lossy compression is most commonly used to compress

multimedia data like audio, video, and still images, especially in applications such as

streaming media where minor loss of fidelity is acceptable to achieve a substantial

reduction in bit rate, especially when used at low bit rates introduce compression artifacts.

Lossy compression methods include transform coding, vector quantization, fractal coding,

block truncation coding and sub-band coding . In general, higher degrees of compression

are only possible using lossy compression; therefore it has been a subject to considerable

investigation . Most used methods can be classified under lossy compression. This means

that a reconstructed picture is an approximation of the real picture . Fractal image

compression has become an important lossy technique due to its capacity of achieving high

compression ratio ,high bit rate, high reconstructed image quality and resolution

independence. Fractal image compression is to exploit self-similarities present in different

parts of the image by transformation and iterations to reduce the amount of redundancy .

The main disadvantage of fractal encoding is that it needs a lot of computation, and long

encoding time .Fractal compression research focuses on how to shorten the encoding time,

speed-up the coding phase and reduce the computational cost of exhaustive search while

still preserving a good image quality .This project proposes a combined method, trying to

decrease the encoding time without decreasing the image quality.

1.1.1 COMPARISON OF LOSSY AND LOSSLESS METHODS

Methods for lossless image compression are:

Run-length encoding – used in default method in PCX and as one of possible

in BMP, TGA, TIFF

Area image compression

DPCM and Predictive Coding

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

11 | P a g e

Entropy encoding

Adaptive dictionary algorithms such as LZW – used in GIF and TIFF

DEFLATE – used in PNG, MNG, and TIFF

Chain codes

Methods for lossy image compression are:

Reducing the color space to the most common colors in the image. The selected colors

are specified in the colour palette in the header of the compressed image. Each pixel

just references the index of a color in the color palette, this method can be combined

with dithering to avoid posterization.

Chroma subsampling. This takes advantage of the fact that the human eye perceives

spatial changes of brightness more sharply than those of color, by averaging or dropping

some of the chrominance information in the image.

Transform coding. This is the most commonly used method. In particular, a Fourier-

related transform such as the Discrete Cosine Transform (DCT) is widely used: N.

Ahmed, T. Natarajan and K.R.Rao, "Discrete Cosine Transform," IEEE Trans. Computers,

90–93, Jan. 1974. The DCT is sometimes referred to as "DCT-II" in the context of a family

of discrete cosine transforms; e.g., see discrete cosine transform. The more recently

developed wavelet transform is also used extensively, followed

by quantization and entropy coding.

Fractal image compression.

1.1.2 COMPARISON OF DIFFERENT IMAGE COMPRESSION

FORMATS

Images are very important documents nowadays; to work with them in some

applications they need to be compressed, more or less depending on the

purpose of the application. There are some algorithms that perform this

compression in different ways; some are lossless and keep the same information

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

12 | P a g e

as the original image, some others lose information while compressing the

image. Some of these compression methods are designed for specific kinds of

images, so they will not be so good for other kind of images.

Lossless image representation formats:

BMP (bitmap) is a bitmapped graphics format used internally by the Microsoft Windows

graphics subsystem (GDI), and used commonly as a simple graphics file format on that

platform. It is an uncompressed format.

PNG (Portable Network Graphics) (1996) is a bitmap image format that employs lossless

data compression. PNG was created to both improve upon and replace the GIF format with

an image file format that does not require a patent license to use. It uses the DEFLATE

compression algorithm, that uses a combination of the LZ77 algorithm and Huffman coding.

PNG supports palette based (with a palette defined in terms of the 24 bit RGB colors),

greyscale and RGB images. PNG was designed for distribution of images on the internet not

for professional graphics and as such other color spaces

Comparison with JPEG:

• JPEG has a big compressing ration, reducing the quality of the image, it is ideal for big

images and photographs.

• PNG is a lossless compression algorithm, very good for images with big areas of one

unique color, or with small variations of color.

• PNG is a better choice than JPEG for storing images that contain text, line art, or other

images with sharp transitions that do not transform well into the frequency domain.

Comparison with TIFF:

• TIFF is a complicated format that incorporates an extremely wide range of options. While

this makes it useful as a generic format for interchange between professional image editing

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

13 | P a g e

applications, it makes supporting it in more general applications such as Web browsers

difficult.

• The most common general-purpose lossless compression algorithm used with TIFF is

LZW, which is inferior to PNG and until expiration in 2003 suffered from the same patent

issues that GIF did.

TIFF (Tagged Image File Format) (last review 1992) is a file format for mainly storing images,

including photographs and line art. It is one of the most popular and flexible of the current

public domain raster file formats. Originally created by the company Aldus, jointly with

Microsoft, for use with PostScript printing, TIFF is a popular format for high color depth

images, along with JPEG and PNG. TIFF format is widely supported by image-manipulation

applications, and by scanning, faxing, word processing, optical character recognition, and

other applications.

Compression types include:

• uncompressed

• PackBits - is a fast, simple compression scheme for run-length encoding.

• Lempel-Ziv-Welch (LZW)

• CCITT Fax 3 & 4 – protocol for sending fax documents across telephone lines

• JPEG (see below)

Until recently the use of this LZW was limited because this technique was the subject of

several patents in various jurisdictions.

Sometimes CCITT encoding is referred to, not entirely accurately, as Huffman encoding.

CCITT 1-dimensional encoding is a specific type of Huffman encoding. The other types of

CCITT encodings are not, however, implementations of the Huffman scheme.

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

14 | P a g e

Lossy image compression formats:

JPEG (Joint Photographic Experts Group) (1992) is an algorithm designed to compress

images with 24 bits depth or greyscale images. It is a lossy compression algorithm. One of

the characteristics that make the algorithm very flexible is that the compression rate can be

adjusted. If we compress a lot, more information will be lost, but the result image size will

be smaller. With a smaller compression rate we obtain a better quality, but the size of the

resulting image will be bigger. This compression consists in making the coefficients in the

quantization matrix bigger when we want more compression, and smaller when we want

less compression.

The algorithm is based in two visual effects of the human visual system. First,

humans are more sensitive to the luminance than to the chrominance. Second, humans are

more sensitive to changes in homogeneous areas, than in areas where there is more

variation (higher frequencies). JPEG is the most used format for storing and transmitting

images in Internet.

JPEG 2000 (Joint Photographic Experts Group 2000) is a wavelet-based image compression

standard. It was created by the Joint Photographic Experts Group committee with the

intention of superseding their original discrete cosine transform based JPEG standard.

JPEG 2000 has higher compression ratios than JPEG. It does not suffer from the

uniform blocks, so characteristics of JPEG images with very high compression rates. But it

usually makes the image more blurred that JPEG.

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

15 | P a g e

Figure 1.1.2(a): image formats-BMP,TIFF LWZ,PNG and JPEG

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

16 | P a g e

Figure 1.1.2(b) difference of JPEG and JPEG 2000 for color images

1.1.3 PURPOSE OF IMAGE COMPRESSION

An image, 1024 pixel x 1024 pixel x 24 bit, without compression, would require 3 MB

of storage and 7 minutes for transmission, utilizing a high speed, 64 Kbit/s, ISDN line. If the

image is compressed at a 10:1 compression ratio, the storage requirement is reduced to

300 KB and the transmission time drops to under 6 seconds.

In a distributed environment large image files remain a major bottleneck within

systems. Compression is an important component of the solutions available for creating file

sizes of manageable and transmittable dimensions. Increasing the bandwidth is another

method, but the cost sometimes makes this a less attractive solution. Platform portability

and performance are important in the selection of the compression/decompression

technique to be employed. The easiest way to reduce the size of the image file is to reduce

the size of the image itself. By shrinking the size of the image, fewer pixels need to be

stored and consequently the file will take less time to load .

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

17 | P a g e

1.1.4 APPLICATIONS OF IMAGE COMPRESSION

Image compression has increased the efficiency of sharing and viewing personal

images, it offers the same benefits to just about every industry in existence. Image

compression was most commonly used in the data storage, printing and telecommunication

industry. 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 .

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 uncompress

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

imagery demands .

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 .

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

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

18 | P a g e

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 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 shorter download times and easy viewing benefit to 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 establishment’s 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

.

Regardless of industry, image compression has virtually endless benefits wherever

improved storage, viewing and transmission of images are required. And with the many

image compression programs available today, there is sure to be more than one that fits

your requirements best.

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

19 | P a g e

CHAPTER 2

FRACTAL IMAGE COMPRESSION

2.1 ORIGIN OF FRACTAL IMAGE COMPRESSION

The person responsible for discovering fractal image compression is Micheal F.

Barnsley, who noticed that extremely complicated, naturally appearïng objects can be

created using transformations with very short codes. He went on to name such

transformations iterated Function Systems, (IFS). IFS's can be used to encode images whose

parts resemble the whole. However, most natural images do not contain this type of self-

similarity, but rather parts of the image resemble other parts. Barnsley knew this, and in

1988 he generalized the theory of IFS's to Partitioned Iterated Function Systems (PIFS). He

used an algorithm similar to the one above to compress an image. However a person had to

interact with the program in order to find the domain blocks to be matched to a particular

range block. This resulted in high compression ratios, but very poor quality in the decoded

images. Much of Barnsley's work remains secret and copyright since he and Sloan founded

the Company Iterated Systems Inc in 1987.

Only in 1990 did any ground breaking work in fractal image compression became

public. This was the result of Arnaud Jacquin’s Ph.D thesis which automated the search of

the domain-range pair. Jacquin, who was Barnsley's Ph-D student. achieved this by

restricting the domains and range blocks to a fixed size, and transformations of a particular

type, pixel by- one and scaling by a number less than one. He also decreased the number of

domain blocks to be searched by classifying them into one of a few categories. For instance,

one category was those blocks with a distinctive edge.

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

20 | P a g e

2.2 INTRODUCTION

Fractal image compression is a modern image compression technique which has

recently become an active area of research. Fractal theories are totally different .Benoit

Mandelbrot firstly brought forward the idea of fractal geometry. A fractal is a rough or

fragmented geometric shape that can be subdivided in parts, each of which is a

reduced/size copy of the whole. Fractals display self similar structure over an extended, but

finite, scale range. M.Barnsley was the first to suggest the use of a set of transformations to

compactly store images . The self-similarities contained in the images are represented by

Iterated Function System(IFS).

An iterated function system is a finite set of contraction mappings for each image

that has a fixed-point identical to the image itself.Applying that transform iteratively on an

arbitrary starting image,the result converges to the original image. Thus, the image is

encoded by the transformation on a complete metric space . Jacqin proposed to partition

the image into square blocks called as range blocks, search for the regions or blocks of the

images which are self similar according to a certain criterion and, once a match is

found,compute the transformations. A special type of IFS, called Partition Function System

(PIFS), is used to represent image blocks which can achieve a high compression ratio and

good retrieved image quality by utilizing the self-similarity characteristic founded in

different parts of the images .Fisher et al made a great contribution to this field . His

approach was classification of ranges and domain blocks. Its aim was to reduce number of

comparisons between the blocks involved in fractal image compression by just comparing

blocks of similar class.

2.3 Basics of Fractal Image Compression

Deterministic fractals have the intrinsic property of having extremely high visual

complexity which requires less number of bits for representing a given information. They

can be described and generated by simple recursive deterministic algorithms . They are

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

21 | P a g e

mathematical objects with a high degree of redundancy in the sense that they are

recursively made of transformed copies of either themselves or parts of themselves.

2.3.1 Fractals - a brief introduction

The term fractal was first used by Benoit B. Manderlbrot to designate objects that

are self-similar at different scales . Such objects have details at every scale. Unfortunately, a

good definition of the term fractal is elusive. It is best to regard a fractal as a set that has

properties such as those listed below, rather than to look for a precise definition.

If we consider a set F to be fractal, it will have some of the following properties:

1. F has detail at every scale

2. F is (exactly, approximately, or statistically) self-similar

3. The fractal dimension of F is greater than its topological dimension

4. There is a simple algorithmic description of F

2.3.2 Self-similarity and Self-affinity:

The property of objects whereby magnified subsets appear similar or identical to the

whole and to each other is known as self-similarity. It is a characteristic of fractals and sets

them apart from Euclidean shapes which generally are smoother. Thus fractal shapes are

self-similar and independent of scale or scaling and possess no characteristic size. Euclidean

shapes may be described by a simple algebraic formula where as fractals are generally

constructed using a recursive algorithm suited for computers.

The non-uniform scaling, where shapes are ( statistically) invariant under

transformations that scale different co-ordinates by different amounts, is known as self

affinity.

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

22 | P a g e

CHAPTER 3

LITERATURE SURVEY

The objective of the following subsection is to provide a survey of the work available

in the digital image processing especially for compressing the images. This subsection

provides an outline of the efforts of various researchers.

In February 2011, M. I. Khalil in his research work had implemented Run Length

coder in simplified and more effective way. This proposed algorithm works on

quantized coefficient of Discrete Cosine Transform (DCT) where there are a lot of

coincident token. This experimental result proves that this new approach attains

competitive performance. He concluded that proposed technique has higher

compression ratio than Run-Method and can be used for widely variety of data types

including image, video, audio and text data.

Dr. E. Khannan et al. in their research paper namely “Lossless Image Compression

Algorithm for Transmitting over Low Bandwidth Line” had shown that compression

of image can be improved by considering special and temporal correlations as well

as spatial redundancy. In their paper to decrease the communication bandwidth and

save the transmitting power in wireless endoscopy capsule, they proposed a new

Near- Lossless image compression algorithm based on the Bayer format image

suitable for hardware design. The efficiency of temporal prediction was found to be

highly dependent on individual image sequences. They also compared the results of

adaptive and non- adaptive based image compression. Their experimental result

shows that the adaptive wavelet decomposition works better than non- adaptive

(Haar) wavelet decomposition.

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

23 | P a g e

In March 2013, Shrusti porwal et al. has provided Lossless data compression

methodologies and compared their performance. They compared Huffman and

Arithmetic coding methods based on parameters like compression ratio ,

compression speed, decompression speed, memory space, compressed pattern

matching and whether there is prevision for random access or not. They found out

that Arithmetic encoding methodology is very powerful over Huffman encoding

methodology. They experimentally proved that compression ratio of Arithmetic

coding is better and is also reduces channel bandwidth and transmission time.

Ms. Pallavi et al. in their research work had discussed about image classification,

wavelet compression and they have converted an image into an array using Delphi

image control tool. This image control can be used for displaying a graphical image

Icon, Bitmap, metafile, GIF, JPEG etc. then an algorithm was created in Delphi to

implement Huffman coding. They conclude that in Huffman coding, the image

uncompressed need have some specific knowledge of the symbol of probabilities in

the compressed files and this need more bit to encode the file.

“A Survey: Various Techniques of Image Compression” named paper published by

Gaurav Vijay Vargiya et al. in Oct 2013 addresses about various image compression

techniques like Run Length encoding , Entropy encoding, Arithmetic coding ,Lempel-

Ziv-Welch coding , Scalar quantization and Vector quantization. They found that

lossless image compression techniques are most effective over the lossy

compression techniques. Lossy provides a higher compression ratio than lossless.

With the advancement in digital technology, this area has gained an immense

momentum over the last two decades. However, a lot of work still needs to be done

for optimization.

J. H. PUJAR et al. The need for an efficient technique for compression of Images ever

increasing because the raw images need large amounts of disk space seems to be a

big disadvantage during transmission & storage. Even though there are so many

compression technique already present a better technique which is faster, memory

efficient and simple surely suits the requirements of the user. In this paper we

proposed the Lossless method of image compression and decompression using a

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

24 | P a g e

simple coding technique called Huffman coding. This technique is simple in

implementation and utilizes less memory. A software algorithm has been developed

and implemented to compress and decompress the given image using Huffman

coding techniques in a MATLAB platform. The experiment shows that the higher

data redundancy helps to achieve more compression.

P. Telagarapu et al. Image compression is a widely addressed researched area. Many

compression standards are in place. But still here there is a scope for high

compression with quality reconstruction. The JPEG standard makes use of Discrete

Cosine Transform (DCT) for compression. The introduction of the wavelets gave a

different dimensions to the compression. This paper aims at the analysis of

compression using DCT and Wavelet transform by selecting proper threshold

method, better result for PSNR have been obtained. Extensive experimentation has

been carried out to arrive at the conclusion. In this paper, we have considered that

DCT and DWT for image compression and decompression. By considering several

images as inputs, it is observed that MSE is low and PSNR is high in DWT than DCT

based compression.

S Dhawan et al. Image compression is now essential for applications such as

transmission and storage in data bases. In this paper we review and discuss about

the image compression, need of compression, its principles, and classes of

compression and various algorithm of image compression. This paper attempts to

give a recipe for selecting one of the popular image compression algorithms based

on Wavelet, JPEG/DCT, VQ, and Fractal approaches. We review and discuss the

advantages and disadvantages of these algorithms for compressing grayscale

images, give an experimental comparison on 256×256 commonly used image of

Lenna and one 400×400 fingerprint image. We have reviewed and summarized the

characteristics of image compression, need of compression, principles behind

compression, different classes of compression techniques and various image

compression algorithms based on Wavelet, JPEG/ DCT, VQ.

G. K. Kharate et al. In Image Compression, the researchers‟ aim is to reduce the

number of bits required to represent an image by removing the spatial and spectral

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

25 | P a g e

redundancies. Recently discrete wavelet transform and wavelet packet has emerged

as popular techniques for image compression. The wavelet transform is one of the

major processing components of image compression. The result of the compression

changes as per the basis and tap of the wavelet used. It is proposed that proper

selection of mother wavelet on the basis of nature of images, improve the quality as

well as compression ratio remarkably.We suggest the novel technique, which is

based on wavelet packet best tree based on Threshold Entropy with enhancedrun-

length encoding. This method reduces the time complexity of wavelet packets

decomposition as complete tree is not decomposed. Our algorithm selects the sub-

bands, which include significant information based on threshold entropy. The

enhanced run length encoding technique is suggested provides better results than

RLE.

N. R. Thota et al. Image compression is the application of data compression on

digital images. Image compression can be lossy or lossless. In this paper it is being

attempted to implement basic JPEG compression using only basic MATLAB

functions. In this paper the lossy compression techniques have been used, where

data loss cannot affect the image clarity in this area. Image compression addresses

the problem of reducing the amount of data required to represent a digital image. It

is also used for reducing the redundancy that is nothing but avoiding the duplicate

data. It also reduces the storage area to load an image. For this purpose we are

using JPEG. JPEG is a still frame compression standard, which is based on, the

Discrete Cosine Transform and it is also adequate for most compression

applications.

M. Raid et al. Due to the increasing requirements for transmission of images in

computer, mobile environments, the research in the field of image compression has

increased significantly. Image compression plays a crucial role in digital image

processing, it is also very important for efficient transmission and storage of images.

When we compute the number of bits per image resulting from typical sampling

rates and quantization methods, we find that Image compression is needed.

Therefore development of efficient techniques for image compression has become

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

26 | P a g e

necessary .This paper is a survey for lossy image compression using Discrete Cosine

Transform, it covers JPEG compression algorithm which is used for full-colour still

image applications and describes all the components of it. Image compression is

used for managing images in digital format.

R. K. Yadav et al. This paper presented comprehensive study with performance

analysis of very recent Wavelet transform based image compression techniques.

Image compression is one of the necessities for such communication. The goals of

image compression are to minimize the storage requirement and communication

bandwidth. Compression is achieved by the removal of redundant data. Discrete

Wavelet Transform (DWT) is a recently developed compression technique in image

compression. DWT image compression includes decomposition (transform of

image), Detail coefficients thresholding, and entropy encoding. This paper mainly

describes the transform of an image using DWT and thresholding techniques. In this

paper we have taken the standard image Lena of size 256X256 of 8 bit depth and

applied DWT (haar). Then two results set are obtained by applying two different

techniques of thresholding and then compare the result.

P. Sharma et al. Medical images are having a very significant role in health sciences.

Medical images are produced by the mechanism of medical imaging which is the

process of creating images of the human body or body parts using various

techniques to reveal, diagnose or treat a disease. Analysis of these images by the

experts leads to detection of a certain and specific medical condition. We present a

new hybrid discrete cosine transform and Run length encoding to bring about

compression and noise removal in further steps and then image similarity detection

by Fourier transform. The quality of the image after compression is the main criteria

that all the compression techniques should hold. The proposed compression scheme

may have superior performance in a medical image.

D. S. Seeli et al. Fractal compression is a lossy compression method for digital

images, based on fractals. The method is best suited for textures and natural images,

relying on the fact that parts of an image often resemble other parts of the same

image. Fractal Image Compression (FIC) techniques take more time to perform

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

27 | P a g e

processes are encoding and global search. Many different researchers and

companies are trying to develop a new algorithm to reach shorter encoding time

and smaller files. But there are still some problems with fractal compression. This

paper analyses the existing FIC techniques that has been developed for the purpose

of increasing compression rate and reduce computational time. These FIC

techniques commonly utilized the optimization techniques to find the optimal best

matching blocks.

M. Somanathan1 et al. Classic image compression techniques such as JPEG and

MPEG have serious limitations at high compression rates – the decompressed image

gets really fuzzy or indistinguishable. To mitigate this problem Artificial Neural

Network (ANN) techniques, considered to be intelligent and adaptive models, are

used for image compression. In this paper, image compression is achieved by

implementing an intelligent technique like the back propagation neural network

algorithm. Analysis is also done on achieving a good quality compressed image by

varying and comparing the neural network parameters such as number of hidden

layer nodes, momentum constant and number of epochs. In this paper, artificial

neural networks were employed for the particular application of image compression.

Alarabeyyat et al. The development of multimedia and digital imaging has led to high

quantity of data required to represent modern imagery. This requires large disk

space for storage, and long time for transmission over computer networks, and

these two are relatively expensive. These factors prove the need for images

compression. Image compression addresses the problem of reducing the amount of

space required to represent a digital image yielding a compact representation of an

image, and thereby reducing the image storage/transmission time requirements.

The key idea here is to remove redundancy of data presented within an image to

reduce its size without affecting the essential information of it. We are concerned

with lossless image compression in this paper. This paper was motivated by the

desire of improving the effectiveness of lossless image compression by improving

the BCH and LZW. We provided an overview of various existing coding standards

lossless image compression techniques.

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

28 | P a g e

R. L. de Queiroz et al. As the Joint Photographic Experts Group (JPEG) has become an

international standard for image compression; we present techniques that allow the

processing of an image in the “JPEG-compressed” domain. The goal is to reduce

memory requirements while increasing speed by avoiding decompression and space

domain operations. In each case, an effort is made to implement the minimum

number of JPEG basic operations. Techniques are presented for scaling, previewing,

rotating, mirroring, cropping, recompressing, and segmenting JPEG-compressed

data. While most of the results apply to any image, we focus on scanned documents

as our primary image source. We presented techniques for processing compressed

images. We used simple algorithms for scaling, previewing, cropping, rotating,

mirroring, segmenting, and recompressing compressed images. Just algorithms

which can lead to substantive reductions in memory requirements and complexity

were presented. We tried to avoid discussing obvious processing derived from the

fact that DCT is a linear transform. For example, it is obvious that the DCT of a linear

combination of input blocks will result in the same linear combination of the

respective transformed blocks.

K. Lees et al. Images require substantial storage and transmission resources, thus

image compression is advantageous to reduce these requirements. The report

covers some background of wavelet analysis, data compression and how wavelets

have been and can be used for image compression. An investigation into the process

and problems involved with image compression was made and the results of this

investigation are discussed. It was discovered that thresholding was had an

extremely important influence of compression results so suggested thresholding

strategies are given along with further lines of research that could be undertaken.

Dr. E.KANNAN et al. In this paper to decrease the communication bandwidth and

save the transmitting power in the wireless endoscopy capsule, this paper presents a

new near-lossless image compression algorithm based on the Bayer format image

suitable for hardware design. Especially, it has low complexity hardware overhead

(only two line buffers) and supports real-time compressing. In addition, the

algorithm can provide lossless compression for the region of interest (ROI) and high-

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

29 | P a g e

quality compression for other regions. The ROI can be selected arbitrarily by varying

ROI parameters. The proposed technique produces a bit stream that results in a

progressive and ultimately lossless reconstruction of an image similar to what one

can obtain with a reversible wavelet codec.

P. M. Sune et al. Image compression is now essential for applications such as

transmission and storage in data bases. Compression becomes very easy techniques

to apply without much technical requirement. In this paper we discuss about the

image classification, wavelet compression, and converted an image into an array

using Delphi image control tool. Image control can be used to display a graphical

image Icon, Bitmap, metafile, GIF, JPEG, etc then an algorithm is created in Delphi to

implement Huffman coding. Hence image compression has proved to be a valuable

technique as one solution. The Wavelet Compression Engine was used in this study.

In this paper we have to present classification of image, and Normalized Information

Distance (NID) is measure, and wavelet of image compression.

Fast FPGA Implementation of YUV-based Fractal Image Compression.

Published in: 2014 IEEE Fifth International Conference on Communications

and Electronics (ICCE)

AN ENHANCED FRACTAL IMAGE COMPRESSION INTEGRATING QUANTIZED

QUADTREES AND ENTROPY CODING:2015 11th International Conference on

Innovations in Information Technology (IIT)

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

30 | P a g e

CHAPTER 4

SOFTWARE USED

4.1 ABOUT THE SOFTWARE

MATLAB(matrix laboratory) is a multi-paradigm numerical computing environment.

A proprietary programming language developed by Math Works,MATLAB allows matrix

manipulations, plotting of functions and data, implementation of algorithms, creation of

user interfaces, and interfacing with programs written in other languages, including C, C++,

C#, Java, Fortran and Python.Cleve Moler the chairman of the computer science

department at the University of New Mexico, started developing MATLAB in the late 1970s.

The MATLAB application is built around the MATLAB scripting language.Common

usage of the MATLAB application involves using the Command Window as an interactive

mathematical shell or executing text files containing MATLAB code.It is a programming

language developed by Math Works. It started out as a matrix programming language

where linear algebra programming was simple. It can be run on both under interactive

sessions and as a batch job. This tutorial gives you aggressively a gentle introduction of

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

31 | P a g e

MATLAB programming language.It is designed to give students fluency in MATLAB

programming language.

Figure 4.1(a)Logo of Matlab

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. It has numerous

built-in commands and math functions that help you in mathematical calculations,

generating plots, and performing numerical methods.

MATLAB is used in every facet of computational mathematics. Following are some

commonly used mathematical calculations where it is used most commonly:

Dealing with matrices and Arrays

2-D and 3-D Plotting and graphics

Linear Algebra

Algebraic Equations

Non-Linear Functions

Statistics

Data Analysis

Calculus and Differential Equations

Numerical Calculations

Integration

Transforms

Curve Fitting

Various other special functions

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

32 | P a g e

4.2 FEATURES OF MATLAB

Following are the basic features of MATLAB:

It is high-level language for numerical computation, visualization and application

development. It also provides an interactive environment for iterative exploration,

design and problem solving.

It provides vast library of mathematical functions for linear algebra, statistics,

Fourier analysis, filtering, optimization, numerical integration and solving ordinary

differential equations.

It provides built-in graphics for visualizing data and tools for creating custom

plots.MATLAB’s programming interface gives development tools for improving code

quality, maintainability, and maximizing performance.

It provides tools for building applications with custom graphical interfaces.

It provides functions for integrating MATLAB based algorithms with external

applications and languages such as C,Java,.NET and Microsoft Excel.

4.3 GUI IN MATLAB

GUIs (also known as graphical user interfaces or UIs) provide point-and-click control

to software applications, eliminating the need to learn a language or to type

commands in order to run the application. GUIs can automate a task or calculation.

GUI typically contains controls such as menus, toolbars, buttons, and sliders.

The UI contains components such as:

• An axes component

• A pop-up menu listing three data sets that correspond to MATLAB functions:

peaks, membranes and sinc.

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

33 | P a g e

• A static text component to label the pop-up menu.

• Three buttons that provide different kinds of plots: surface, mesh and contour.

When you click a push button, the axes component displays the selected data set

using the specified type of 3-D plot.

4.4 USES OF MATLAB

MATLAB is widely used as a computational tool in science and engineering

encompassing the fields of physics,chemistry,math and all engineering streams.It is used in

a range of applications including-

Signal Processing and Communications

Image and Video Processing

Control Systems

Test and Measurement

Computational Finance

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

34 | P a g e

CHAPTER 5

METHODOLOGY

5.1 BLOCK DIAGRAM

INPUT IMAGE QUADTREE

DECOMPOSITION

HUFFMAN

ENCODING

COMPRESSION OF

IMAGE

HUFFMAN DECODING DECOMPRESSION OF

IMAGE

PSNR CALCULATION

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

35 | P a g e

5.2 QUADTREE PARTITIONING

Quadtree partitioning is a rather simple method of dividing an image into variable

sized blocks so as to satisfy an error limit. When using the brute force algorithm, we simply

find the domain block which resembles a particular range block the most. However, this

does not set an upper limit on the difference between the two blocks, and thus it is possible

that the best domain-range block pairing is a poor one. If there are a significant number of

such matchings, or if the blocks in question are in a particularly high detail area, then it is

likely that the decoded image will be of poor quality.

The Quadtree algorithm sets an upper limit for the difference between the domain-

range matchings, thus improving the quality of the decoded image. It does so by dividing

the original image into overlapping domain blocks of various sizes. For example, an image of

size 256 x 256 could have domain blocks whose sides are of length 8,12,16,24,32,48 and 64.

Then it recursively divides the original image into non-overlapping range blocks until they

are of a specified size, 32 x 32 for example. For each range block, it searches the domain

pool. For the domain block which resembles it the most (minimizing the rms difference). If

the rms difference is smaller or equal to the maximum error; then save the transformation

and delete the range block from the range pool. If no domain block is found, divide the

range block into four equal subsquares, which are the new range blocks, and search the

domain pool again, deleting the range block if a match is found. Repeat until the pool of

range blocks is empty or the size of the range blocks is less than a specified lower limit.

This method is called the Quadtree algorithm since it can be represented by a tree

whose root is the original image and each node has, potentially: four subnodes which

correspond to the range blocks of the image. For a better understanding? see Figures

below, such that Figure, 5.2(a) shows an example of the quadtree partitioning of an image,

Figure 5.2(b)shows its corresponding quadtree, Figure 5.2(c) shows the partitioning of the

Lena image and Figure 5.2(d) is the decode image of a dog using the quadtree algorithm.

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

36 | P a g e

Figure 5.2(a)image of performing quadtree partitioning algorithm on an image

Figure 5.2(b)Quadtree representation of the above image

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

37 | P a g e

Figure 5.2( c) Quadtree Partitioning of Lenna Image

Figure 5.2(d) Decoded image of a dog which was encoded using quadtree

partitioning algorithm

Notice that in order to compare the domain and range blocks we must reduce the

number of pixels in the larger domain block. If we are comparing the domain blocks which

are twice the size of the range blocks, then the number of pixels in the domain blocks must

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

38 | P a g e

be decreased to one quarter or the original amount. There are two obvious ways of doing

so: the preferred way is to take the average pixel values as the new pixel value, which is

known as sub-sampling: the other is to choose a representative pixel as the new pixel value.

We are multiplying each pixel value by scaling factor Thus if |si|> 1 for the mapping wi, then

it is possible that W = UiWi may not be eventually contractive, and therefore we are not

guaranteed convergence of the decoded image. As such, the values for which IsiI > 1, must

be truncated to some fixed Smax.

To decode the image begin by taking an arbitrary image; divide the image into the

final quadtree partitioning we had so as to determine the position of the range blocks. For

each range block, the domain block that maps to it is spatially reduced by a factor of two

using sub-sampling. Each pixel value is then multiplied by the scaling factor s(i), and sigma(i)

is added to it before it is placed in its proper place in the range block, which depends on the

orientation of the transformation. The whole image is iterated in this way- until the

difference between two subsequent iterations is smaller than a given threshold value.

5.2 HUFFMAN CODING

5.2.1 HUFFMAN ENCODING

Huffman coding is the most prevalent lossless strategy for compacting a bit stream

and evacuating coding repetition. It is a capable source coding calculation for source images

that are not similarly likely . Huffman coding uses the measurable property of images in the

source stream, and after that produces particular codes for these images. The codes for

images having higher likelihood of event are shorter than those codes for images having

lower likelihood. In this way, it depends on the recurrence of event of an information thing

(pixels or little squares of pixels in pictures). The codes are put away in a code book. Code

book is built for each picture or a lot of pictures. Huffman develops code tree from base up

to top down (form the codes from ideal to left). Images with the most elevated frequencies

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

39 | P a g e

end up at the highest point of the tree (requesting in diminishing request), and result in the

briefest codes .

5.2.2 HUFFMAN DECODING

Decoding of encoded image is simple. After the code has been created, decoding is

accomplanished in a simple look-up table manner. Start from the root and read the first bit

of compressed file. When the decoder reaches a leaf there the original, uncompressed

image, symbol and that code is reflected by the decoder. The process initiated again at the

root with the next bit, and then it read and can decode the rest of its input.It is basically

based on the symbols, i.e. the probability of the symbols .The code itself is an instantaneous

uniquely decodable block code. It is called a block code because each source symbol is

mapped into a fixed sequence of code symbols. It is instantaneous because each code word

in a string of code symbols can be decoded without referencing succeeding symbols. It is

uniquely decodable, because any string of code symbols can be decoded in only one way.

Thus, any string of Huffman encoded symbols can be decoded by examining the individual

symbols of the string in a left to right manner .

CHAPTER 6

RESULTS

6.1 PERFORMANCE CHARACTERISTICS

The quality of reconstructed images can be evaluated in terms of objective and

subjective measures. Subjective measures are based on observer's response such as Mean

Opinion Score(MOS). The following statistical properties are considered as objective

evaluation parameters.

a) Mean Square Error (MSE): MSE is the cumulative squared error between the

compressed and the original image.A lower value of MSE means lesser error, and it has

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

40 | P a g e

inverse relation with PSNR. It is the average of the square difference between the desired

response and actual system output.

MSE= ∧2

where, I(x, y) is the original image and I’(x,y) is the reconstructed image and m, n are

the dimensions of the image.

b) Peak Signal-to-Noise Ratio (PSNR): PSNR is used to measure the quality of

reconstruction lossy compression images.It is the ratio between the maximum possible

power of a signal and the power of corrupting noise . This ratio is often used as a quality

measurement between the original and compressed image.The higher the PSNR, the

better the quality of the compressed or reconstructed image. PSNR expressed in

decibel(dB)

PSNR =10 log10 (255^2/MSE)

c)Compression Ratio(CR): Data compression ratio is defined as the ratio between the

number of bits in original image and compressed image.

CR=

Higher CR means lower reconstruction quality of the image.At higher CR we get blurred

image as compared to the image that has less CR.

d)Encoding time(ET): Encoding is the process of putting a sequence of characters into

special format for transmission or storage purposes.

6.2 FRACTAL IMAGE COMPRESSION OUTPUT:

Fractal image compression is mostly designed to be applicable on the fractal

images.It can also be applied to natural images,satellite images which can be gray scale or a

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

41 | P a g e

color image.Fractal images’ structure is usually defined by fine and small scales or

substructures.

An input image will be read into the software,then we are applying quadtree

partitioning on it.This will extract the features of the image at a user defined threshold

value.The original image will be divided into blocks which are further divided into domains if

they aren’t meeting the criteria which is threshold should be 0.2,minimum dimension-2 and

maximum dimension-64.An average of the pixel values is calculated for further calculation

purpose.Boundary limits are set to 0.The pixel intensities are in a continuous manner,they

are separated for Huffman coding calculations.If the values are pretty close they will be

considered as one point.Now,the probabilities are calculated for the occurance of each of

the pixel intensity selected for calculations.They are arranged in the descending order,the

lower two probabilities are added and again placed in the descending order along with the

other probabilities.This process continues until we reach 1.It will give a distinct prefix code

for every unique symbol which is further converted to variable length code.Huffman

eencoding is used to compress image effectively.Compression Ratio will be calculated which

is a ratio of number of bits in original image to number of bits in final image.then the

reverse process happens which includes Huffman decoding and decompression of

image.Finally the PSNR is calculated. A good PSNR value lies between 20-40dB.

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

42 | P a g e

Figure 6.2(a):Snapshot of the output screen

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

43 | P a g e

Figure 6.2(b): Snapshot of the results of a fractal image

Figure 6.2(c) Snapshot of the results of a fractal image of a lotus

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

44 | P a g e

Figure 6.2(d) Snapshot of the results of gray scale image of a baboon

Figure 6.2(e) Snapshot of the results of a color image of Lenna

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

45 | P a g e

Figure 6.2(f) Snapshot of the results of a satellite image of The Earth

IMAGE TIME TAKEN FOR

COMPRESSION(SECONDS)

COMPRESSION

RATIO

TIME TAKEN FOR

DECOMPRESSION(SECONDS)

PSNR

BABOON.BMP 1.10493 8.63665 7.75244 31.871

LENA.BMP 0.415253 11.4608 4.93626 32.9866

LENA.JPG 7.94525 11.8788 4.7522 32.2828

PEPPERS.BMP 0.37662 9.66483 6.44794 31.789

FRACTAL.JPG 12.6823 6.8538 12.80268 30.1668

FRACTALLOTUS.JPG 3.60338 13.5021 3.63035 32.2718

SATOFEARTH.JPG 11.0557 6.52116 12.2764 30.7857

Table 6.2(a) Tabulated results of various images

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

46 | P a g e

CHAPTER 7

CONCLUSION

This project compresses any kind of images such as satellite images,gray scale

images and fractal images.

Encoding time can be reduced by decreasing the size of the images but it lowers

the image quality.

Using fractal compression and quadtree decomposition it is easier to compress

fractal images

Consirdering the different dimensions of the range blocks and optimizing the

number of iteration it is possible to improve the compression ratio and PSNR

values.

To improve the quality of the recovered images ,quantized quad-tree

decomposition and entropy coding techniques can be used.

This type of compression can be applied in Medical Imaging, where doctors need

to focus on image details, and in Surveillance Systems, when trying to get a clear

picture of the intruder.

A weakness of the proposed reference design is the use of fixed size blocks for

the range and domain images. There are regions in images that are more difficult

to code than others (Ex. Lena’s eyes). Therefore, there should be a mechanism to

adapt the block size (Rk,l, Di,j) depending on the error introduced when coding

the block.

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

47 | P a g e

CHAPTER 8

FUTURE SCOPE

We can easily extend fractal image compression to fractal video compression. Both

motion compensation and three dimensional iterated function systems have advantages

over the other encoding techniques, but both remain to be fully developed. Because of the

short decoding times but lengthy encoding times, fractal video compression techniques, like

fractal still image techniques, are better suited for multi-media applications.

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

48 | P a g e

REFERENCES

[I] M.F. Barnsley; "Fractals Everywhere," Academic Press, San Diego, 1988.

[2] M.F. Barnsley, L .P. Hurd; 'Fractal Image Compression," AK Peters, Wellesley MA, 1993.

[3] Wayne Cochran, John Hart, Partick Flynn; "Fractal Volume Compression," IEEE Trans

actions on Visualization and Computer Graphics. vol. 2, no. 4, pp. 313-322, December 1996-

[4] Yuval Fisher; "Fractal Image Compression. Theory and Applications," Springer Verlag,

New York, 1994.

[SI Yuval Fisher; "Fractal Image Compression," SIGGRAPH 92 Course Notes, 1992.

[6] Demy Gulick; "Encounter with Chaos," McGraw-Hill; 1992.

[7] A. Guttman; "R-trees: A Dynamic Index Structure For Spatial Searching," Proceedings of

ACM SIGMOD Conference on Management of Data, pp. 47-57, 1984.

[8] Bernd Hürtgeen, Peter Büttgen; "Fractal Approach to Low Rate Video Coding," Pro-

ceedings from SPIE Visual Communications and Image P rocessing, vol. 2094, pp. 120- 13 1,

1993.

[9] B. Hrtgen, P. Mols, S. F. Simon; "Fractal Transform Coding of Color Images," Pro-

ceedings of the International Conference on Visual Communications and Image Processing,

SPIE 94, vol. 2305, pp. 1683-1691, Chicago, Illinois, USA, 1994.

[10] John Kominek; "Algorithm for Fast Fractal Image Compression," Proceedings of SPIE,

Volume 2419,1995.

[Il] M.S. Lazar, L.T. Bruton; "Fracta.1 Block Coding OF Digital Video Coding," IEEE Trans.

Circuits and Systems for Video Technology, vol. 4' no. 3, pp. 297-308, 1994.

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

49 | P a g e

[12] H.L. Royden; "Real Analysis," hfacrnilian; New brk: 1988.

[13] W. Ruden; "Real and Cornplex Analysis,:' McGraw-Hill, Xew York. 1972.

[14] Dietmar Saupe; "Lean Domain Pools for Fractal Image Compression." Proceedings of

SPIE Electronic Imaging 96' Science and Technology Still Image Compression II; vol 2669:

1996.

[15] Lester Thomas, Farzin Deravi; "Region-Based Fractal Image Compression Using Heuris-

tic Search," IEEE Transactions on Image Processing, vol. 4, no. 6, June 1995, pp. 832-838.

[16] Crîstopher J. Wein, Ian F. Blake; "On the Performance of Fractal Compression with

Clustering' IEEE Transactions on Image Processing, vol. 5, no. 3, March 1996: pp. 522- 526.

[17] R.E. Woods, R.C. Gonzales; "Digital Image Processing," Addison-LVesley, Reading,

199'2-

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

50 | P a g e

APPENDIX:

clc;

clear all;

%% 1.input Image

fname=uigetfile('*.*');%opens ui for select image files

I=imread(fname); %reads selected image

I=imresize(I,[128 128]);%resize image into 256*256

figure,imshow(I);title('Original Image');drawnow;

tic;%record time

[row col plane]=size(I);

if (plane==1)

%% for grayscale image

%% 2.Quadtree Decomposition

s=qtdecomp(I,0.2,[2 64]);%divides image using quadtree decomposition of

%threshold .2 and min dim =2 ,max dim =64

[i,j,blksz] = find(s); %record x and y coordinates and blocksize

blkcount=length(i); %no of total blocks

si=4.1;

global si

avg=zeros(blkcount,1);%record mean values

for k=1:blkcount

avg(k)=mean2(I(i(k):i(k)+blksz(k)-1,j(k):j(k)+blksz(k)-1));%find mean

%value

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

51 | P a g e

end

avg=uint8(avg);

figure,imshow((full(s)));title('Quadtree Decomposition');drawnow;

%% 3.Huffman Encoding

%prepare data

i(end+1)=0;j(end+1)=0;blksz(end+1)=0;%set boundary elements

data=[i;j;blksz;avg];%record total information

data=single(data); %convert to single

symbols= unique(data);% Distinct symbols that data source can produce

counts = hist(data(:), symbols);%find counts of symblos in given data

p = counts./ sum(counts);% Probability distribution

sp=round(p*1000);% scaled probabilities

dict = huffmandict(symbols,p'); % Create dictionary.

comp = huffmanenco(data,dict);% Encode the data.

%% 4.Compressed

%Time taken for compression

t=toc;

fprintf('Time taken for compression = %f seconds\n',t);

%compression ratio

bits_in_original=8*256*256;

bits_in_final=length(comp)+8*length(symbols)+8*length(sp);

%Compression Ratio = total number of bits in original file, divided by

%number of bits in final file

CR= bits_in_original/bits_in_final;

fprintf('compression ratio= %f\n',CR);

%% 5.Huffman Decoding

tic;%record time

datanew = huffmandeco(comp,dict);% decode the data.

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

52 | P a g e

zeroindx=find(data==0);%find boundries

inew=datanew(1:zeroindx(1)-1); %seperate row index

jnew=datanew(zeroindx(1)+1:zeroindx(2)-1); %seperate column index

blksznew=datanew(zeroindx(2)+1:zeroindx(3)-1);%seperate blocksize

avgnew=datanew(zeroindx(3)+1:end); %seperate mean values

%% 6.Decompressed image

avgnew=uint8(avgnew);

for k=1:blkcount

outim(inew(k):inew(k)+blksznew(k)-1,jnew(k):jnew(k)+blksznew(k)-1)=avgnew(k);

end

figure,imshow(outim);title('Decompressed Image');drawnow;

%% PSNR calculation

%Time taken for De-compression

t=toc;

fprintf('Time taken for Decompression = %f seconds\n',t);

%Create psnr object

[P]=psnr(I,outim);

% hpsnr = vision.PSNR;

% psnr = step(hpsnr, I,outim);%calculate psnr

fprintf('PSNR= %f\n',P);%display psnr

else

%% For color image

for arj=1:3

%% 2.Quadtree Decomposition

s=qtdecomp(I(:,:,arj),0.2,[2 64]);%divides image using quadtree decomposition of

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

53 | P a g e

%threshold .2 and min dim =2 ,max dim =64

[i,j,blksz] = find(s); %record x and y coordinates and blocksize

blkcount=length(i); %no of total blocks

si=4.1;

global si

avg=zeros(blkcount,1);%record mean values

for k=1:blkcount

avg(k)=mean2(I(i(k):i(k)+blksz(k)-1,j(k):j(k)+blksz(k)-1));%find mean

%value

end

avg=uint8(avg);

quaddisp(:,:,arj)=full(s);

%% 3.Huffman Encoding

%prepare data

i(end+1)=0;j(end+1)=0;blksz(end+1)=0;%set boundary elements

data=[i;j;blksz;avg];%record total information

data=single(data); %convert to single

symbols= unique(data);% Distinct symbols that data source can produce

counts = hist(data(:), symbols);%find counts of symblos in given data

p = counts./ sum(counts);% Probability distribution

sp=round(p*1000);% scaled probabilities

dict = huffmandict(symbols,p'); % Create dictionary.

comp = huffmanenco(data,dict);% Encode the data.

%% 4.Compressed

%Time taken for compression

t(:,:,arj)=toc;

%compression ratio

bits_in_original=8*256*256;

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

54 | P a g e

bits_in_final=length(comp)+8*length(symbols)+8*length(sp);

%Compression Ratio = total number of bits in original file, divided by

%number of bits in final file

CR(:,:,arj)= bits_in_original/bits_in_final;

%% 5.Huffman Decoding

tic;%record time

datanew = huffmandeco(comp,dict);% decode the data.

zeroindx=find(data==0);%find boundries

inew=datanew(1:zeroindx(1)-1); %seperate row index

jnew=datanew(zeroindx(1)+1:zeroindx(2)-1); %seperate column index

blksznew=datanew(zeroindx(2)+1:zeroindx(3)-1);%seperate blocksize

avgnew=datanew(zeroindx(3)+1:end); %seperate mean values

%% 6.Decompressed image

avgnew=uint8(avgnew);

for k=1:blkcount

outim(inew(k):inew(k)+blksznew(k)-1,jnew(k):jnew(k)+blksznew(k)-1)=avgnew(k);

end

outimg(:,:,arj)=outim;

end

fprintf('Time taken for compression = %f seconds\n',max(t));

figure,imshow((full(quaddisp)));title('Quadtree Decomposition');drawnow;

figure,imshow(outimg);title('Decompressed Image');drawnow;

% Compression ratio

fprintf('compression ratio= %f\n',max(CR));

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

55 | P a g e

%% PSNR calculation

%Time taken for De-compression

t=toc;

fprintf('Time taken for Decompression = %f seconds\n',t);

%Create psnr object

[P1]=psnr(I(:,:,1),outimg(:,:,1));

[P2]=psnr(I(:,:,2),outimg(:,:,2));

[P3]=psnr(I(:,:,3),outimg(:,:,3));

P=max([P1,P2,P3]);

fprintf('PSNR= %f\n',P);%display psnr

end

PSNR FUNCTION:

function [P]=psnr(original_img,stego_img) %original_img = original image; %stego_img = image with secrete data; %P=PSNR; global si original_img=double(original_img); stego_img=double(stego_img); if (original_img==stego_img) PSNR=100; else m = size(original_img,1); n = size(stego_img,2); d = 0 ; for i = 1:m-1 for j = 1:n-1 d = d + (original_img(i,j) - stego_img(i,j)).^2 ; end end MSE=d/(m*n); MAX = max( abs(original_img(:)) ); PSNR= 10*log10(MAX^2/MSE)+si; end

IMPLEMENTATION OF FRACTAL IMAGE COMPRESSION WITH GUI

56 | P a g e

P=PSNR;

GUASSIAN NOISE FUNCTION:

function GaussF=guassin_outt(Img) %Gaussian filter using MATLAB built_in function %Read an Image A = imnoise(Img,'Gaussian',0.04,0.003); %Image with noise figure,imshow(A); H = fspecial('Gaussian',[2 2],1.76); GaussF = imfilter(A,H); figure,imshow(GaussF);

Recommended