Lesson 4 Data Representation - Text, Sound, Images
Lesson 4 Data Representation - Text, Sound, Images
SURAJ MOTEE
Data Storage
VIDEOS
TEXT
What is text?
Series of characters stored on a computer.
Examples:
A character, A Word, Series of words and sentence
1. ‘A’
2. ‘Sam’
3. ‘He is’
4. ‘This is an online class’
Character Sets- ASCII Codes
1. The ASCII code system (American Standard Code for Information
Interchange) was set up in 1963 for use in communication
systems and computer systems.
2. Each character used on a keyboard has what is known as an ASCII
CODE
3. The standard ASCII code character set consists of 7-bit codes.
Standard ASCII CODE
Extended ASCII CODE
Extended ASCII uses 8-bit codes (0 to 255 in denary or 0 to
FF in hexadecimal).
This gives another 128 codes to allow for characters in
non-English alphabets and for some graphical characters to
be included
Extended ASCII TABLE
Disadvantage of ASCII
It does not represent characters in non-Western languages, for example
Chinese
characters.
SOLUTION: UNICODE
UNICODE
1. Unicode can represent all languages of the world, thus supporting
many operating systems, search engines and internet browsers
used globally.
2. There is overlap with standard ASCII code, since the first 128
(English) characters are the same, but Unicode can support several
thousand different characters in total.
3. ASCII uses one byte to represent a character, whereas Unicode will
support up to four bytes per character.
UNICODE
Sound
Representation of sound
1. Soundwaves are vibrations in the air. The human ear
senses these vibrations and interprets them as sound.
2. Each sound wave has a frequency, wavelength and
amplitude. The amplitude specifies the loudness of the
sound.
Analogue Sound Wave
Analogue Sound
Sound waves vary continuously. This means that sound is
analogue.
Computers cannot work with analogue data, so sound
waves need to be sampled in order to be stored in a
computer.
Sampling
Sampling means measuring the amplitude of the sound wave.
This is done using an analogue to digital converter (ADC).
To convert the analogue data to digital, the sound waves are
sampled at regular time intervals.
The amplitude of the sound cannot be measured precisely, so
approximate values are stored.
Sampling
The x-axis shows the time intervals when the
sound was sampled (1 to 21), and the y-axis
shows the amplitude of the sampled sound to
10.
At time interval 1, the approximate
amplitude is 10; at time interval 2, the
approximate amplitude is 4, and so on for all
20 time intervals.
Because the amplitude range in Figure is 0 to
10, then 4 binary bits can be used to represent
each amplitude value
9 is represented as value 1001
Sampling Resolution
Increasing the number of possible values used to represent sound
amplitude also increases the accuracy of the sampled sound (for
example, using a range of 0 to 127 gives a much more accurate
representation of the sound sample than using a range of, for
example, 0 to 10).
The number of bits per sample is known as the sampling resolution
(also known as the bit depth). So, in our example, the sampling
resolution is 4 bits.
How is sampling used?
the amplitude of the sound wave is first determined at set time intervals (the
sampling rate)
this gives an approximate representation of the sound wave
each sample of the sound wave is then encoded as a series of binary digits.
Sampling Rate
Sampling rate is the number of sound samples
taken per second.
This is measured in hertz (Hz), where 1 Hz means
‘one sample per second’.
Benefit and drawbacks of higher
sampling rate.
Using a higher sampling rate or larger resolution will result
in a more faithful representation of the original sound
source.
However, the higher the sampling rate and/or sampling
resolution, the greater the file size.
Calculating file size: Recap
Calculating file size of sound.
Exercise
An audio CD has a sample rate of 44 100 and a sample
resolution of 16 bits. The music being sampled uses two
channels to allow for stereo recording.
Calculate the file size for a 60-minute recording.
Exercise: Solution
Images
Representation of images
Bitmap
Vector
Bitmap Images
Bitmap images are made up of pixels (picture elements);
an image is made up of a two-dimensional matrix of pixels.
Each pixel can be represented as a binary number, and so
a bitmap image is stored in a computer as a series of binary
numbers
Bitmap images and pixels
a black and white image only requires 1 bit per pixel – this means
that each pixel can be one of two colours, corresponding to either 1
or 0
if each pixel is represented by 2 bits, then each pixel can be one of
four colours (22 = 4), corresponding to 00, 01, 10, or 11
if each pixel is represented by 3 bits then each pixel can be one of
eight colours (23 = 8), corresponding to 000, 001, 010, 011, 100, 101,
110, 111.
Color Depth
1. The number of bits used to represent each colour is
called the colour depth.
2. An 8 bit colour depth means that each pixel can be
one of 256 colours.
Image Resolution
Image resolution refers to the number of pixels that make
up an image; for example, an image could contain 4096 ×
3072 pixels (12 582 912 pixels in total).
Calculation of file size: Bitmap
Images
Exercise:
A camera detector has an array of 2048 by 2048 pixels and uses a colour depth of 16. Find the
size of an image taken by this camera in MiB.
Exercise (Answer)
Vector Images
Vector Graphics
Vector graphics are images that use 2D points to describe lines and
curves and their properties that are grouped to form geometric
shapes.
Vector graphics can be designed using computer aided design
(CAD) software or using an application which uses a drawing canvas
on the screen.
Comparison vector v/s bitmap