DOC PREVIEW
UW-Madison CS 559 - Color and Color Spaces

This preview shows page 1-2-14-15-29-30 out of 30 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Last TimeTodayImage File FormatsThe Simplest FileIndexed ColorSlide 6Image CompressionGIFLZW CompressionJPEGDiscrete Cosine TransformQuantizationEntropy CodingLossless JPEG With PredictionColor QuantizationExample (24 bit color)Quantization ErrorUniform QuantizationSlide 19Populosity AlgorithmSlide 21Median CutMedian Cut in ActionSlide 24Optimization AlgorithmsPerceptual ProblemsMach Bands in RealitySlide 28Mach bands EmphasizedNext Lecture01/31/02(C) 2002, UNiversity of Wisconsin, CS 559Last Time•Color and Color Spaces01/31/02(C) 2002, UNiversity of Wisconsin, CS 559Today•Image file formats–GIF–JPEG•Color Quantization–Uniform–Populosity–Median Cut–Optimization01/31/02(C) 2002, UNiversity of Wisconsin, CS 559Image File Formats•How big is the image?–All files in some way store width and height•How is the image data formatted?–Is it a black and white image, a grayscale image, a color image, an indexed color image?–How many bits per pixel?•What other information?–Color tables, compression codebooks, creator information…01/31/02(C) 2002, UNiversity of Wisconsin, CS 559The Simplest File•Assumes that the color depth is known and agreed on•Store width, height, and data for every pixel in sequence•This is how you normally store an image in memory•Unsigned because width and height are positive, and unsigned char because it is the best type for raw 8 bit data•Note that you require some implicit scheme for laying out a rectangular array into a linear oneclass Image {unsigned int width;unsigned int height;unsigned char *data;}3r,g,b0r0r,g,b1r,g,b2r,g,b4r,g,b5r,g,b8r,g,b7r,g,b6r,g,b0g0b1g1r1b2r2g2b3r3g01/31/02(C) 2002, UNiversity of Wisconsin, CS 559Indexed Color•24 bits per pixel (8-red, 8-green, 8-blue) are expensive to transmit and store•It must be possible to represent all those colors, but not in the same image•Solution: Indexed color–Assume k bits per pixel (typically 8)–Define a color table containing 2k colors (24 bits per color)–Store the index into the table for each pixel (so store k bits for each pixel)–Once common in hardware, now rare (256 color displays)01/31/02(C) 2002, UNiversity of Wisconsin, CS 559Indexed ColorColor Table012345674 3 0 21 7 4 53 7 6 52 2 1 1Pixel Data ImageOnly makes sense if you have lots of pixels and not many colors01/31/02(C) 2002, UNiversity of Wisconsin, CS 559Image Compression•Indexed color is one form of image compression–Special case of vector quantization•Alternative 1: Store the image in a simple format and then compress with your favorite compressor–Doesn’t exploit image specific information–Doesn’t exploit perceptual shortcuts•Two historically common compressed file formats: GIF and JPEG–GIF should now be replaced with PNG, because GIF is patented and the owner started enforcing the patent01/31/02(C) 2002, UNiversity of Wisconsin, CS 559GIF•Header – Color Table – Image Data – Extensions•Header gives basic information such as size of image and size of color table•Color table gives the colors found in the image–Biggest it can be is 256 colors, smallest is 2•Image data is LZW compressed color indices•To create a GIF:–Choose colors–Create an array of color indices–Compress it with LZW01/31/02(C) 2002, UNiversity of Wisconsin, CS 559LZW Compression•Compresses a stream of “characters”, in GIF case they are 1byte color indices•Stores the strings encountered in a codebook–When compressing, strings are put in the codebook the second time they are encountered–Subsequent encounters replace the string with the code–Decoding reconstructs codebook on the fly–Advantage: The code does not need to be transmitted01/31/02(C) 2002, UNiversity of Wisconsin, CS 559JPEG•Multi-stage process intended to get very high compression with controllable quality degradation•Start with YIQ color–Why? Recall, it’s the color standard for TV01/31/02(C) 2002, UNiversity of Wisconsin, CS 559Discrete Cosine Transform•A transformation to convert from the spatial to frequency domain – done on 8x8 blocks•Why? Humans have varying sensitivity to different frequencies, so it is safe to throw some of them away•Basis functions:01/31/02(C) 2002, UNiversity of Wisconsin, CS 559Quantization•Reduce the number of bits used to store each coefficient by dividing by a given value–If you have an 8 bit number (0-255) and divide it by 8, you get a number between 0-31 (5 bits = 8 bits – 3 bits)–Different coefficients are divided by different amounts–Perceptual issues come in here•Achieves the greatest compression, but also quality loss•“Quality” knob controls how much quantization is done01/31/02(C) 2002, UNiversity of Wisconsin, CS 559Entropy Coding•Standard lossless compression on quantized coefficients–Delta encode the DC components–Run length encode the AC components•Lots of zeros, so store number of zeros then next value–Huffman code the encodings01/31/02(C) 2002, UNiversity of Wisconsin, CS 559Lossless JPEG With Prediction•Predict what the value of the pixel will be based on neighbors•Record error from prediction–Mostly error will be near zero•Huffman encode the error stream•Variation works really well for fax messages01/31/02(C) 2002, UNiversity of Wisconsin, CS 559Color Quantization•The problem of reducing the number of colors in an image with minimal impact on appearance–Extreme case: 24 bit color to black and white–Less extreme: 24 bit color to 256 colors, or 256 grays•Why do we care?•Sub problems:–Decide which colors to use (if there is a choice)–Decide which of those each original color maps to01/31/02(C) 2002, UNiversity of Wisconsin, CS 559Example (24 bit color)01/31/02(C) 2002, UNiversity of Wisconsin, CS 559Quantization Error•A way of measuring the quality of our approximation•Define an error for each color, c, in the original image: d(c,c’), where c’ is the color c maps to under the quantization–Common is to use squared distance in RGB space–Should really use distance in CIE u’,v’ space•Sum up the error over all the pixels01/31/02(C) 2002, UNiversity of Wisconsin, CS 559Uniform Quantization•Break the color space into uniform cells•Find the cell that each color is in, and map it to the center•Generally does poorly because it fails to capture the distribution of colors–Some cells may be empty, and are wasted•Equivalent to dividing each color by some number and taking the integer


View Full Document

UW-Madison CS 559 - Color and Color Spaces

Documents in this Course
Filters

Filters

14 pages

Lecture 2

Lecture 2

24 pages

Clipping

Clipping

22 pages

Modeling

Modeling

33 pages

Filters

Filters

26 pages

Dithering

Dithering

33 pages

Lecture 4

Lecture 4

20 pages

Load more
Download Color and Color Spaces
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Color and Color Spaces and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Color and Color Spaces 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?