Presentation is loading. Please wait.

Presentation is loading. Please wait.

Representing Nonnumeric Data Everything is really a number.

Similar presentations


Presentation on theme: "Representing Nonnumeric Data Everything is really a number."— Presentation transcript:

1 Representing Nonnumeric Data Everything is really a number

2 Its all 1’s and 0’s How do we represent other things? Words/Pictures/Sound? The trick is to come up with an encoding scheme…

3 Text To store English we need – Letters (upper case & lower) – Punctuation – Special marks (space, newline, etc…) Assigned each a number between 0 and 127 – A is 65, B is 66… – a is 97, b is 98… ASCII encoding : most popular such scheme

4 ASCII table DECOCTHEXBINSymbol 470572F00101111/ 4806030001100000 4906131001100011 5006232001100102 5106333001100113 5206434001101004 5306535001101015 5406636001101106 5506737001101117 5607038001110008 5707139001110019 580723A00111010: 590733B00111011; 600743C00111100< 610753D00111101= 620763E00111110> 630773F00111111? 641004001000000@ 651014101000001A 661024201000010B 671034301000011C 681044401000100D 691054501000101E 701064601000110F 711074701000111G 721104801001000H 731114901001001I Partial table  Full Table: http://www.ascii-code.com/ http://www.ascii-code.com/ A = 65 = 01000001 My name: Andrew 01000001 01101110 01100100 01110010 01100101 01110111

5 Text Why 0-127? – Well it seemed like enough – 127 is 2^7 – the biggest number you can write with 7 binary digits. Need more characters? – Extended ASCII – 8 bits (1 byte) – 256 characters – Unicode – universal scheme – up to 4 bytes per character http://unicode-table.com/en/#devanagari http://unicode-table.com/en/#devanagari

6 Basic Types of Graphics Two basic types of 2D graphic BitmapVector

7 Bitmaps Image divided into pixels – Each pixel either on (1) or off (0)

8 Adding gray 2 digits for each square give 4 “colors” (00, 01, 10, 11)

9 Adding gray 2 digits for each square give 4 “colors” (00, 01, 10, 11)

10 Image Size Image is 2000 pixels wide & 1000 pixels tall. 2000 x 1000 = 2,000,000 pixels Bits per Pixel24881 Number Colors16,777,216256 (color)256 (grays)2 Image Size 48,000,000 bits or ~5.7 MBytes 16,000,000 bits or ~1.9 MBytes 2,000,000 bits or ~244 KBytes

11 Vector Art Vector images are mathematically based – Everything described as lines and curves – Shapes are filled with solid color, gradients or patterns

12 Computer Sounds Two approaches to representing sound as numbers: – MIDI sequences – Samples

13 MIDI Musical Instrument Digital Interface – Sheet music for your computer. – Does not store actual sounds – just instructions for generating the sounds. Very compact Been around since the 60’s

14 Samples Sounds are just pressure waves:

15 Samples Simulate a wave with lots of data points – Intensities at points in time – Computer reconstructs wave from points


Download ppt "Representing Nonnumeric Data Everything is really a number."

Similar presentations


Ads by Google