09/12/02 (C) 2002, University of Wisconsin, CS 559 Last Time Color and Color Spaces –Recall RGB and XYZ Programming assignment 2.

Slides:



Advertisements
Similar presentations
1/29/04© University of Wisconsin, CS559 Spring 2004 Last Time Color –Sensor response is computed from the sensor’s response curve and the incoming spectrum.
Advertisements

Color & Light, Digitalization, Storage. Vision Rods work at low light levels and do not see color –That is, their response depends only on how many photons,
Color Image Processing
Fundamentals of Digital Imaging
School of Computing Science Simon Fraser University
© 2002 by Yu Hen Hu 1 ECE533 Digital Image Processing Color Imaging.
Graphics File Formats. 2 Graphics Data n Vector data –Lines –Polygons –Curves n Bitmap data –Array of pixels –Numerical values corresponding to gray-
1 CSCE441: Computer Graphics: Color Models Jinxiang Chai.
CS559-Computer Graphics Copyright Stephen Chenney Color Recap The physical description of color is as a spectrum: the intensity of light at each wavelength.
Why Care About Color? Accurate color reproduction is commercially valuable - e.g. Kodak yellow, painting a house Color reproduction problems increased.
Roger Cheng (JPEG slides courtesy of Brian Bailey) Spring 2007
Color Models AM Radio FM Radio + TV Microwave Infrared Ultraviolet Visible.
1 JPEG Compression CSC361/661 Burg/Wong. 2 Fact about JPEG Compression JPEG stands for Joint Photographic Experts Group JPEG compression is used with.jpg.
Color & Color Management. Overview I. Color Perception Definition & characteristics of color II. Color Representation RGB, CMYK, XYZ, Lab III. Color Management.
01/31/02 (C) 2002, UNiversity of Wisconsin, CS 559 Last Time Color and Color Spaces.
9/14/04© University of Wisconsin, CS559 Spring 2004 Last Time Intensity perception – the importance of ratios Dynamic Range – what it means and some of.
Trevor McCasland Arch Kelley.  Goal: reduce the size of stored files and data while retaining all necessary perceptual information  Used to create an.
CS559-Computer Graphics Copyright Stephen Chenney Image File Formats How big is the image? –All files in some way store width and height How is the image.
9/16/04© University of Wisconsin, CS559 Spring 2004 Last Time Color –The principle of trichromacy says that any spectrum can be matched using three primaries.
Colour Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman
Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman Chapter 6 This presentation © 2004, MacAvon Media Productions Colour.
CS 376 Introduction to Computer Graphics 01 / 26 / 2007 Instructor: Michael Eckmann.
2001 by Jim X. Chen: 1 The purpose of a color model is to allow convenient specification of colors within some color gamut.
Digital Images The digital representation of visual information.
Page 18/30/2015 CSE 40373/60373: Multimedia Systems 4.2 Color Models in Images  Colors models and spaces used for stored, displayed, and printed images.
Introduction to JPEG Alireza Shafaei ( ) Fall 2005.
CS Spring 2012 CS 414 – Multimedia Systems Design Lecture 8 – JPEG Compression (Part 3) Klara Nahrstedt Spring 2012.
Image Processing Lecture 2 - Gaurav Gupta - Shobhit Niranjan.
ECE472/572 - Lecture 12 Image Compression – Lossy Compression Techniques 11/10/11.
1 Image Compression. 2 GIF: Graphics Interchange Format Basic mode Dynamic mode A LZW method.
Chapter 6: Color Image Processing Digital Image Processing.
Lab #5-6 Follow-Up: More Python; Images Images ● A signal (e.g. sound, temperature infrared sensor reading) is a single (one- dimensional) quantity that.
2/3/04© University of Wisconsin, CS559 Spring 2004 Last Time Color –Transforming between two color spaces –A gamut is the set of displayable colors in.
Klara Nahrstedt Spring 2011
1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng.
Computer Science 631 Lecture 7: Colorspace, local operations
Color. Contents Light and color The visible light spectrum Primary and secondary colors Color spaces –RGB, CMY, YIQ, HLS, CIE –CIE XYZ, CIE xyY and CIE.
JPEG. The JPEG Standard JPEG is an image compression standard which was accepted as an international standard in  Developed by the Joint Photographic.
Color Theory ‣ What is color? ‣ How do we perceive it? ‣ How do we describe and match colors? ‣ Color spaces.
Indiana University Purdue University Fort Wayne Hongli Luo
1 Image Formats. 2 Color representation An image = a collection of picture elements (pixels) Each pixel has a “color” Different types of pixels Binary.
CSC361/ Digital Media Burg/Wong
CS Spring 2014 CS 414 – Multimedia Systems Design Lecture 10 – Compression Basics and JPEG Compression (Part 4) Klara Nahrstedt Spring 2014.
09/17/02 (C) 2002, University of Wisconsin, CS 559 Last Time Color Spaces File formats.
Ch 6 Color Image processing CS446 Instructor: Nada ALZaben.
DIGITAL IMAGE. Basic Image Concepts An image is a spatial representation of an object An image can be thought of as a function with resulting values of.
1 CSCE441: Computer Graphics: Color Models Jinxiang Chai.
Color. Acknowledgement Most of this lecture note has been taken from the lecture note on Multimedia and HCI course of University of Stirling, UK. I’d.
Introduction to Computer Graphics
Greg Humphreys CS445: Intro Graphics University of Virginia, Fall 2003 Raster Graphics and Color Greg Humphreys University of Virginia CS 445, Fall 2003.
The task of compression consists of two components, an encoding algorithm that takes a file and generates a “compressed” representation (hopefully with.
1 CSCE441: Computer Graphics: Color Models Jinxiang Chai.
09/10/02(c) University of Wisconsin, CS559 Fall 2002 Last Time Digital Images –Spatial and Color resolution Color –The physics of color.
Color Measurement and Reproduction Eric Dubois. How Can We Specify a Color Numerically? What measurements do we need to take of a colored light to uniquely.
1 of 32 Computer Graphics Color. 2 of 32 Basics Of Color elements of color:
CSE 185 Introduction to Computer Vision
Color Models Light property Color models.
ITEC2110, Digital Media Chapter 2 Fundamentals of Digital Imaging
JPEG Compression What is JPEG? Motivation
Color Image Processing
(c) University of Wisconsin, CS559 Spring 2002
JPEG Image Coding Standard
Color Image Processing
JPEG.
Color Image Processing
Slides taken from Scott Schaefer
Last Time Image – basic definition
Color Image Processing
Color Model By : Mustafa Salam.
Color Models l Ultraviolet Infrared 10 Microwave 10
Presentation transcript:

09/12/02 (C) 2002, University of Wisconsin, CS 559 Last Time Color and Color Spaces –Recall RGB and XYZ Programming assignment 2

09/12/02 (C) 2002, University of Wisconsin, CS 559 Today More color spaces Image file formats –GIF –JPEG Intro to color quantization

09/12/02 (C) 2002, University of Wisconsin, CS 559 The RGB Color Matching Functions

09/12/02 (C) 2002, University of Wisconsin, CS 559 Computing the Matching The spectrum function that we are trying to match, E( ), gives the amount of energy at each wavelength The RGB matching functions describe how much of each primary is needed to match one unit of energy at each wavelength Hence, if the “color” due to E( ) is E, then the match is:

09/12/02 (C) 2002, University of Wisconsin, CS 559 Going from RGB to XYZ These are linear color spaces, related by a linear transformation Match each primary, for example: Substitute and equate terms:

09/12/02 (C) 2002, University of Wisconsin, CS 559 Standard RGB↔XYZ Note that each matrix is the inverse of the other Recall, Y encodes brightness, so the matrix tells us how to go from RGB to grey

09/12/02 (C) 2002, University of Wisconsin, CS 559 Determining Gamuts Gamut: The range of colors that can be represented or reproduced Plot the matching coordinates for each primary. eg R, G, B Region contained in triangle (3 primaries) is gamut Really, it’s a 3D thing, with the color cube distorted and embedded in the XYZ gamut x y XYZ Gamut RGB Gamut G R B

09/12/02 (C) 2002, University of Wisconsin, CS 559 Accurate Color Reproduction High quality graphic design applications, and even some monitor software, offers accurate color reproduction A color calibration phase is required: –Fix the lighting conditions under which you will use the monitor –Fix the brightness and contrast on the monitor –Determine the monitor’s γ –Using a standard color card, match colors on your monitor to colors on the card: This gives you the matrix to convert your monitor’s RGB to XYZ –Together, this information allows to to accurately reproduce a color specified in XYZ format (and hence any other standard format)

09/12/02 (C) 2002, University of Wisconsin, CS 559 More linear color spaces Monitor RGB: primaries are monitor phosphor colors, primaries and color matching functions vary from monitor to monitor sRGB: A new color space designed for web graphics YIQ: mainly used in television –Y is (approximately) intensity, I, Q are chromatic properties –Linear color space; hence there is a matrix that transforms XYZ coords to YIQ coords, and another to take RGB to YIQ –I and Q can be transmitted with low bandwidth

09/12/02 (C) 2002, University of Wisconsin, CS 559 HSV Color Space (Alvy Ray Smith, 1978) Hue: the color family: red, yellow, blue… Saturation: The purity of a color: white is totally unsaturated Value: The intensity of a color: white is intense, black isn’t Space looks like a cone –Parts of the cone can be mapped to RGB space Not a linear space, so no linear transform to take RGB to HSV –But there is an algorithmic transform

09/12/02 (C) 2002, University of Wisconsin, CS 559 HSV Color Space HSV Color Cone Program

09/12/02 (C) 2002, University of Wisconsin, CS 559 Uniform Color Spaces Color spaces in which distance in the space corresponds to perceptual “distance” Only works for local distances –How far is red from green? Is it further than red from blue? Use MacAdams ellipses to define perceptual distance

09/12/02 (C) 2002, University of Wisconsin, CS 559 MacAdam Ellipses Scaled by a factor of 10 and shown on CIE xy color space If you are shown two colors inside the same ellipse, you cannot tell them apart Only a few ellipses are shown, but one can be defined for every point

09/12/02 (C) 2002, University of Wisconsin, CS 559 Violet CIE u’v’ Space CIE u’v’ is a non-linear color space where color differences are more uniform Note that now ellipses look more like circles The third coordinate is the original Z from XYZ

09/12/02 (C) 2002, University of Wisconsin, CS 559 Subtractive mixing Inks subtract light from white, whereas phosphors glow Common inks: Cyan=White−Red, Magenta=White−Green, Yellow=White−Blue –For example, to make a red mark, put down magenta and yellow, which removes the green and blue leaving red For a good choice of 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

09/12/02 (C) 2002, University of Wisconsin, CS 559 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, of 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 To calibrate your printer, you find out exactly what the numbers in the matrix should be

09/12/02 (C) 2002, University of Wisconsin, CS 559 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…

09/12/02 (C) 2002, University of Wisconsin, CS 559 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 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 class Image { unsigned int width; unsigned int height; unsigned char *data; } 3 r,g,b 0r0r 0 r,g,b 1 r,g,b 2 r,g,b 4 r,g,b 5 r,g,b 8 r,g,b 7 r,g,b 6 r,g,b 0g0g 0b0b 1g1g 1r1r 1b1b 2r2r 2g2g 2b2b 3r3r 3g3g

09/12/02 (C) 2002, University of Wisconsin, CS 559 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 2 k 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)

09/12/02 (C) 2002, University of Wisconsin, CS 559 Indexed Color Color Table Pixel DataImage Only makes sense if you have lots of pixels and not many colors

09/12/02 (C) 2002, University of Wisconsin, CS 559 Image 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 patent

09/12/02 (C) 2002, University of Wisconsin, CS 559 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

09/12/02 (C) 2002, University of Wisconsin, CS 559 LZW 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 transmitted

09/12/02 (C) 2002, University of Wisconsin, CS 559 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

09/12/02 (C) 2002, University of Wisconsin, CS 559 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:

09/12/02 (C) 2002, University of Wisconsin, CS 559 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

09/12/02 (C) 2002, University of Wisconsin, CS 559 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

09/12/02 (C) 2002, University of Wisconsin, CS 559 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 really well for fax messages