40
1 Color Spaces Babol university of technology ECE Dep . Machine Vision Prof: M. Ezoji Presentation: Alireza Asvadi Fall 2012

Color Spaces

  • Upload
    pakuna

  • View
    35

  • Download
    0

Embed Size (px)

DESCRIPTION

Babol university of technology. ECE Dep. Color Spaces. Machine Vision. Prof: M. Ezoji. Presentation: Alireza Asvadi. Fall 2012. 1. Human Color Perception 2. Linear Color Spaces 2.1 CIE XYZ 2.2 RGB 2.3 CMYK 2.4 YIQ - PowerPoint PPT Presentation

Citation preview

Page 1: Color Spaces

1

Color Spaces

Babol university of technologyECE Dep.

Machine Vision

Prof: M. Ezoji

Presentation: Alireza Asvadi

Fall 2012

Page 2: Color Spaces

2

1. Human Color Perception

2. Linear Color Spaces 2.1 CIE XYZ 2.2 RGB 2.3 CMYK 2.4 YIQ 2.5 YUV

3. Non-linear Color Spaces 3.1 HSV 3.2 HSI (HSL,HSB) 3.3 CIE u’v’ 3.4 CIE LAB

Page 3: Color Spaces

3

Different colors correspond to radiation of different wavelengths.

The simplest question is to understand which spectral energy densities produce the same response from people under simple viewing conditions.

Color Matching Experiment

Goal: find out what spectral radiances produce same response in human observers.

R. C. Gonzalez, R. E. Wood, “Digital Image Processing,”

Page 4: Color Spaces

4Foundations of Vision, by Brian Wandell, Sinauer Assoc., 1995

Page 5: Color Spaces

Color matching experiment 1

Slide credit: W. Freeman

Page 6: Color Spaces

Color matching experiment 1

p1 p2 p3 Slide credit: W. Freeman

Page 7: Color Spaces

Color matching experiment 1

p1 p2 p3 Slide credit: W. Freeman

Page 8: Color Spaces

Color matching experiment 1

p1 p2 p3

The primary color amounts needed for a match

Slide credit: W. Freeman

Page 9: Color Spaces

Color matching experiment 2

Slide credit: W. Freeman

Page 10: Color Spaces

Color matching experiment 2

p1 p2 p3 Slide credit: W. Freeman

Page 11: Color Spaces

Color matching experiment 2

p1 p2 p3 Slide credit: W. Freeman

Page 12: Color Spaces

Color matching experiment 2

p1 p2 p3 p1 p2 p3

We say a “negative” amount of p2 was needed to make the match, because we added it to the test color’s side.

The primary color amounts needed for a match:

p1 p2 p3

Page 13: Color Spaces

13

p1 p2 p3

The RGB color space cannot always produce a color equivalent to any wavelength. In order to produce these colors the red component sometimes should be negative.

One way to avoid this problem is to specify color matching functions that are everywhere positive

RGB color matching functions

D. A. Forsyth, J. Ponce, “Computer Vision: A Modern Approach,”

Page 14: Color Spaces

14

The CIE XYZ color space is one quite popular standard.The color matching functions were chosen to be everywhere positive.

( , ) ( , )X Yx yX Y Z X Y Z

CIE XYZ Color matching functions

D. A. Forsyth, J. Ponce, “Computer Vision: A Modern Approach,”

Page 15: Color Spaces

15R. C. Gonzalez, R. E. Wood, “Digital Image Processing,”

Page 16: Color Spaces

16

Color Gamut produced by RGB monitors

Color Gamut produced by high quality color printing device

color space's color gamut: subset of colors which can be accurately represented in a given color space .

D. A. Forsyth, J. Ponce, “Computer Vision: A Modern Approach,”

Page 17: Color Spaces

17

24-bit RGB color image: 8-bit for each color.

Able to represent:

382 Colors 16,777,216 Colors

Yellow

Magenta Cyan

RGB:

The RGB color space is a linear color space that formally uses single wavelengthPrimaries. Informally, RGB uses whatever phosphors a monitor has as primaries.

