agenda last class: memory, digitizing numbers today: digitizing: –text –sound – skip...

39
Agenda • Last class: Memory, Digitizing Numbers • Today: Digitizing: – Text – Sound – skip – Pictures – Movies Software Quiz

Upload: egbert-shelton

Post on 03-Jan-2016

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: –Text –Sound – skip –Pictures –Movies Software Quiz

Agenda

• Last class: Memory, Digitizing Numbers

• Today: Digitizing:– Text– Sound – skip– Pictures– Movies

Software Quiz

Page 2: Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: –Text –Sound – skip –Pictures –Movies Software Quiz

Warm up Questions

• What is the biggest number I can get with 3 binary bits?

• How few binary bits do I need to save the number “123”?

Page 3: Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: –Text –Sound – skip –Pictures –Movies Software Quiz

Warm up Questions

• What is the biggest number I can get with 3 binary bits?– 111 = 1 x 22 + 1 x 21 + 1 x 20 = 7

• How few binary bits do I need to save the number “123”?– 1, 2, 4, 8, 16, 32, 64, 128 - too big

So 7 bits

Page 4: Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: –Text –Sound – skip –Pictures –Movies Software Quiz

Digitizing Text

• When you send a text message, the letters abcd... ABCD.. <>,.;_+-*/[ ]” etc. are also changed into numbers.

• ASCII Code (1968)– American Standard Code for Information Interchange

Eg: 65 = A, 97 = a

• H e l l o ! text72 101 108 108 111 33 number

binary

Page 5: Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: –Text –Sound – skip –Pictures –Movies Software Quiz

ASCII Table

Page 6: Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: –Text –Sound – skip –Pictures –Movies Software Quiz

Digitizing Pictures

• A picture is just a table of numbers

• The screen is many small pixels– Each pixel has 1 number– Resolution: number of pixels– Black & White = 0 & 1 (1 bit)

0 0 0 0 0 0 0

0 1 1 1 1 1 0

0 1 1 1 1 1 0

0 1 1 1 1 1 0

0 0 0 0 0 0 0

Page 7: Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: –Text –Sound – skip –Pictures –Movies Software Quiz

Resolution Example

• Small resolution (3x3)

• 6x6

1 0 1

0 1 0

1 0 1

1 1 0 0 1 1

1 0 1 1 0 1

0 1 1 1 1 0

0 1 1 1 1 0

1 0 1 1 0 1

1 1 0 0 1 1

Page 8: Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: –Text –Sound – skip –Pictures –Movies Software Quiz

Resolution Example

• More resolution = more pixels– Can draw smaller details– NOT size of picture!

• Copy following diagram

• Show binary for pix

• Black = 0 White 1

• How many bytes? (ignore red)

Page 9: Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: –Text –Sound – skip –Pictures –Movies Software Quiz

Resolution Example

• More resolution = more pixels– Can draw smaller details– NOT size of picture!

• Copy following diagram

• Show binary for pix

• Black = 0 White 1

• How many bytes?

Page 10: Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: –Text –Sound – skip –Pictures –Movies Software Quiz

Resolution Example

• More resolution = more pixels– Can draw smaller details– NOT size of picture!

• Copy following diagram

• Show binary for pix

• Black = 0 White= 1

• How many bytes?

Page 11: Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: –Text –Sound – skip –Pictures –Movies Software Quiz

Resolution Example

• More resolution = more pixels– Can draw smaller details– NOT size of picture!

Page 12: Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: –Text –Sound – skip –Pictures –Movies Software Quiz

Gray Scale– 1 bit = 0 or 1 = black or white

More bits = gray scale– 4 bits

– 8 bits

Page 13: Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: –Text –Sound – skip –Pictures –Movies Software Quiz

1111 15

1110 14

1101 13

1100 12

1011 11

1010 10

1001 9

1000 8

0111 7

0110 6

0101 5

0100 4

0011 3

0010 2

0001 1

0000 0

4 bit Gray Scale

16 numbers

16 different shades

Page 14: Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: –Text –Sound – skip –Pictures –Movies Software Quiz

Gray scale

1 Bit

each pixel 0 or 1

2 Bits

00011011

4 Bits 8 Bits

Each pixel00000000

Page 15: Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: –Text –Sound – skip –Pictures –Movies Software Quiz

Digitizing Colour

• Each pixel has a Red Green Blue number– Example:

• A red pixel has 100

• A white pixel has 111

– Example:The red circle withblue inside using6x6 pixel resolution

R G B

1 0 0

111 111 100 100 111 111

111 100 001 001 100 111

100 001 001 001 001 100

100 001 001 001 001 100

111 100 001 001 100 111

111 111 100 100 111 111

Page 16: Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: –Text –Sound – skip –Pictures –Movies Software Quiz

Digitizing Colour

• 3-bit colour = 8 colours

111 110 101 100 011 010 001 000

Page 17: Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: –Text –Sound – skip –Pictures –Movies Software Quiz

More bits = More colours

8-bit

Color

256

colors

Page 18: Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: –Text –Sound – skip –Pictures –Movies Software Quiz

3, 6, 9, 12, 15, 18, 24 bit RGB

