0% found this document useful (0 votes)
7 views

Lecture6 (2)

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Lecture6 (2)

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

DI GIT AL IMAGE P RO C ES S I NG

Lecture 6 :Image compression


Image Compression is reducing the size of the image data while retaining the
necessary data for the image file. The shrinking file size is called the compressed
file that is used to retrieve the compressed image.
‫هو تقليل حجم بيانات الصورة مع االحتفاظ بالبيانات الضرورية لملف الصورة اي ان حجم الملف المتقلص يسمى‬
‫بالملف المضغوط الذي يستخدم السترجاع الصورة المضغوطة‬
We should know:
1. Image Type. 2. Image Size. 3. Image data.
The compression process consists of two phases:
1. Image compression. 2. Decompression
Data compression: is the process of reducing the amount of data required to
represent given quantity of information. The data and information are not the
same meaning.
Data refers to the means by which the information is conveyed.
‫ النيانات هي الوسائل التي من خاللها يتم نقل المعلزمات‬.
Various amounts of data can represent the same amount of information.
Data redundancy: is the central concept in image compression and can be
mathematically defined.
The goal of image compression is to reduce the amount of data required to
represent a digital image.
Image compression methods:
1. Lossless (Reversible ‫) يمكن ارجاعها‬
In lossless data compression, the integrity of the data is preserved ‫ حافظ عليها‬.
The original data and the data after compression and decompression are
exactly the same because; the compression and decompression algorithms
are exact inverses of each other is no part of the data is lost in the process.
Redundant ‫ المكـرر‬data is removed in compression and added during
decompression. Lossless compression methods are normally used when we
cannot afford ‫ تحمل‬to lose any data. In general the lossless method :
1. Information preserving. ‫الحفاظ على المعلومات‬
2. Low compression ratios.
2. Lossy (Non reversible ‫) اليمكن ارجاعها‬
Our eyes and ears cannot distinguish subtle ‫ الطفيفة‬changes. In such cases,
we can use a lossy data compression method. These methods are cheaper;
they take less time and space when it comes to sending millions of bits per
second for images and video.
Several methods have been developed using lossy compression
techniques:
1. JPEG (Joint Photographic Experts Group) encoding is used to compress
pictures and graphics
2. MPEG (Moving Picture Experts Group) encoding is used to compress
video
3. MP3 (MPEG audio layer 3) for audio compression.
In general the lossy method:
1. Not information preserving
2. High compression ratios

Types of Data Redundancy


(1) Coding Redundancy (CR): some pixel values more common than others.
(2) Inter-pixel Redundancy (IR): neighboring pixels have similar values,
implies that any pixel value can be reasonably predicted by its neighbors.
(3) Psycho-Visual Redundancy (PVR): some color differences are
imperceptible.
Compression attempts to reduce one or more of these redundancy types.
ways of lossless method as follows:
1. Huffman Coding
2. Run-Length coding (RLC).
3. Difference coding
Code: a list of symbols (letters, numbers, bits etc.)
Code word: a sequence of symbols used to represent a piece of information
or an event (e.g., gray levels).
Code word length: number of symbols in each code word
Example:
𝒂𝟏=𝟎.𝟏 ,𝒂𝟐=𝟎.𝟒 ,𝒂𝟑=𝟎.𝟎𝟔 ,𝒂𝟒=𝟎.𝟏 ,𝒂𝟓=𝟎.𝟎𝟒 ,𝒂𝟔=𝟎.𝟑

1. Give the code 0 to the highest probability and the code 1 to the lowest
probability in the present node.
2. Go backwards through the tree and add 0 to the highest and 1 to the
lowest probability in each node until all gray levels have a unique code.
Lavg assuming Huffman coding:

Example:
1. The Huffman code results in unambiguous code.
2. The code is reversible without loss.
3. The table for the translation of the code has to be stored together with the
coded image.
4. The Huffman code does not take correlation between adjacent pixels into
Consideration.
2. Run-Length coding (RLC).
Every code word is made up of a pair (g, l) where g is the gray level, and l is
the number of pixels with that gray level (length, or “run”).
Example:
56 56 56 82 82 82 83 80
56 56 56 56 56 80 80 80
Creates the run-length code (56, 3)(82, 3)(83, 1)(80, 4)(56, 5).
The code is calculated row by row. Very efficient coding for binary data.
Important to know position, and the image dimensions must be stored with
the coded image. Used in most fax machines
Example of combined difference code and Huffman coding

𝐋 𝐚𝐯𝐠 = 𝟑. 𝟏
H.W: how we get L avg = 3.1 and what is the value of RD =?

You might also like