Sunteți pe pagina 1din 27

Information Representation

Chapter 1

Abdul Hameed – BBS - SMG 1


Images
• Graphic images that
have been processed by
a computer can usually
be divided into two
distinct categories.
• Such images are either
bitmap files or vector
graphics.

Abdul Hameed – BBS - SMG 2


Bitmap Graphics
• Bitmap images are collections of bits that form an image.
• The image consists of a matrix of individual dots (or pixels)
that all have their own color (describe using bits)

• Pixel : The smallest possible addressable


area defined by a solid color, represented as
binary in an image.
• This example shows a Bitmap image with a
portion greatly enlarged in which the
individual pixels are rendered as a little
squares and can easily seen.

Abdul Hameed – BBS - SMG 3


Bitmap Graphics - Resolution
Image Resolution : How many pixels does an image contains
per inch/cm? The more pixels used to produce an image the
more detailed that image can be i.e,. Higher resolution.
• Example
A 10 Megapixel digital camera makes use of over 10
million pixels per image thus offering a very high
photographic quality.

Abdul Hameed – BBS - SMG 4


Bitmap Graphics - Resolution
Screen Resolution : The
screen resolution tells you
how many pixels your screen
can display horizontally and
vertically.
It is written in the form 1024
x 76.
In this example, the screen
can show 1024 pixels
horizontally and 768 pixels
vertically

Abdul Hameed – BBS - SMG 5


Different video display format

Abdul Hameed – BBS - SMG 6


Calculating screen resolutions
• Using the diagram above we are going to work out how
many pixels are required to display a single frame on a VGA
screen
Checking resolution
Height : 480
width : 640
Area = Width x Height = Total pixels
Area = 480 x 640 = 307200 pixels to display on a VGA
screen

Abdul Hameed – BBS - SMG 7


Color depth
• The number
of bits used
to represent
the color of a
single pixel.

Abdul Hameed – BBS - SMG 8


Bitmap file header

• A file header is a ‘signature place at the beginning of a file,


so the operating system and other software know what to do
with the content of the file.
• Example : Consider that a bitmap file is needed to fill a
laptop screen where the resolution is 1366 x 768. If the color
depth is to be 24 bits then number of bits needed is
1366 x 768 x 24 = 25178112 bits
• 25178112 bits = 3147264 bytes = 3073.5 KB = 3 MB apprx

Abdul Hameed – BBS - SMG 9


Vector Graphics

• Images defined using mathematics and


geometry objects such as points, lines, curves
and shapes or polygon(s).
• A vector graphic file contains a drawing list.
• This list contains a command for each object
included in an image. < rect…./> <line…/> etc.

Abdul Hameed – BBS - SMG 10


Vector Graphics – Important property

• The dimensions of the objects are not defined


explicitly but instead are defined relative to an
imaginary drawing canvas. i.e. image is scalable
• Whenever the image is to be displayed the file is
read, the appropriate calculations are made and
the objects are drawn to a suitable scale.
• This process cannot of itself cause distortion
(damage) of the image

Abdul Hameed – BBS - SMG 11


Comparison
Vector Image Bitmap Image

• Scale without file size • Images scale resulting in file


increase / decrease size increase / decrease
• Images scale without • Images distort(pixelate) when
distortion to the image. scaling
• Difficult to edit • Better for photo editing
• Require more processing • Require less processing
power to display power to display

Abdul Hameed – BBS - SMG 12


Sound
• Natural sound consists of variations in pressure which are
detected by the human ear.
• A typical sound contains a large number of individual waves
each with a defined frequency.
• The result is a wave form in which the amplitude of the
sound varies in a continuous but irregular pattern.

Abdul Hameed – BBS - SMG 13


Sound
• If there is a need to store sound or transmit it electronically the
original analogue sound signal has to be converted to a binary
code.
• A sound encoder has two components, the first is a band-limiting
filter.
• This remove high-frequency components.
• The other component is the encoder is an analogue to digital
converter (ADC)

Abdul Hameed – BBS - SMG 14


Sound – How ADC works
• The method of operation of the ADC shown
here.
• The amplitude of the wave(red line) has to be
sampled at regular intervals.
• The blue vertical lines indicate the sampling
times.
• The amplitude cant be measured exactly so
approximated by the closest

Abdul Hameed – BBS - SMG 15


Sound – ADC & DAC

Abdul Hameed – BBS - SMG 16


Sound Sampling
• Sampling Rate – Number of samples take per second
• Hertz(Hz) – The unit of frequency defined as the number of
cycles per second of a period.