p1 = 645.2 nmp2 = 525.3 nmp3 = 444.4 nm

Page 18: Color Spaces

18

uint8

double

In MATLAB the values of RGB are assumed to be in the range of [0,1] (double)or in the range of [0-255] (uint8)or in the range of [0-65535] (uint16)

Page 19: Color Spaces

19Red Green Blue

RGB Image

Page 20: Color Spaces

20

00.1

0.20.3

0.40.5

0.60.7

0.80.9

1

00.1

0.20.3

0.40.5

0.60.7

0.80.9

10

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Blue

RedGreen RedGreen

Blue

Page 21: Color Spaces

21

CMY – CMYK:

The name CMYK refers:CyanMagentaYellowBlack

Primaries:Cyan, magenta, yellowSecondaries :Red, green, blue

BGR

YMC

111 Red -> complements <- Cyan

Green -> complements <- MagentaBlue -> complements <- Yellow

Page 22: Color Spaces

22

pigments remove color from incident light, which is reflected from paper.

Thus, red ink is really a dye that absorbs green and blue light—incident red light passes through this dye and is reflected from the paper. In this case, mixing is subtractive.

Additive Color: Monitors combined RedGreen, and Blue light to Produce “White”

The mixing of “light”

Page 23: Color Spaces

23

Subtractive Color:The mixing of “pigment”Pigments absorb light

Theoretically black is not neededBut when full-saturation cyan, magenta, and yellow inks are mixed equally on paper result is usually a dark brown, rather than black.

Red + Green = YellowRed + Blue = MagentaGreen + Blue = Cyan

Page 24: Color Spaces

24

RGB Image

Cyan Magenta Yellow

Page 25: Color Spaces

25

YIQ Color Space:

Y : luminance, brightnessI, Q: chrominance (color information)

By separating the intensity from the color information makes the YIQ color space very attractive to TV broadcasting, because it helps maintain compatibility with monochrome TV standards.

The YIQ model also takes advantage of the fact that the human eye is more sensitive to changes in luminance than changes to hue or saturation.

Page 26: Color Spaces

26

RGB Image

Y Image

I Image

Q Image

YIQ: MATLAB Command

yiq_image = rgb2ntsc(rgb_image);

rgb_image= ntsc2rgb(yiq_image);

BGR

QIY

312.0523.0211.0322.0274.0596.0

114.0587.0299.0

QIY

BGR

703.1106.1000.1647.0272.0000.1

621.0956.0000.1

Ref: Wikipedia – YIQ

Page 27: Color Spaces

27

The YUV color space is used by the PAL and SECAM color television systems in many countries.

The luminance value Y and two color differences U, V can be expressed with the following formula:

U=(B-Y)/2.03 = 0.493(B-Y)V=(R-Y)/1.14=0. 877(R-Y)

The YUV color space is very similar to the YIQ color space and both were proposed to be used with the NTSC standard, but because the YIQ color space needs a lower bandwidth that YUV, the YIQ color space was chosen.

YUV color space :

Page 28: Color Spaces

28

Color space

Color mixing

Primary parameters

Used for Pros and cons

RGB Additive Red,Green, Blue

Easy but wasting bandwidth

CMYK Subtractive Cyan, Magenta, Yellow, Black

Printer Works in pigment mixing

YCbCrYPbPr

additive Y(luminance), Cb(blue chroma), Cr(red chroma)

Video encoding, digital camera

Bandwidth efficient

YUV additive Y(luminance),U(blue chroma), V(red chroma)

Video encoding for NTSC, PAL,

SECAM

Bandwidth efficient

YIQ additive Y(luminance),I(rotated from U),Q(rotated from V)

Video encoding for NTSC

Bandwidth efficient

Ref: color spaces slides. Presenter: Cheng-Jin Kuo Advisor: Jian-Jiun Ding, Ph. D. Professor Digital Image & Signal Processing Lab Graduate Institute of Communication Engineering National Taiwan University, Taipei, Taiwan, ROC

