Unformatted text preview:

Last Time Color The principle of trichromacy says that any spectrum can be matched using three primaries but sometimes you have to subtract a primary A color system consist of primaries and color matching functions that are used to determine how much of each primary is needed to match a spectrum RGB CIE XYZ HSV u v are some examples of color systems Linear color spaces make it easy to convert between colors matrix multiply Perceptually uniform color spaces make distances between colors meaningful Color calibration is an important step to achieving accurate color 9 16 04 University of Wisconsin CS559 Spring 2004 Today Paints and inks behave differently subtractive color Image file formats Color Quantization Homework 2 due Sept 28 in class 9 16 04 University of Wisconsin CS559 Spring 2004 Paint and Ink Paints are thought of as reflective Green paint looks green because those are the colors that escape Combining pigments reflects more colors so additive color Red paint green paint yellow paint Paint covers things Ink is thought of as adsorbing particles It s easier to handle the math You see the color of the paper filtered by the ink Combining inks adsorbs more color so subtractive color White paper red blue green The color and texture of the paper affects the color of the image 9 16 04 University of Wisconsin CS559 Spring 2004 Subtractive mixing Common inks Cyan White Red Magenta White Green Yellow White Blue The colors cyan magenta yellow are how the inks look when printed To make a red mark put down magenta and yellow which removes the green and blue leaving red For good inks matching is linear C M Y White White Black C M White Red Green Blue Usually require CMY and Black because colored inks are more expensive and registration is hard Registration is the problem of making drops of ink line up 9 16 04 University of Wisconsin CS559 Spring 2004 Calibrating a Printer If the inks think of them as primaries are linear there exists a 3x3 matrix and an offset to take RGB to CMY For example if an RGB of 1 0 0 goes to CMY of 0 1 1 0 1 0 1 0 1 and 0 0 1 1 1 0 then the matrix is c 1 1 0 0 r m 1 0 1 0 g y 1 0 0 1 b To calibrate your printer you find out exactly what the numbers in the matrix should be Print with cyan ink only and match the color with RGB repeat with magenta and yellow use the results to determine the matrix 9 16 04 University of Wisconsin CS559 Spring 2004 Image 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 All image formats are a trade off between ease of use size of file and quality of reproduction 9 16 04 University of Wisconsin CS559 Spring 2004 The 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 class Image unsigned int width unsigned int height unsigned char data 0r g b 1r g b 2r g b 3r g b 4r g b 5r g b 6r g b 7r g b 8r g b 0r 0g 0b 1r 1g 1b 2r 2g 2b 3r 3g 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 one 9 16 04 University of Wisconsin CS559 Spring 2004 Indexed 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 an artifact 256 color displays 9 16 04 University of Wisconsin CS559 Spring 2004 Indexed Color Color Table 0 1 2 3 4 5 6 7 9 16 04 Pixel Data 4 3 0 2 1 7 4 5 3 7 6 5 2 2 1 1 Image Only makes sense if you have lots of pixels and not many colors University of Wisconsin CS559 Spring 2004 Image Compression Indexed color is one form of image compression Special case of vector quantization in color space reducing the range of available colors 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 patent 9 16 04 University of Wisconsin CS559 Spring 2004 GIF 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 LZW 9 16 04 University of Wisconsin CS559 Spring 2004 JPEG 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 TV 9 16 04 University of Wisconsin CS559 Spring 2004 Discrete 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 9 16 04 University of Wisconsin CS559 Spring 2004 Quantization 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 done 9 16 04 University of Wisconsin CS559 Spring 2004 Entropy 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 encodings 9 16 04 University of Wisconsin CS559 Spring 2004 Lossless 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 …


View Full Document

UW-Madison CS 559 - CS 559 Lecture Notes

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
Loading Unlocking...
Login

Join to view CS 559 Lecture Notes 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 CS 559 Lecture Notes 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?