Abdul Hameed – BBS - SMG 17


Sound Sampling
• To create digital sound as close to the real thing as possible
you need to take as many samples per second as you can.
• When recording MP3s you will normally use sampling rate
between 32000 or 44100 or 48000Hz (samples per second)
• That means that for a sampling rate of 44100 sound waves
will have been samples 44100 times per second.
• Recording the human voice requires a lower sampling rate
around 8000 Hz.

Abdul Hameed – BBS - SMG 18


Terminologies
• Sampling resolution : the number of bits assigned to each
sample
• Bit rate : the number of bits required to store 1 second of
sound.
File size = sample rate * resolution * length of sound
File size = Bit rate * length of sound
• Example : If you want to record a 30 second voice on your
mobile phone you would use the following
Sample rate = 8000 Hz
Sample resolution = 16 bit hence 8000 x 16 x 30
length of sound = 30 sec = 480 000 bytes needs
store 30 second voice
Abdul Hameed – BBS - SMG 19
Terminologies
• Sound Editing : If you are interested in sound editing you
can start editing your own music using a program called
Audacity.
• Using Audacity you can create your own sound samples
with different sample rates and sample resolution.
• Recording : Audacity can record live audio through
microphone or mixer.
• Import and Export : Import sound files, edit them, and
combine them with other files or new recordings . Export
your recordings in many different sample rates or formats.
• Editing : Editing the sound to remove noise and other
imperfections.
Abdul Hameed – BBS - SMG 20
Video

• Video is an electronic medium for the recording, copying


and broadcasting of moving visual images characteristics of
video streams.
• Frame rate: The number of still pictures per unit of time of
video ranges from six or eight frames per second to 120 or
more frame per second.

Abdul Hameed – BBS - SMG 21


Video – Interlaced Vs Progressive encoding
• Video can be interlaced or progressive.
• Interlacing was invented as a way to reduce flicker in early
mechanical and CRT video displays without increasing
number of frames per second.
• The image for each frame is split into two halves, one
containing the odd numbered lines and the other the even.
• The first half is displayed completely then the second half
follows.
• Progressive encoding where a full frame is displayed each
time. As improved transmission bandwidth become more
generally available .
• https://www.youtube.com/watch?v=H_o5h5SK_70

Abdul Hameed – BBS - SMG 22


Compression Techniques
• A file that needs to have its size reduce memory storage
requirements and improve transmission rates.
• There are two categories of compression .
• Lossless compression
• Lossy compression
• Lossless compression : Coding technique that allow
subsequent decoding to recreate exactly the original size
file.
• Lossy compression : Coding technique that cause some
information to be lost so that the exact original file cannot be
recovered in subsequent decoding.

Abdul Hameed – BBS - SMG 23


Compression Techniques

• A file contains text then compression must be lossless


because it is not sensible to allow any loss of information.
• One possible method would be Huffman coding.

Abdul Hameed – BBS - SMG 24


Huffman Coding Technique
• Each node of the tree are represented with a byte symbol and
the frequency of that byte on the data. The creation of the
Huffman tree have the following steps:
• Scan the data and calculate the frequency of occurrence of each byte;
• Insert those nodes into a reverse priority queue based on the
frequencies(a lowest frequency is given highest priority);
• Start a loop until the queue is empty;
• Remove two nodes from the queue and combine them into a internal
node with the frequency equal to the sum of the two nodes frequencies;
• Insert the two nodes removed from the queue as children of the created
internal node;
• Insert the created internal node into the queue;
• The last node remaining on the queue is the root of the tree.
• Using the text ABCBAACD as example and applying those
steps, we have the following tree:
Abdul Hameed – BBS - SMG 25
Huffman Coding Technique
• So the new representation of the bytes on the
text are:
A: 0
B: 10
C: 111
D: 110
• The original representation has 8 bytes(64 bits)
and the new representation have only 9 bits,
that is 86% smaller than the original.
• So the Huffman Coding turns to be a simple
and efficient way to encode data into a short
representations without loosing any piece of
information.
Abdul Hameed – BBS - SMG 26
Lossy Compression
• Lossy compression can be used in circumstance where a
sound file or an image file can be some of the detailed
coding removed or modified when it is likely that the human
ear or eye will hardly notice any difference.
• One example would be to reduce the colour depth for the
coding of a bitmap

Abdul Hameed – BBS - SMG 27

S-ar putea să vă placă și