Course overview

advertisement
Encoding images
Skills: none
Concepts: an image representation code, the number
of bits in a code, the amount of information in an
image
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike
3.0 License.
Where does this topic fit?
• Internet concepts
– Applications
– Technology
– Implications
• Internet skills
– Application development
– Content creation
– User skills
Encoding image data
Data type
Decade
Numeric
1950s
Alphanumeric
1960s
Text
1970s
Image
1990s
Speech
2000s
Music
2000s
Video
2000s
HD video
2010s
All data is binary
010101011100101010101010101010111010
101010101010101010101010100101010101
000010110101010101010010101101101010
101010110010110010101010100101110101
001010010101010101010001001010101011
010011010010101010100101101001011100
101010101001010101000101010101010101
010010101001010101001001001001010101
001000101010101110100101001010101010
010101010101001010100100101010010101
001001010101001010100101010100101010
101001010101011110101011100001111011
Data + a code → information
Let’s encode this image
Each pixel has a color
Each color has a code
12 colors, 12 codes
Color
Blue
Light green
Dark green
Yellow
Orange
Red
Purple
Light grey
Dark grey
Brown
Black
White
Code
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
The image is 800 by 500 pixels
The codes for a few pixels
1011
0000
0000
0000
1011
1011
0101
0101
How much memory or storage?
500 pixels
800 pixels
How much memory or storage?
500 pixels
800 pixels
• 500 x 800 = 400,000 pixels
• 4x400,000 = 1,600,000 bits
• 1,600,000/8 = 200,000 bytes
Could we have had more than 12 colors?
Color
Blue
Light green
Dark green
Yellow
Orange
Red
Purple
Light grey
Dark grey
Brown
Black
White
Code
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
Four unused combinations
Color
Blue
Light green
Dark green
Yellow
Orange
Red
Purple
Light grey
Dark grey
Brown
Black
White
Code
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
More bits means more unique codes
1-bit code
A 0
B 1
2-bit code
A 00
B 01
C 10
D 11
3-bit code
Do you see a pattern here?
A
B
C
D
E
F
G
H
000
001
010
011
100
101
110
111
4-bit code
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
What is the effect of adding a bit?
Start with a three bit code
A
B
C
D
E
F
G
H
000
001
010
011
100
101
110
111
What is the effect of adding a bit?
Make two copies
000
001
010
011
100
101
110
111
000
001
010
011
100
101
110
111
What is the effect of adding a bit?
Add a zero to one copy and 1 to the other
Doubling the number of possibilities
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
Adding a bit doubles the number of codes
3-bit code
A
B
C
D
E
F
G
H
000
001
010
011
100
101
110
111
4-bit code
A
B
C
D
E
F
G
H
0000
0001
0010
0011
0100
0101
0110
0111
I
J
K
L
M
N
O
P
1000
1001
1010
1011
1100
1101
1110
1111
Color depth
8 bits per pixel → 256 colors
16 bits per pixel → 65.5 thousand colors
24 bits per pixel → 16.7 million colors
32 bits per pixel → 4.3 billion colors
96% reduction – obvious information loss
Both have the same number of pixels – explain the loss of information.
1,080,000 pixels, no information
The amount of information in an image
Pixels ↑ information ↑
Bits per pixel ↑ possible colors ↑ information ↑
An image with a lot of information
http://som.csudh.edu/fac/lpress/presentations/telegeography2010cablemap.jpg
Even more information
http://www.dresden-26-gigapixels.com/dresden26GP
A library of information-rich images
http://gigapan.org/
Summary
Color
Blue
Light green
Dark green
Yellow
Orange
Red
Purple
Light grey
Dark grey
Brown
Black
White
Code
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
Self-study questions
An image is 800 by 500 pixels, and each pixel can be one of 12 colors. How
much memory would it require?
An image is 800 by 500 pixels, and each pixel can be one of 256 colors. How
much memory would it require?
How many different colors could one represent using an 8 bit code? A nine
bit code?
Can you write a formula to compute the number of unique codes possible
given the number of bits in a code?
Resources
Information rich images:
http://www.dresden-26-gigapixels.com/dresden26GP
http://som.csudh.edu/fac/lpress/presentations/telegeography2010cablemap.jpg
http://gigapan.org/
http://gigapixel.com
Download