Presentation is loading. Please wait.

Presentation is loading. Please wait.

Representing Images. Goals for Image Representation digitization & resolution digitization & resolution representing color representing color color depth.

Similar presentations


Presentation on theme: "Representing Images. Goals for Image Representation digitization & resolution digitization & resolution representing color representing color color depth."— Presentation transcript:

1 Representing Images

2 Goals for Image Representation digitization & resolution digitization & resolution representing color representing color color depth (bits per pixel) color depth (bits per pixel) image compression (lossy vs lossless) image compression (lossy vs lossless)

3 Picture is represented by “dots”, or pixels (picture elements). Other examples: newsprint newsprint television television computer monitor. computer monitor. More dots = higher quality = higher quality = higher resolution = higher resolution (ppi = pixels/inch)

4 Digitization examples Place grid over image; color square if more than half is black.

5 Digitization examples Place grid over image; color square if more than half is black. etc..

6 Typical resolutions… 225 x 225 pixels (small image) 854 x 480 and higher 1920 x 1080 and ~ 100 ppi (i.e., 100x100) 300dpi + details… 12 megapixels

7 Space considerations Why not use highest resolution (best quality) Why not use highest resolution (best quality) Tradeoff between quality and space (file size on disk; time to transmit over network) Tradeoff between quality and space (file size on disk; time to transmit over network) 100 x 100 = 10,000 bits, but 100 x 100 = 10,000 bits, but 200 x 200 = 40,000 bits, and 200 x 200 = 40,000 bits, and 300 x 300 = 90,000 bits 300 x 300 = 90,000 bits SPACE GROWS QUADRATICALLY: n x n = n 2 SPACE GROWS QUADRATICALLY: n x n = n 2

8 Color Representation What kind of images can we create if we use 1 bit per pixel? How can we get more colors?

9 Color Representation IDEA: represent a pixel with 3 bits: 000 = no dot lit (black) 111 = R, G, B lit (white light) 100 = R lit (pure red) 110 = R, G lit (yellow light) Each pixel has 3 color dots: RGB: the three primary colors of light. PROBLEM: only allows 8 different pixel colors

10 3-bit color (8 colors) dithering Dithering: to create the illusion of different colors in a region, use different colored pixels. E.g., orange = alternate red and yellow pixels

11 Color Depth (also “Bit Depth”) Allocate more bits for each of R, G, B to describe amount of light (intensity) for each color. 6-bit color depth: 01 11 00 = intensity 1 for red intensity 3 for green intensity 0 for blue Allows for ______________ different colors what is code for pink? 2 6 = 64

12 “True color” = 24 bits = 8 bits/color millions of colors: more than eye can discern Indicate RGB by 3 (decimal) numbers between 0 and 255 [example: 102, 223, 46 ] OR by 6 hex values = 2 per color = 8 bits/color) [example: 66DF2E] Color Depth

13 Color Cube R, G, B are three axes of a three- dimensional “cube” of color http://www.draac.com/colorcube.html

14 Color Depth & Quality http://en.wikipedia.org/wiki/Color_depth 1 bit4 bits 8 bits24 bits

15 Space considerations Quality depends on: resolution, color depth. Space required depends on: resolution, color depth. Bits Needed = num pixels x bits/pixel e.g. 600x600, truecolor --> 600 2 x 24 = 8,640,000 bits = 1,080,000 bytes = 1.08 Mb file (.bmp)

16 More on Resolutions…. http://www.earthboundlight.com/phototips/print er-resolution.html http://www.earthboundlight.com/phototips/print er-resolution.html http://www.earthboundlight.com/phototips/print er-resolution.html http://www.earthboundlight.com/phototips/print er-resolution.html –resolutions greater than 300dpi refer to individual color dots used to make up a single pixel. http://www.earthboundlight.com/phototips/digit al-versus-film-resolution.html http://www.earthboundlight.com/phototips/digit al-versus-film-resolution.html http://www.earthboundlight.com/phototips/digit al-versus-film-resolution.html http://www.earthboundlight.com/phototips/digit al-versus-film-resolution.html –“grain size” for film comparable to resolution on high- end digital camera (about 5 microns). http://www.hdtvinfoport.com/HDTV- Resolution.html http://www.hdtvinfoport.com/HDTV- Resolution.html http://www.hdtvinfoport.com/HDTV- Resolution.html http://www.hdtvinfoport.com/HDTV- Resolution.html –sdtv versus hdtv (various versions)

17 Compression Run-length encoding of image: lossless.gif works by reducing 24 bit color by rounding to 256 colors (8 bits total per pixel) derived from the image, then using LZ compression. Good for drawings, images without great color depth..jpg (too complex to describe here) advantages over gif: many colors (note: uses Huffman coding) Pros and cons: gif good for sharp lines, bad for good color. jpg good for photographs..gif and.jpg are lossy compression techniques.

18 Vector-based representations (as opposed to “bit-map” =.bmp,.gif,.jpg) Store equations of lines, edges, regions Store equations of lines, edges, regions Very efficient for geometric contents Very efficient for geometric contents Scales beautifully Scales beautifully Scalable fonts without jaggies Scalable fonts without jaggies Flash files Flash files Disadv: hard to obtain directly from scanned images, hard to edit pixel-wise Disadv: hard to obtain directly from scanned images, hard to edit pixel-wise http://www.cambridgeincolour.com/tutorials.htm

