(Chapter Four - Color Images Formats (RGB, HSV and YCbCr
(Chapter Four - Color Images Formats (RGB, HSV and YCbCr
(Chapter Four - Color Images Formats (RGB, HSV and YCbCr
( 255,0,0 ) is pure red, ( 0,255,255 ) is a pure cyan ( what one gets when green and
blue are mixed ), and ( 0,128,128 ) is a mid-cyan ( a mix of mid-green and mid-
blue tones ). The possible combinations of the three basic color components are
256x256x256, or 16,777,216 colors. Figure (4.1 ) shows Color specification of the
RGB Color Cube.
The process of generating colors with three basic components is based on the
RGB Color cube as shown in the figure (4.1). The three dimensions of the color
cube correspond to the three basic colors.
1
Figure (4.1): Color specification of the RGB Color Cube
The cube's corners are assigned each of the three primary colors, their
complements, and the colors black and white. Complementary colors are easily
calculated by subtracting the Color values from 255. For example, the color
(0, 0,255) is a pure blue tone.
2
Adding a color to its complement gives white.
It is noticed that the components of the colors at the corners of the cube have
either zero or full intensity.
As we move from one corner to another along the same edge of the cube,
only one of its components changes value. For example, as we move from
the Green to the Yellow corner, the Red component changes from 0 to 255.
Although we can specify more than 16 million colors, we can’t have more
than 256 shades of Gray. The reason is that a gray tone, including the two
extremes (black and white), is made up of equal values of all the three
primary colors. This is seen from the RGB cube as well. Gray shades lie on
the cube’s diagonal that goes from black to white. As we move along this
path, all three basic components change value, but they are always equal.
The value (128,128,128) is a mid-gray tone
That's why it is wasteful to store grayscale pictures using 16-million color
True Color file formats.
Once an image is known in grayscale, we needn’t store all three bytes
per pixel. One value is adequate (the other two components have the
same value).
HSL and HSV are two related representations of points in an RGB color space,
which attempt to describe perceptual color relationships more accurately than
RGB, while remaining computationally simple.
HSL stands for hue, saturation, lightness, while HSV stands for hue,
saturation, value.
3
Hue: the color type (such as red, blue, or yellow). a blue car reflects blue hue.
The hue which is essentially the chromatic component of our perception may again
be considered as weak hue or strong hue.
The gray colors do not have any hue and hence they have less saturation or
unsaturated. Saturation is thus a measure of colorfulness or whiteness in the color
perceived.
The lightness (L) or intensity (I) or value (V) : essentially provides a measure of
the brightness of colors. This gives a measure of how much light is reflected from
the object or how much light is emitted from a region.
The HSV model is commonly used in computer graphics applications. The HSV
color space is compatible with human color perception
The HSV image may be computed from RGB image using different
transformation. Some of them are as follows:
S= 1-(min(R, G, B)/V)
V= (R+G+B/3)
H = H+360 if H<0
Y
Cb =
Cr
5
4.4 Basic Relationships between Pixels
In this section, several important relationships between pixels in a digital image are
considered. As mentioned before, an image is denoted by f(x, y).When referring in
this section to a particular pixel.
1. Neighbors of a Pixel
a. N4(p) : four neighbors of pixel P.
Any pixel p(x, y) has two vertical and two horizontal neighbors, given
by: (x+1,y), (x-1, y), (x, y+1), (x, y-1)
This set of pixels are called the 4-neighbors of P, and is denoted by
N4(P)
Each of them is at a unit distance from P., and some of the neighbors
of p lie outside the digital image if (x, y) is on the border of the image.
6
2. Adjacency
Two pixels are connected if they are neighbors and their gray levels
satisfy some specified criterion of similarity.
For example, in a binary image two pixels are connected if they are 4-
neighbors and have same value (0/1)
Let v: a set of intensity values used to define adjacency and connectivity.
In a binary Image v={1}, if we are referring to adjacency of pixels with
value 1.
In a Gray scale image, the idea is the same, but v typically contains more
elements,for example v= {180, 181, 182,....,200}.
If the possible intensity values 0 to 255, v set could be any subset of these
256 values.
7
Chapter Five
Image Compression
5.1 Introduction
In general, data compression is defined as the process of encoding data using
a representation that reduces the overall size of data. This reduction is
possible when the original dataset contains some type of redundancy.
Digital image compression is a field that studies methods for reducing the
total number of bits required to represent an image. Image compression
involves reducing the size of image data file, while is retaining necessary
information, the reduced file is called the compressed file and is used to
reconstruct the image, resulting in the decompressed image. The original image,
before any compression is performed, is called the uncompressed image file. The
ratio of the original, uncompressed image file and the compressed file is referred to
as the compression ratio.
= 65536 bytes
8
65536
Compression ratio = 6554
≈ 10
2. Number of Bits
Bits per Pixel
Number of Pixels
Example: An original image 256X256 pixels, 256 level gray scale can
be compressed file size 6554 byte.
Original Image Size = 256X256 (pixels) * 1 (byte/pixel)
= 65536 bytes
Compressed file = 6554 (bytes) * 8 (bits/pixel)
= 52432 bits
52432
Bit per Pixel = 65536
=¿ 0.8 bit / pixel
9
Reducing Data but Retaining Information,
DATA are used to convey information
For digital images, data refer to pixel gray-level values which
correspond to the brightness of a pixel at a point in space. Information
is interpretation of the data in a meaningful way. Data are used to
convey information, much like the way the alphabet is used to convey
information via words. Information is an elusive concept, it can be
application specific. For example, in a binary image that contains text
only, the necessary information may only involve the text being
readable, whereas for a medical image the necessary information may
be every minute detail in the original image.
11
1. All original data can be recovered 1. Reduces a file by permanently
when the file is uncompressed every eliminating certain information,
single bit of data that was originally especially redundant information
in the file remains after the file is
uncompressed. 2. When the file is uncompressed, only
a part of the original information is
2. All of the information is completely still there (although the user may not
restored notice it)
4. The Graphics Interchange File (GIF) 4. The JPEG image file, commonly
is an image format used on the Web used for photographs and other
that provides lossless compression. complex still images on the Web, is
an image that has lossy
compression.
12
coding redundancy. The lossless decompressor is a perfect inverse process of the
lossless compressor.
Where:
nk
Pi = The probability of the ith gray level
N2
n k = the total number of pixels with gray value k.
L = the total number of gray levels (e.g. 256 for 8-bits)
13
Entropy=-Plog(P
1/8log (1/8)=3
N
Mean Square Error (MSE) σ2, 2 1
N (x
n 1
n yn ) 2 ----- -------- (5.1)
14