session 05 data representation - wordpress.com · 10/4/2015  · data representation • methods...

32
Session 05 Data Representation

Upload: others

Post on 15-Apr-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Session 05 Data Representation - WordPress.com · 10/4/2015  · Data Representation • Methods used internally to represent information stored in a computer • Different types

Session 05

Data Representation

Page 2: Session 05 Data Representation - WordPress.com · 10/4/2015  · Data Representation • Methods used internally to represent information stored in a computer • Different types

Data Representation

• Methods used internally to represent information stored in a computer

• Different types of information

– Numbers

– Text

– Graphics (Picture, video, animation)

– Sound

– Data

• All types of information are stored in a computer through a sequence of 0's and 1's.

• Such value is called a binary digit or bit

2

Page 3: Session 05 Data Representation - WordPress.com · 10/4/2015  · Data Representation • Methods used internally to represent information stored in a computer • Different types

Data (0 and 1)

• Logically 0, 1

• Physically 0v , 5v

• Bit

– A bit is the smallest data on a machine 0 or 1

3

Page 4: Session 05 Data Representation - WordPress.com · 10/4/2015  · Data Representation • Methods used internally to represent information stored in a computer • Different types

Storage

8 Bits = 1 Byte

1024 Bytes = 1 Kilobyte (KB)

1024 KB = 1 Megabyte (MB)

1024 MB = 1 Gigabyte (GB)

1024 GB = 1 Terabyte (TB)

Example:

How many bits available for the 1.45 MB data file

4

Page 5: Session 05 Data Representation - WordPress.com · 10/4/2015  · Data Representation • Methods used internally to represent information stored in a computer • Different types

Number Systems

• Binary System { 0,1 }

• Octal System { 0,1,2,3,4,5,6,7 }

• Decimal System { 0,1,2,3,4,5,6,7,8,9 }

• Hexadecimal System

{ 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F }

5

Page 6: Session 05 Data Representation - WordPress.com · 10/4/2015  · Data Representation • Methods used internally to represent information stored in a computer • Different types

Number conversion

• Decimal to binary

• Decimal to Octal

• Decimal to Hexadecimal

• Example

13410 → 100001102, 2068, 8616

6

Binary

OctalDecima

l

Hex decimal

Page 7: Session 05 Data Representation - WordPress.com · 10/4/2015  · Data Representation • Methods used internally to represent information stored in a computer • Different types

Decimal /Octal/

Hexadecimal

• Binary to Octal

10 101 010 111

• Binary to Hexadecimal

101 0101 0111

7/11/2015 Budditha Hettige ([email protected]) 7

Page 8: Session 05 Data Representation - WordPress.com · 10/4/2015  · Data Representation • Methods used internally to represent information stored in a computer • Different types

Data Representation

8

Keyword Description Size/Format

byte Byte-length integer 8-bit two's complement

short Short integer 16-bit two's complement

int Integer 32-bit two's complement

long Long integer 64-bit two's complement

float Single-precision floating point 32-bit IEEE

double Double-precision floating point 64-bit IEEE

char A single character 16-bit Unicode character

boolean A boolean value (true or false) true or false

Page 9: Session 05 Data Representation - WordPress.com · 10/4/2015  · Data Representation • Methods used internally to represent information stored in a computer • Different types

Integer numbers

9

type Size Range

name bytes bits minimum maximum

byte 1 8 -128 +127

short 2 16 -32,768 +32,767

int 4 32 -2,147,483,648 +2,147,483,647

long 8 64 -9,223,372,036,854,775,808 +9,223,372,036,854,775,807

Page 10: Session 05 Data Representation - WordPress.com · 10/4/2015  · Data Representation • Methods used internally to represent information stored in a computer • Different types

Character Representation

• ASCII

– American Standard Code for Information

Interchange (ASCII)

– 27 = 128 characters can be represented by ASCII

• Unicode

– Unicode: 16-bit system that can encode the

