Image processing & Computer vision Xử lí ảnh và thị giác máy tính Color Alain Boucher - IFI
Introduction To be able to see objects and a scene, we need light Otherwise, everything is black How does behave the light when it touches a surface? What are the influence of the surface properties? Our first perception of light is color But not the only one 2
Introduction Interest of color segmentation and recognition are simplified more information per pixel instead of only one Multi-spectral images Each pixel contains information from a spectral bandwith We obtain color images, for example, by taking 3 bands from the visible spectrum Some devices exist to acquire signal from more bands (X-ray, infrared, radio,...) 3
Humans and color For human, color is perceived in the eyes via cones 3 types of cones: Low, Medium and Supra-Frequency. We often refer to them as red, green and blue cones L M S Source : Patrick Hébert, Vision numérique, Université Laval (Québec, Canada). 4
Color and natural scenes Depending on conditions, the color that we see in a scene can vary a lot. This makes image processing more complicated Violet Indigo Blue Green Yellow Orange Red Source : Marc Pollefeys, Computer vision, University of North Carolina (USA). 5
Albedo and color perception When we perceive color, what we see correspond to a function spreading over all the frequencies This function is called spectral albedo Source : Marc Pollefeys, Computer vision, University of North Carolina (USA). 6
Red-Green-Blue representation 7
Primary colors Color representation using primary colors Red-Green-Blue Additive scheme (for displaying on a screen) For a grey level: R=G=B Color representation using primary colors Cyan-Magenta-Yellow Substractive scheme (for printing on paper) We substract from white instead of adding to black like in RGB CMY = 1 - RGB 8
Addition/substraction of colors The additive scheme (top) is used for displaying on screen while the substractive (bottom) is used mainly for printing on paper Source : Gonzalez and Woods. Digital Image Processing. Prentice-Hall, 2002. 9
Color segmentation Color is analyzed as three components Using different color component allows to complete and improve the results Example: thresholding true only if all three, or 2 on 3, color components are superior to the threshold Example: add edges detected on all 2 color planes 10
Color image processing Input image RGB decomposition Histogram Intensity profile Gradient Sobel Segmentation 11
3D color histogram We can detect color of an object by building a 3D histogram We allocate a 3D array of size N (example: N=32) for reducing the histogram size For each color pixel, we increment the corresponding cell in the histogram Color of the object Color of the light G Source : James L. Crowley, Vision par ordinateur, INPG (France). 12
Color spaces There ar many different spaces to represent colors RGB is the most common in computer science Easy to implement on hardware for displying color Not the best for image processing We can choose a better image coding to improve results 13
Color spaces There are three types of color spaces: Purely physic approach RGB, XYZ,... Purely visual approach Munsell, HSV,... Physic approach, but corrected by psychometry LAB, LUV,... Source : Jean-Marc Breteau. Cours de colorimétrie. Université du Maine (France). http://prn1.univ-lemans.fr/prn1/siteheberge/optique/m7g5_jmbreteau/co/m7g5.html 14
Hue-Saturation-Value The Hue-Saturation-Value (HSV) color space is useful for segmentation and recognition Non-linear conversion Visual representation of colors We identify for a pixel The pixel intensity (value) The pixel color (hue + saturation) RGB does not have this seperation In RGB, all three components are correlated 15
HSV representation G Teinte Hue R Hue (H) is coded as an angle between 0 and 360 Saturation (S) is coded as a radius between 0 and 1 S = 0 : gray S = 1 : pure color Value (V) = MAX (Red, Green, Blue) B Note: we can find in the litterature different definitions more or less equivalent of HSV 16
Different possibilities for HSV 17
Luminance/color models Other examples There are many representation models (cone, cylinder, polygonal,...) separating luminance and color of a pixel Source : Gonzalez and Woods. Digital Image Processing. Prentice-Hall, 2002. 18
Effect of saturation Left: Input image Center: saturation decrease of 20% Right: saturation increase of 20% Source : Source : Patrick Hébert, Vision numérique, Université Laval (Québec, Canada). 19
HSV segmentation If we know the color of the object we are looking for, we can model it using a hue interval Take care, because it is an angle (periodic value) Hue < 60 means nothing Is 350 smaller or bigger than 60? Define an interval: 350 < Hue < 60 (for example) This interval is valid if Saturation > threshold (otherwise gray level) This is independant of Value, which is more sensible to light conditions 20
Color decomposition Source : Gonzalez and Woods. Digital Image Processing. Prentice-Hall, 2002. 21
Lab color space (La*b*) The Lab system (sometimes La*b*) is based on a study from human vision independant from all technologies presenting colors as seen by the human eyes Colors are defined using 3 values L is the luminance, going from 0% (black) to 100% (white) a* represents an axis going from green (negative value) tp red (positive value) b* represents an axis going from blue (negative value) to yellow (positive value) Source : http://fr.wikipedia.org/wiki/cie_lab 22
Lab color space (La*b*) L=25% L=75% Source : http://www.tsi.enst.fr/tsi/enseignement/ressources/mti/rvb_ou_ Source : http://fr.wikipedia.org/wiki/cie_lab 23
Example of using color for robotic vision Robotic vision: a camera on a robot helps it to move into a known/unknown environment Source : Wasik & Saffiotti. Robust Color Segmentation for the RoboCup Domain. 16th International Conference on Pattern Recognition (ICPR'02), Vol. 2, p. 20651, 2002. 24