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”?
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
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
ASCII Table
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
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
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)
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?
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?
Resolution Example
• More resolution = more pixels– Can draw smaller details– NOT size of picture!
Gray Scale– 1 bit = 0 or 1 = black or white
More bits = gray scale– 4 bits
– 8 bits
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
Gray scale
1 Bit
each pixel 0 or 1
2 Bits
00011011
4 Bits 8 Bits
Each pixel00000000
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
Digitizing Colour
• 3-bit colour = 8 colours
111 110 101 100 011 010 001 000
More bits = More colours
8-bit
Color
256
colors
3, 6, 9, 12, 15, 18, 24 bit RGB
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!
Digitizing Pictures Summary
• Applications:– Computer screen, TV screen– Cell phone, iPod screen– Digital Camera
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
0 0
0 0
0 0
0 0
0
0
0
0
0
0
0 0
0
0 0
0 0
0 0
0 0
0 0
0
0
0
0
0
0
0 0
0 0
0 0 0
0 0
0 0
0 0
0 0
0
0
0
0
0
0
0 0
0 0
0 0 0 0
0 0
0 0
0 0
0 0
0
0
0
0
0
0
0 0
0 0
0 0 0 0
0 0
0 0
0 0
0 0
0
0
0
0
0
0
0 0
0 0
0 0 0 0
0 0
0 0
0 0
0 0
0
0
0
0
0
0
0 0
0 0
0 0 0 0
0 0
0 0
0 0
0 0
0
0
0
0
0
0
0 0
0 0
0 0 0 0
0 0
0 0
0 0
0 0
0
0
0
0
0
0
0 0
0 0
0 0 0 0
0 0
0 0
0 0
0 0
0
0
0
0
0
0
0 0
0 0
0 0 0 0
0 0
0 0
0 0
0 0
0
0
0
0
0
0
0 0
0 0
0 0 0 0
0 0
0 0
0 0
0 0
0
0
0
0
0
0
0 0
0 0
0 0 0 0
0 0
0 0
0 0
0 0
0
0
0
0
0
0
0 0
0 0
0 0 0 0
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!!
Digitizing Videos
13.8 MB for a 1 second video
videobytes
MB
bits
byte
pixel
bits
frame
pixelsframes
1
sec1
10000008
12480640
sec
30
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
Homework
• Number Systems worksheet
• Notes – fill in
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
Top Related