characters of most languages

– 16 bits = 216 = 65,636 characters

10

Page 11: Session 05 Data Representation - WordPress.com · 10/4/2015  · Data Representation • Methods used internally to represent information stored in a computer • Different types

ASCII

11

Page 12: Session 05 Data Representation - WordPress.com · 10/4/2015  · Data Representation • Methods used internally to represent information stored in a computer • Different types

Sinhala Unicode

12

Page 13: Session 05 Data Representation - WordPress.com · 10/4/2015  · Data Representation • Methods used internally to represent information stored in a computer • Different types

Example

• What are the ASCII Value for the following Name

– Budditha

• What are the ASCII Values for the following Keys

– Enter

– Scape

– Space

• What are the ASCII Value for the following Name

– සමරපාල

7/11/2015 Budditha Hettige ([email protected]) 13

Page 14: Session 05 Data Representation - WordPress.com · 10/4/2015  · Data Representation • Methods used internally to represent information stored in a computer • Different types

Computer Images

Computational Model of Grammar for English to

14

Page 15: Session 05 Data Representation - WordPress.com · 10/4/2015  · Data Representation • Methods used internally to represent information stored in a computer • Different types

What is Computer image?

• visual representation of an object or scene or person

or abstraction produced on a surface

• Types

– Vector image

– Raster image

15

Page 16: Session 05 Data Representation - WordPress.com · 10/4/2015  · Data Representation • Methods used internally to represent information stored in a computer • Different types

Raster Images

• Raster image is used raster graphics to display

images

• data structure representing a generally rectangular

grid of pixels

16

Page 17: Session 05 Data Representation - WordPress.com · 10/4/2015  · Data Representation • Methods used internally to represent information stored in a computer • Different types

Vector Image

• vector graphics to display images

• geometrical primitives such as points, lines, curves,

and polygons, which are all based upon

mathematical equations to represent images in

computer graphics

17

Page 18: Session 05 Data Representation - WordPress.com · 10/4/2015  · Data Representation • Methods used internally to represent information stored in a computer • Different types

Colour representation

• RGB

• CMYK

• Lab

18

Page 19: Session 05 Data Representation - WordPress.com · 10/4/2015  · Data Representation • Methods used internally to represent information stored in a computer • Different types

RGB colour mode

• Red, Green, and Blue light are added together in

various ways

• three additive primary colors, red, green, and blue

• the RGB color model is the display of colors on a

cathode ray tube (CRT), liquid crystal display(LCD)

or plasma display

19

Page 20: Session 05 Data Representation - WordPress.com · 10/4/2015  · Data Representation • Methods used internally to represent information stored in a computer • Different types

CMYK Mode

• Cyan, magenta, yellow, and key (black)

• CMYK model works by partially or entirely masking

certain colors on the typically white background

• save money on ink, and to produce deeper black

tones

20

Page 21: Session 05 Data Representation - WordPress.com · 10/4/2015  · Data Representation • Methods used internally to represent information stored in a computer • Different types

Lab color

• individual channels: "L" indicates the luminance, "a"

the green-red chrominance and "b" the blue-yellow

chrominance

• well suited for modifying the brightness of an image

without changing the colours and saturation values

• Lab color is designed to approximate human vision

21

Page 22: Session 05 Data Representation - WordPress.com · 10/4/2015  · Data Representation • Methods used internally to represent information stored in a computer • Different types

Computer Images/ Graphics

• A computer screen consist of pixels

• Pixel has two properties: its location on the screen

and its color

• graphic image can be represented by a list of pixels

– A 16 color image requires 4 bits per pixel

– 24 bits per pixel, which provides an astounding

array of 16.7 million possible colors for each pixel

22

Page 23: Session 05 Data Representation - WordPress.com · 10/4/2015  · Data Representation • Methods used internally to represent information stored in a computer • Different types

Raster formats

7/11/2015 Budditha Hettige ([email protected]) 23

