انت هنا الان : شبكة جامعة بابل > موقع الكلية > نظام التعليم الالكتروني > مشاهدة المحاضرة

Image Quantization

Share |
الكلية كلية تكنولوجيا المعلومات     القسم قسم البرامجيات     المرحلة 3
أستاذ المادة شيماء عبد الحمزة محمد الكرعاوي       10/05/2012 11:40:04
2.6 Image quantization

Image quantization is the process of reducing the image data by removing some of the detail information by mapping group of data points to a single point. This can be done by:

1. Gray_Level reduction (reduce pixel values themselves I(r, c.(
2. Spatial reduction (reduce the spatial coordinate (r, c.(

The simplest method of gray-level reduction is Thresholding. We select a threshold gray _level and set every thing above that value equal to “1” and every thing below the threshold equal to “0”. This effectively turns a gray_level image into a binary (two_level) image and is often used as a preprocessing step in the extraction of object features, such as shape, area, or perimeter.
A more versatile method of gray _level reduction is the process of taking the data and reducing the number of bits per pixel. This can be done very efficiency by masking the lower bits via an AND operation. Within this method, the numbers of bits that are masked determine the number of gray levels available.

Example:
We want to reduce 8_bit information containing 256 possible gray_level values down to 32 possible values.
This can be done by ANDing each 8-bit value with the bit string 1111100. this is equivalent to dividing by eight( ( , corresponding to the lower three bits that we are masking and then shifting the result left three times. [Gray _level in the image 0-7 are mapped to 0, gray_level in the range 8-15 are mapped to 8 and so on].

We can see that by masking the lower three bits we reduce 256 gray levels to 32 gray levels:
256 ÷ 8= 32
The general case requires us to mask k bits, where is divided into the original gray-level range to get the quantized range desired. Using this method, we can reduce the number of gray levels to any power of 2: 2,4,6,8 16, 32, 64 or 128.
• Image quantization by masking to 128 gray level, this can be done by
ANDing each 8-bit value with bit string 11111110( ).
• Image quantization by masking to 64 gray_level. This can be done by
ANDing each 8-bit value with bit string 11111100( ).
As the number of gray levels decreases, we can see increase in a phenomenon called contouring.
Contouring appears in the image as false edges, or lines as a result of the gray _level quantization method.


Figure ( 2-14): False Contouring
This false contouring effect can be visually improved upon by using an IGS (improved gray-scale) quantization method. In this method (IGS) the improvement will be by adding a small random number to each pixel before quantization, which results in a more visually pleasing appearance.






Figure (2-15): IGS quantization





Ex.1\
We want to reduce 8-bit information containing (256 possible gray level) value
down to 4 possible values.
AND-MASK
Sol.\
1- determine (n) value:

256 gray level 4 gray levels.

n = 2
2- Extract mask:
mask = 256 -
= 256 -
= 256 - =256 - 64
mask = 192
Let g = 212

128 64 32 16 8 4 2 1
1 1 0 1 0 1 0 0 = 212

1 1 0 0 0 0 0 0 = 192

1 1 0 0 0 0 0 0 = 192
2- shift to right
no. of shift right = 8 – n
= 8 – 2 = 6
>> 6
0 0 0 0 0 0 1 1 = 3


x = result value *
= 3 *
= 192





Ex.2\
We want to reduce 8-bit information containing (256 possible gray level) value
down to 128 possible values.
AND-MASK

Sol.\
1- determine (n) value:

256 gray level 128 gray level

n = 7
2- Extract mask:
mask = 256 -
= 256 -
= 256 - =256 - 2
mask = 254

Let g = 212


128 64 32 16 8 4 2 1
1 1 0 1 0 1 0 0 = 212

1 1 1 1 1 1 1 0 = 254

1 1 0 1 0 1 0 0 = 212

2- shift to right
no. of shift right = 8 – n
= 8 – 7 = 1
1 1 0 1 0 1 0 0
>> 1
0 1 1 0 1 0 1 0 = 106

x = result value *
= 106 *
= 212

Ex.3\
We want to reduce 8-bit information containing (256 possible gray level) value
down to 4 possible values.
OR - MASK
Sol.\
1- determine (n) value:
256 gray level 4 gray level

n = 2
2- extract mask:
mask = - 1
= - 1
= - 1= 64 = 63
mask = 63
Let g = 212

128 64 32 16 8 4 2 1
1 1 0 1 0 1 0 0 = 212

0 0 1 1 1 1 1 1 = 192

1 1 1 1 1 1 1 1 = 255
3- shift to right
no. of shift right = 8 – n
= 8 – 2 = 6


1 1 1 1 1 1 1 1
>> 6
0 0 0 0 0 0 1 1 = 3

x = result value *
= 3 *
= 192


H.W.
Ex.1\
We want to reduce 8-bit information containing (256 possible gray level) value
down to 8 possible values.
AND - MASK

Ex.2\
We want to reduce 8-bit information containing (256 possible gray level) value
down to 16 possible values.
OR - MASK

Ex.3\
We want to reduce 8-bit information containing (256 possible gray level) value
down to 64 possible values.
AND - MASK

Ex.4\
We want to reduce 8-bit information containing (256 possible gray level) value
down to 128 possible values.
OR – MASK
________________________________________________________________________
Note:

Quantization of the special coordinates results in reducing the actual size of the image this is accomplished by taking groups of pixels that are spatially adjacent and mapping them to one pixel. This can be done in one of three ways:
1- averaging, 2- median, 3- decimation.

1- averaging:
We take all the pixel in each group and find the average gray level by summing the
values and dividing by the number of pixels in the group.

2- median:
We sort all the pixel values from lowest to highest and then select the middle value.
3- Decimation:
Also known as subsampling, entails simply eliminating some of the data. For example, to reduce the image by a factor of two, we simply take every other row and column and delete them. To improve the image quality when applying the decimation technique, we may want to preprocess the image with the averaging, or mean, spatial filter- this type of filtering is called anti – aliasing.


المادة المعروضة اعلاه هي مدخل الى المحاضرة المرفوعة بواسطة استاذ(ة) المادة . وقد تبدو لك غير متكاملة . حيث يضع استاذ المادة في بعض الاحيان فقط الجزء الاول من المحاضرة من اجل الاطلاع على ما ستقوم بتحميله لاحقا . في نظام التعليم الالكتروني نوفر هذه الخدمة لكي نبقيك على اطلاع حول محتوى الملف الذي ستقوم بتحميله .
الرجوع الى لوحة التحكم