19 Video Video = many, many, many, many images Video = many, many, many, many images Typical 30 frames per second. Typical 30 frames per second. Space requirement is simply: Space requirement is simply: (space per image) x (#seconds) x 30 Example: 600 x 600 truecolor image = 1.08 Mb Thus, roughly 30Mb per second. 5400 seconds in a 90 min video 5400 seconds in a 90 min video 5400 x 30Mb = 162000 Mb = 162Gb 5400 x 30Mb = 162000 Mb = 162Gb (without compression) DVD capacity 4.7Gb. Blue Ray 50 Gb Special temporal compression techniques used for Video

20 Summary Higher Resolution (pixels/inch) gives better quality, but space increases quadratically. Higher Resolution (pixels/inch) gives better quality, but space increases quadratically. Bit depth (color depth) measured in bits/pixel. “Truecolor” = 24 bits, 8 for each of R, G, B. Bit depth (color depth) measured in bits/pixel. “Truecolor” = 24 bits, 8 for each of R, G, B. Space = num_pixels x bits/pixel Space = num_pixels x bits/pixel Compression techniques: run-length,.gif,.jpg. Compression techniques: run-length,.gif,.jpg. Vector-based representations have adv, disadv. Vector-based representations have adv, disadv. Video is big; compression is both spatial and temporal Video is big; compression is both spatial and temporal See http://jmerritt.warpax.com/graphics_for_beginners/index.html for a good survey. See http://jmerritt.warpax.com/graphics_for_beginners/index.html for a good survey. http://jmerritt.warpax.com/graphics_for_beginners/index.html

21 Representing Sounds

22 Goals Understand how sound is represented digitally Understand how sound is represented digitally Understand sampling rate, quantization and tradeoff between quality and file size Understand sampling rate, quantization and tradeoff between quality and file size Know typical factors used in sound compression Know typical factors used in sound compression

23 Sound Representation Sound is a (continuous) wave http://www.cs.wfu.edu/~burg/CCLI/Templates/flash.php?file=Chapter5/Sampling_and_Aliasing.swf To represent digitally, decide on: Sampling rate Sampling rate –how often to read the amplitude of the wave Quantization Quantization –how many bits used to represent the amplitude These two values are analogous to resolution and color depth for images…

24 Sampling sampling rates vs. quality of sound sampling rates vs. quality of sound slow rate misses peaks, valleys time intensity of compression wave (e.g., as measured by voltage from microphone)

25 Sampling - examples Not a very good approximation of the original sound curve

26 Sampling - examples How much sampling is enough? http://en.wikipedia.org/wiki/Sampling_theorem http://en.wikipedia.org/wiki/Sampling_theorem A better approximation of the original sound curve Flash tutorial

27 Quantization quantization vs. quality of sound quantization vs. quality of sound quantization Number of distinct amplitudes we choose to represent. Fewer values available creates large rounding errors

28 Quantization - examples Number of distinct amplitudes we can represent depends on the number of bits we use. Values must be rounded to nearest number… in the 1-bit case, “0” or “1” 1 0 http://www.cs.wfu.edu/~burg/CCLI/Templates/flash.php?file=Chapter5/Quantization.swf

29 Quantization - examples 1 0.66.33 With 2 bits, we can represent 4 values (0,.33,.66, 1). We still must round, but rounding error is less, and curve is more closely approximated.

30 A/D and D/A converters Sound Cards and what they do: http://computer.howstuffworks.com/sound-card.htm

31 Space considerations Sample Rate x Quantization x Duration Sample Rate x Quantization x Duration Raw audio 44.1Khz x 16 bits = 705Kbits/sec =.7 Mbits/sec stereo = 1.4 Mbits/sec 3-minute song = 252 Mbits ≈ 32 Mbytes 3-minute song = 252 Mbits ≈ 32 Mbytes 16 Gb iPod holds 16000/32 = 500 songs (without compression. with compression: 4000 songs) 16 Gb iPod holds 16000/32 = 500 songs (without compression. with compression: 4000 songs)

32 Compression Use limitations of human hearing to decide on sampling rate and quantization. Use limitations of human hearing to decide on sampling rate and quantization. Human ear can’t hear much better than 20Khz, so sampling at 44.1Khz is adequate. Human ear can’t hear much better than 20Khz, so sampling at 44.1Khz is adequate. Other limitations of our hearing, as well as Other limitations of our hearing, as well as psychoacoustics, are used in compression algorithms (e.g. masking effects), together with other compression techniques (e.g. Huffman coding). psychoacoustics Typical file types:.wav (raw),.mp3 (compressed) Typical file types:.wav (raw),.mp3 (compressed)

33 Summary Sound is analog, we have digital representation Sound is analog, we have digital representation D/A and A/D converters used on sound cards D/A and A/D converters used on sound cards Sampling rate is how many samples/sec are represented. (Typical = 44.1K) Sampling rate is how many samples/sec are represented. (Typical = 44.1K) Quantization is how many distinct amplitude values we can represent. (Typical = 16 bits: 65536) Quantization is how many distinct amplitude values we can represent. (Typical = 16 bits: 65536) Higher sampling, better quantization means better sound, but more space Higher sampling, better quantization means better sound, but more space Chosen sampling rate, quantization, and compression techniques rely on human perceptual capabilities (psychoacoustics) Chosen sampling rate, quantization, and compression techniques rely on human perceptual capabilities (psychoacoustics)


Download ppt "Representing Images. Goals for Image Representation digitization & resolution digitization & resolution representing color representing color color depth."

Similar presentations


Ads by Google