• Raster graphics image is a dot matrix data structure

representing a generally rectangular grid of pixels, or points of

color, viewable via a monitor, paper, or other display medium

• File Format

– JPEG (Joint Photographic Experts Group)

– TIFF (Tagged Image File Format)

– GIF (Graphics Interchange Format)

– BMP

– PNG (Portable Network Graphics)

Page 24: Session 05 Data Representation - WordPress.com · 10/4/2015  · Data Representation • Methods used internally to represent information stored in a computer • Different types

Vector formats

• vector image formats contain a geometric

description which can be rendered smoothly at any

desired display size.

– SVG (Scalable Vector Graphics)

– PPT

– VML

– AI (Adobe Illustrator Artwork)

– CDR (CorelDRAW)

7/11/2015 Budditha Hettige ([email protected]) 24

Page 25: Session 05 Data Representation - WordPress.com · 10/4/2015  · Data Representation • Methods used internally to represent information stored in a computer • Different types

Compound formats

• These are formats containing both pixel and vector data, possible other data, e.g. the interactive features of PDF.

– EPS (Encapsulated PostScript)

– PDF (Portable Document Format)

– PostScript, a page description language with strong graphics capabilities

– PICT (Classic Macintosh QuickDraw file)

– SWF (Shockwave Flash)

– XAML User interface language using vector graphics for images.

7/11/2015 Budditha Hettige ([email protected]) 25

Page 26: Session 05 Data Representation - WordPress.com · 10/4/2015  · Data Representation • Methods used internally to represent information stored in a computer • Different types

Image Formats

7/11/2015 Budditha Hettige ([email protected]) 26

Page 27: Session 05 Data Representation - WordPress.com · 10/4/2015  · Data Representation • Methods used internally to represent information stored in a computer • Different types

Audio Data

7/11/2015 Budditha Hettige ([email protected]) 27

Page 28: Session 05 Data Representation - WordPress.com · 10/4/2015  · Data Representation • Methods used internally to represent information stored in a computer • Different types

Sound

• Analog signals are converted to digital signals at

a given sampling rate and bit resolution

28

4 Bit

Page 29: Session 05 Data Representation - WordPress.com · 10/4/2015  · Data Representation • Methods used internally to represent information stored in a computer • Different types

Sound file format

• File format for storing digital audio data on a

computer system.

• The bit layout of the audio data (excluding

metadata) is called the audio coding format and can

be compressed or uncompressed

• Format types

– Uncompressed audio format

– Lossless compressed audio format

– Lossy compressed audio format

7/11/2015 Budditha Hettige ([email protected]) 29

Page 30: Session 05 Data Representation - WordPress.com · 10/4/2015  · Data Representation • Methods used internally to represent information stored in a computer • Different types

Audio file formats

• Uncompressed audio formats

– WAV, AIFF, AU or raw header-less PCM;

• Formats with lossless compression

– FLAC, WavPack, TTA, ATRAC, MPEG-4 SLS,

• Formats with lossy compression,

– Opus, MP3, Vorbis, Musepack, AAC, ATRAC and

Windows Media Audio Lossy (WMA)

7/11/2015 Budditha Hettige ([email protected]) 30

Page 31: Session 05 Data Representation - WordPress.com · 10/4/2015  · Data Representation • Methods used internally to represent information stored in a computer • Different types

Video Files

• file format for storing digital video data on a

computer system.

• Video is almost always stored in compressed form to

reduce the file size.

• File format

– AVI

– MP4

– WMV

7/11/2015 Budditha Hettige ([email protected]) 31

Page 32: Session 05 Data Representation - WordPress.com · 10/4/2015  · Data Representation • Methods used internally to represent information stored in a computer • Different types

Data file format

• Executable and link files

– EXE

– DLL

– COM

• Document files

– DOC

– DOTX

– PPT

7/11/2015 Budditha Hettige ([email protected]) 32