CS 559 Computer Graphics Lecture 5 Color and

  • Slides: 33
Download presentation
CS 559: Computer Graphics Lecture 5: Color and Edge Li Zhang Spring 2008

CS 559: Computer Graphics Lecture 5: Color and Edge Li Zhang Spring 2008

Today • Eyes • Cameras

Today • Eyes • Cameras

Image as a discreet function Represented by a matrix

Image as a discreet function Represented by a matrix

Color Vision Three kinds of cones:

Color Vision Three kinds of cones:

Trichromacy • Experiment: – Show a target color spectrum beside a user controlled color

Trichromacy • Experiment: – Show a target color spectrum beside a user controlled color – User has knobs that adjust primary sources to set their color • Primary sources are just lights with a fixed spectrum and variable intensity – Ask the user to match the colors – make their light look the same as the target • Experiments show that it is possible to match almost all colors using only three primary sources - the principle of trichromacy • Sometimes, have to add light to the target • In practical terms, this means that if you show someone the right amount of each primary, they will perceive the right color • This was how experimentalists knew there were 3 types of cones 9/14/04 © University of Wisconsin, CS 559 Spring 2004

Trichromacy For almost any given E_target(λ), we can solve for [r, g, b] so

Trichromacy For almost any given E_target(λ), we can solve for [r, g, b] so that the displayed color looks indistinguishable from the target color to our eyes.

RGB Cube Cyan (0, 1, 1) White(1, 1, 1) Green(0, 1, 0) Yellow (1,

RGB Cube Cyan (0, 1, 1) White(1, 1, 1) Green(0, 1, 0) Yellow (1, 1, 0) Blue (0, 0, 1) Black (0, 0, 0) Magenta (0, 1, 1) Red (1, 0, 0) Demo

Other Color Space • Hue-Saturation-Value (HSV) [Alvy Smith, 1978] – Hue: dominant color component

Other Color Space • Hue-Saturation-Value (HSV) [Alvy Smith, 1978] – Hue: dominant color component – Saturation: color purity – Value: lightness or brightness • HSV-RGB transformation http: //alvyray. com/Papers/hsv 2 rgb. htm http: //www. mandelbrot-dazibao. com/HSV. htm

Other Color Space • L-A-B – L: luminance – A: position between magenta and

Other Color Space • L-A-B – L: luminance – A: position between magenta and green (negative values indicate green while positive values indicate magenta) – B: position between yellow and blue (negative values indicate blue and positive values indicate yellow) http: //en. wikipedia. org/wiki/Lab_color_space http: //en. wikipedia. org/wiki/CIE_1931_color_space

Spatial resolution and color R G B original

Spatial resolution and color R G B original

Blurring the G component R G B original processed

Blurring the G component R G B original processed

Blurring the R component R G B original processed

Blurring the R component R G B original processed

Blurring the B component R G B original processed

Blurring the B component R G B original processed

Lab Color Component L a b A rotation of the color coordinates into directions

Lab Color Component L a b A rotation of the color coordinates into directions that are more perceptually meaningful: L: luminance, a: magenta-green, b: blue-yellow

Bluring L L a b original processed

Bluring L L a b original processed

Bluring a L a b original processed

Bluring a L a b original processed

Bluring b L a b original processed

Bluring b L a b original processed

Application to image compression • (compression is about hiding differences from the true image

Application to image compression • (compression is about hiding differences from the true image where you can’t see them).

Edge Detection • Convert a 2 D image into a set of curves –

Edge Detection • Convert a 2 D image into a set of curves – Extracts salient features of the scene – More compact than pixels

How can you tell that a pixel is on an edge?

How can you tell that a pixel is on an edge?

Edge detection • One of the most important uses of image processing is edge

Edge detection • One of the most important uses of image processing is edge detection: – Really easy for humans – Really difficult for computers – Fundamental in computer vision – Important in many graphics applications

What is an edge? • Q: How might you detect an edge in 1

What is an edge? • Q: How might you detect an edge in 1 D?

Gradients • The gradient is the 2 D equivalent of the derivative: • Properties

Gradients • The gradient is the 2 D equivalent of the derivative: • Properties of the gradient – It’s a vector – Points in the direction of maximum increase of f – Magnitude is rate of increase • How can we approximate the gradient in a discrete image?

Less than ideal edges

Less than ideal edges

Steps in edge detection • Edge detection algorithms typically proceed in three or four

Steps in edge detection • Edge detection algorithms typically proceed in three or four steps: – Filtering: cut down on noise – Enhancement: amplify the difference between edges and non-edges – Detection: use a threshold operation – Localization (optional): estimate geometry of edges, which generally pass between pixels

Edge enhancement • A popular gradient magnitude computation is the Sobel operator: • We

Edge enhancement • A popular gradient magnitude computation is the Sobel operator: • We can then compute the magnitude of the vector (sx, sy).

Results of Sobel edge detection

Results of Sobel edge detection

Canny Edge Detector • Smooth image I with 2 D Gaussian: • Find local

Canny Edge Detector • Smooth image I with 2 D Gaussian: • Find local edge normal directions for each pixel • Along this direction, compute image gradient • Locate edges by finding max gradient magnitude (Non-maximum suppression)

Non-maximum Suppression • Check if pixel is local maximum along gradient direction – requires

Non-maximum Suppression • Check if pixel is local maximum along gradient direction – requires checking interpolated pixels p and r

The Canny Edge Detector original image (Lena)

The Canny Edge Detector original image (Lena)

The Canny Edge Detector magnitude of the gradient

The Canny Edge Detector magnitude of the gradient

The Canny Edge Detector After non-maximum suppression

The Canny Edge Detector After non-maximum suppression

Canny Edge Detector original • The choice of – large – small Canny with

Canny Edge Detector original • The choice of – large – small Canny with depends on desired behavior detects large scale edges detects fine features Canny with