Download presentation
Presentation is loading. Please wait.
Published byTheodora James Modified over 8 years ago
1
CS 101 – Sept. 14 Review Huffman code Image representation –B/W and color schemes –File size issues
2
Huffman Code We’re given set of letters used in message, and their frequencies. Here’s a 2 nd example: –Ex. P=5, N=10, D=10, L=15, A=20, S=20, E=30 Arrange frequencies in order Group the letters in pairs, always looking for the smallest sum of frequences Create a tree!
3
Images Fundamental unit is pixel Size = usually 8 bits Scheme = grayscale, range 0-255 Dimensions given as (horiz vert) –Ex. 400 300 120,000 pixels –Note that an 8-bit pixel = 1 byte Aspect ratio –Ex. 4 to 3 –When changing size, ratio shouldn’t change
4
Properties of rep’n “Sampling & Quantizing” Resolution of image –total number of pixels in image Dynamic range –How many shades of gray To reduce file size –Reduce either # of pixels, or # bits/pixel
5
Resolution here is a (edited) digitized image with a resolution of 272 x 416 Picture resolution determines both the amount of detail as well as its storage requirements
6
Resolution notice the changes when the resolution is reduced (136 x 208) Picture resolution determines both the amount of detail as well as its storage requirements
7
Resolution notice more changes when the resolution is reduced (68 x 104) Picture resolution determines both the amount of detail as well as its storage requirements
8
Dynamic Range Here is an intensity or graylevel image with 256 levels (i.e., 0 to 255 scale) DYNAMIC RANGE refers the number of values for the measuring scale used in quantizing
9
Dynamic Range Here is an intensity or graylevel image with 16 levels (i.e., 0 to 15 scale) DYNAMIC RANGE refers the number of values for the measuring scale used in quantizing
10
Dynamic Range Here is an intensity or graylevel image with 4 levels (i.e., 0 to 3 scale) DYNAMIC RANGE refers the number of values for the measuring scale used in quantizing
11
Dynamic Range Here is an intensity or graylevel image with 2 levels (i.e., 0 to 1 scale or a binary image) Dithering can help DYNAMIC RANGE refers the number of values for the measuring scale used in quantizing
12
Don’t overdo it Too little resolution: pixelated Too few bits per pixel: sharp edges, cheap –Extreme case is “binary image” Note that n bits per pixel gives 2 n values in dynamic range. 0 is black, 2 n – 1 is white –Examples: n = 8, 4, 2, 1
13
B/W vs. Color B/W: usually 1 byte (8 bits) per pixel –Each pixel = grayscale number 0-255 –Ex. 180 is a brighter shade of gray Color: usually 3 bytes (24 bits) per pixel –Each pixel has three values, each 0-255 –Ex. (200, 50, 128) = ?
14
Color rep’ns RGB – system based on light CMY – based on printing HSB – based on art Indexed color – a swatch to save space
15
RGB system Based on primary colors for light Each pixel has (red, green, blue) values. Examples black = (0, 0, 0) purple = (75, 0, 100) white = (255, 255, 255) How about (x, x, x) or (0, 0, x) ?
16
RGB examples ColorRGB black000 white255 red25500 green02550 blue00255 cyan0255 magenta2550 yellow255 0
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.