Page 19: Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: –Text –Sound – skip –Pictures –Movies Software Quiz
Page 20: Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: –Text –Sound – skip –Pictures –Movies Software Quiz

Picture File Size• Paint – default size is 512 x 385 pixels =

197120 pixels• If each pixel holds 1 bit (black or white)

– 197120 pixels x 1 bit / pixel = 197120 bits197120 / 8 = 24640 bytes

• What if each pixel holds 8 bit colour?– 197120 pixels x 8 bits / pixel x 1 byte / 8 bits =

197120 bytes

• 24 bit colour? 591360 bytes!Lots of 1 & 0, bumps on a CD, load time!

Page 21: Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: –Text –Sound – skip –Pictures –Movies Software Quiz

Digitizing Pictures Summary

• Applications:– Computer screen, TV screen– Cell phone, iPod screen– Digital Camera

Page 22: Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: –Text –Sound – skip –Pictures –Movies Software Quiz

Digitizing Videos

• A video is just many pictures

• Like a cartoon animation or flip book

• Quality depends on frame rate– Frames per second (FPS)– Higher FPS = smoother

• Movie: 24 FPS• TV: 30 FPS

Page 23: Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: –Text –Sound – skip –Pictures –Movies Software Quiz

0 0

0 0

0 0

0 0

0

0

0

0

0

0

0 0

0

0 0

Page 24: Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: –Text –Sound – skip –Pictures –Movies Software Quiz

0 0

0 0

0 0

0 0

0

0

0

0

0

0

0 0

0 0

0 0 0

Page 25: Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: –Text –Sound – skip –Pictures –Movies Software Quiz

0 0

0 0

0 0

0 0

0

0

0

0

0

0

0 0

0 0

0 0 0 0

Page 26: Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: –Text –Sound – skip –Pictures –Movies Software Quiz

0 0

0 0

0 0

0 0

0

0

0

0

0

0

0 0

0 0

0 0 0 0

Page 27: Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: –Text –Sound – skip –Pictures –Movies Software Quiz

0 0

0 0

0 0

0 0

0

0

0

0

0

0

0 0

0 0

0 0 0 0

Page 28: Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: –Text –Sound – skip –Pictures –Movies Software Quiz

0 0

0 0

0 0

0 0

0

0

0

0

0

0

0 0

0 0

0 0 0 0

Page 29: Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: –Text –Sound – skip –Pictures –Movies Software Quiz

0 0

0 0

0 0

0 0

0

0

0

0

0

0

0 0

0 0

0 0 0 0

Page 30: Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: –Text –Sound – skip –Pictures –Movies Software Quiz

0 0

0 0

0 0

0 0

0

0

0

0

0

0

0 0

0 0

0 0 0 0

Page 31: Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: –Text –Sound – skip –Pictures –Movies Software Quiz

0 0

0 0

0 0

0 0

0

0

0

0

0

0

0 0

0 0

0 0 0 0

Page 32: Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: –Text –Sound – skip –Pictures –Movies Software Quiz

0 0

0 0

0 0

0 0

0

0

0

0

0

0

0 0

0 0

0 0 0 0

Page 33: Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: –Text –Sound – skip –Pictures –Movies Software Quiz

0 0

0 0

0 0

0 0

0

0

0

0

0

0

0 0

0 0

0 0 0 0

Page 34: Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: –Text –Sound – skip –Pictures –Movies Software Quiz

0 0

0 0

0 0

0 0

0

0

0

0

0

0

0 0

0 0

0 0 0 0

Page 35: Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: –Text –Sound – skip –Pictures –Movies Software Quiz

Digitizing Videos

• So if your iPhone records at 30 FPS at 640 x 480 resolution, you are saving– 30 pictures per second– Each picture has 640 x 480 pixels– Each pixel has 12 bit RGB colour– 12 x 640 x 480 / 8 = 460,800 bytes

almost 0.5 MB for ONE frame of video!– 0.5 MB x 30 frames / second x 1 s video?

= 13.8 MB for a 1-second video!!= 110400000 bits for a 1-second movie!!

Page 36: Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: –Text –Sound – skip –Pictures –Movies Software Quiz

Digitizing Videos

13.8 MB for a 1 second video

videobytes

MB

bits

byte

pixel

bits

frame

pixelsframes

1

sec1

10000008

12480640

sec

30

Page 37: Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: –Text –Sound – skip –Pictures –Movies Software Quiz

Digitizing Videos

• Research & Careers:– How to make the file size smaller?

• Reduce FPS?• Reduce pixel resolution?• Reduce colour resolution?

– Compress information – do you need ALL of it?– Make smaller computer chips that can store

more MB or GB of memory

Page 38: Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: –Text –Sound – skip –Pictures –Movies Software Quiz

Homework

• Number Systems worksheet

• Notes – fill in

Page 39: Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: –Text –Sound – skip –Pictures –Movies Software Quiz

Digitizing Sounds / Voice

• When you talk, you make sound waves like this:• To turn it into numbers, you must pick some

points = SAMPLING (done by microphone)– Eg: every 0.5 s, or 2 Hz

• The more frequently you sample, the higher the quality– Too slow? Wrong signal.– Some high frequency information will be lost.

Your voice sounds different.– Too much? Takes more memory / bytes to store it