Top Banner
September 17, 2013 Computer Vision Lecture 5: Image Filtering 1 Color RGB HSI
15

Color

Feb 23, 2016

Download

Documents

Clyde

RGB. HSI. Color. Conversion from RGB to HSI. It is not too difficult to convert RGB values into HSI values to facilitate color processing in computer vision applications. First of all, we normalize the range of the R, G, and B components to the interval from 0 to 1. - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Color

September 17, 2013 Computer Vision Lecture 5: Image Filtering

1

Color

RGB HSI

Page 2: Color

September 17, 2013 Computer Vision Lecture 5: Image Filtering

2

Conversion from RGB to HSI

It is not too difficult to convert RGB values into HSI values to facilitate color processing in computer vision applications.First of all, we normalize the range of the R, G, and B components to the interval from 0 to 1.For example, for 24-bit color information, this can be done by dividing each value by 255.Then we compute the intensity I asI = 1/3*(R + G + B).Obviously, intensity also ranges from 0 to 1.

Page 3: Color

September 17, 2013 Computer Vision Lecture 5: Image Filtering

3

Conversion from RGB to HSI

Then we compute the values r, g, b that are independent of intensity:

r = R/(R + G + B)g = G/(R + G + B)b = B/(R + G + B)

When we consider the RGB cube, then all possible triples (r, g, b) lie on a triangle with corners (1, 0, 0), (0, 1, 0), and (0, 0, 1).We could call this the rgb-subspace of our RGB cube.

Page 4: Color

September 17, 2013 Computer Vision Lecture 5: Image Filtering

4

Conversion from RGB to HSI

The hue is the angle H from vector pr – w to vector p – w.The saturation is the distance from w to p relative to the distance from w to the fully saturated color of the same hue as p (on the edge of the triangle).

w = (1/3, 1/3, 1/3) (white)

p = (r, g, b)

red (pr)

green

blue

pr - w

p - w

H

Page 5: Color

September 17, 2013 Computer Vision Lecture 5: Image Filtering

5

Conversion from RGB to HSI

Then we have:

||||||||)()(coswpwpwpwp

r

rH

Since w = (1/3, 1/3, 1/3):

222 )3/1()3/1()3/1(|||| bgrwp

And since pr = (1, 0, 0):

3/2|||| wpr

Page 6: Color

September 17, 2013 Computer Vision Lecture 5: Image Filtering

6

Conversion from RGB to HSI

We can also compute:

3)3/1()3/1()3/1(2)()(

bgr

r wpwp

With the above formulas, including those for deriving r, g, and b from R, G, and B, we can determine an equation for computing H directly from R, G, and B:

))(()(2

2cos2 BGBRGR

BGRH

Page 7: Color

September 17, 2013 Computer Vision Lecture 5: Image Filtering

7

Conversion from RGB to HSI

Note that when we use the arccos function to compute H, arccos always gives you a value between 0 and 180 degrees.

However, H can assume values between 0 and 360 degrees.

If B > G, then H must be greater than 180 degrees.

Therefore, if B > G, just compute H as before and then take (360 degrees – H) as the actual hue value.

Page 8: Color

September 17, 2013 Computer Vision Lecture 5: Image Filtering

8

Conversion from RGB to HSIThe saturation is the distance on the triangle in the rgb-subspace from white relative to the distance from white to the fully saturated color with the same hue.Fully saturated colors are on the edges of the triangle.The derivation of the formula for saturation S is very lengthy, so we will just take a look at the result:

),,min(31 BGRBGR

S

Page 9: Color

September 17, 2013 Computer Vision Lecture 5: Image Filtering

9

Limitations of RGB and HSIUsing three individual wavelengths to represent color can never cover the entire visible range of colors:

Page 10: Color

September 17, 2013 Computer Vision Lecture 5: Image Filtering

10

Limitations of any Color RepresentationIt is important to note (again) that our perception of an object’s color does not only depend on the frequency spectrum emitted from the object’s location.It also depends on the spectra of other objects or regions in the visual field. This mechanism called color constancy allows us to assign a color to a given object that is invariant to shading or illumination of the scene by varying light sources.

Page 11: Color

September 17, 2013 Computer Vision Lecture 5: Image Filtering

11

Limitations of any Color Representation

Page 12: Color

September 17, 2013 Computer Vision Lecture 5: Image Filtering

12

Limitations of any Color Representation

Page 13: Color

September 17, 2013 Computer Vision Lecture 5: Image Filtering

13

Let’s move on to…

Image Filtering

Page 14: Color

September 17, 2013 Computer Vision Lecture 5: Image Filtering

14

Histogram Modification

A common and important filter operation is histogram modification.Between any two stages of image processing, it often happens that the range of intensity values in our image is only a small proportion of the possible range.This means that the contrast in the image is weaker than it would have to be.It is then useful to modify the intensity histogram of the image.

Page 15: Color

September 17, 2013 Computer Vision Lecture 5: Image Filtering

15

Histogram Modification

One possible method for this is image scaling: We simply expand the range [a, b] containing most of the intensities in the image to fill the entire range [z1, zk].

This means that the value z of each pixel in the original image is mapped onto the value z’ in the scaled image in the following way:

11 )(' zazabzzz k

Notice that this method may leave gaps between bins in the resulting histogram.