Page 29: Color Spaces

29

HSV:

Hue: true color attributeThe first thing we usually notice about a color is its hue.The range of H is represented by values from 0 to 360

Saturation: amount that the color is diluted by white. pure red high saturationlight red low saturation

Value: degree of brightness.White values have the maximum brightnessblack values have no brightness

Page 30: Color Spaces

30

H: from 0 to 360Red = 0Green = 120Blue = 240Yellow = 60 Cyan = 180Magenta = 300

Ref: color spaces slides from Thomas Mitchell

Page 31: Color Spaces

31

HSV RGB

VS

BGRVBGRV

},,min{},,max{

GRHV

RBHVG

BGHVR

461 THEN B IF

261 THEN IF

61 THEN IF

))1(1()1(

)1(6

6

FSVTSFVQSVPHHF

HH

H’ R G B0 V T P1 Q V P2 P V T3 P Q V4 T P V5 V P Q

All values are normalized.

Page 32: Color Spaces

32

HSV: MATLAB Command

hsv_image = rgb2hsv(rgb_image);

*The elements of rgb_image can be in the range double[0 1] or uint8 [0 255]

rgb_image is an m-by-n-by-3 image array whose three planes contain the red, green, and blue components for the image. hsv_image is returned as an m-by-n-by-3 image array whose three planes contain the hue, saturation, and value components for the image.

rgb_image= hsv2rgb(hsv_image);

*The elements of both are in the range 0 to 1.

Page 33: Color Spaces

33

RGB Image

Hue Image Saturation Image Value Image

Page 34: Color Spaces

34

HSI (HSL or HSB):

HSI and HSV are quite similar color spaces.The difference is that in HSV space to get white color you should set Saturation to "0". But in HSI space at I=1 you get white regardless the saturation value.

HSI (HSL or HSB):HSV:

Page 35: Color Spaces

35

GB if 360GB if

H

2/121

)])(()[(

)]()[(21

cosBGBRGR

BRGR

)],,[min()(

31 BGRBGR

S

)(31 BGRI

RGB HSI

HSI RGB 1200 HRG sector : )1( SIB

)60cos(

cos1HHSIR

)(3 BRIG

Page 36: Color Spaces

36

HSI RGB 240120 HGB sector :

)1( SIR

)60cos(

cos1HHSIG

)(3 GRIB

120HH

360240 HBR sector :

)1( SIG

)60cos(

cos1HHSIB

)(3 BGIR

240HH

Page 37: Color Spaces

37

One can determine just noticeable differences by modifying a color shown toobservers until they can only just tell it has changed in a comparison with theoriginal color. When these differences are plotted on a color space, they form theboundary of a region of colors that are indistinguishable from the original colors.

Uniform Color Spaces:

determine just noticeable differences

D. A. Forsyth, J. Ponce, “Computer Vision: A Modern Approach,”

Page 38: Color Spaces

38

This figure shows the CIE 1976 u’v’ space, which is obtained by a projective transformation of CIE x, y space. The intention is to make the MacAdam ellipses uniformly circles. This would yield a uniform color space.

CIE u’v’:

D. A. Forsyth, J. Ponce, “Computer Vision: A Modern Approach,”

Page 39: Color Spaces

39

CIE LAB obtained as a non-linear mapping of the XYZ coordinates:

CIE LAB:

Here Xn, Yn, and Zn are the X, Y , and Z coordinates of a reference white patch.The LAB space is substantially uniform.

D. A. Forsyth, J. Ponce, “Computer Vision: A Modern Approach,”

Page 40: Color Spaces

40

R. C. Gonzalez, R. E. Woods and S. L. Eddins, “Digital Image Processing UsingMATLAB,” New Jersey, Prentice Hall, 2003.

R. C. Gonzalez, R. E. Wood, “Digital Image Processing,” Prentice Hall, 2nd Edition, 2002.

D. A. Forsyth, J. Ponce, “Computer Vision: A Modern Approach,” Prentice Hall,2nd Edition, 2012.