Computer Assisted Image Analysis TF 3p and MN1 5p Color Image Processing Lecture 14 GW 6 (suggested problem 6.25) How does the human eye perceive color? How can color be described using mathematics? Different color models. Use of color information in image analysis and visualization. Light is electromagnetic radiation. The different wavelengths of the (to humans) visible part of the spectra make up the colors. 20050511 carolina@cb.uu.se 1 20050511 carolina@cb.uu.se 2 Color = the eye s and the brain s impression of electromagnetic radiation in the visual spectra. How is color perceived? illumination s( achromatic light - white or uncolored light, contains all visual wavelengths a complete mix chromatic light - colored monochromatic light - only one wavelength (laser) light source s( reflecting object r( detector rods & cones red-sensitive r( -sensitive g( blue-sensitive b( reflection r( no color that we see consists of only one wavelength the dominating wavelength reflected by the object decides the color tone or hue if many wavelengths are reflected in equal amounts, the object appears gray (white black) 20050511 carolina@cb.uu.se 3 20050511 carolina@cb.uu.se 4 the eye only rods cone (tapp) rods (stav) ~130 milion rods & cones per eye optical nerve rods Sense luminance, or brightness, but not color. Are spread out across the whole retina, and dominate when the pupil is large, i.e. night vision. Less color is seen at night. The response is not linear, but logarithmic. The appearance of an object s intensity depends on the surroundings; the sensation is relative and not absolute. mostly cones radiance (W=J/s) = the total amount of energy flowing from a light source luminance (lumen=cd*sr) = amount of light an observer perceives (i.e. excludes non-visible energy) brightness - a subjective descriptor (corresponds to achromatic intensity) 20050511 carolina@cb.uu.se 5 20050511 carolina@cb.uu.se 6
red-sensitive (65%) r( -sensitive (33%) g( blue-sensitive (2%) b( three kinds of cones g=535nm b=445nm r=575nm standard lightsource object reflectance s( r( CIE 1931 standard observer x x y x = z CIE XYZ values X=14.27% Y=14.31% Z=71.52% CIE standard (Comission Internationale de L Eclairage, 1931) wavelength In order to standardize the description of color, a large number of people were instructed to say what combination of basic colors a certain color sample consisted of in standard lighting. This resulted in the color matching curves, i.e. transform r(, g(, b( x(, y(, z( 20050511 carolina@cb.uu.se 7 400nm 700nm 400nm 700nm 400nm 700nm X = s( r( x( dλ Y = s( r( y( dλ Z = s( r( z( dλ Each color is represented by a point (X,Y,Z) in the 3D CIE color space. The point is called the tristimulus value. 20050511 carolina@cb.uu.se 8 The projection of X+Y+Z=1 creates the CIE-XYZ chromaticity diagram Mixing light and mixing pigment yellow yellow cyan red wavelengths along the edge CIE standard white when x=y=z it is not possible to produce all colors by mixing three primary (CMYK common in printing, where K is black pigment) 20050511 carolina@cb.uu.se colors 9 20050511 carolina@cb.uu.se 10 red magenta R C G = M R+B+G=white [] B 1-[] Y blue magenta blue cyan (additive) R+G=Y C+M+Y=black (subtractive) C+M=B etc... Description of color using color models Color models or color spaces are usually a subspace in a 3D system where each color is represented by a point. RGB color model Examples of color models RGB CMY YIQ HSI NCS } } hardware oriented color image manipulation and color matching (0,0,0) =black (1,1,1)=white 20050511 carolina@cb.uu.se 11 20050511 carolina@cb.uu.se 12
Separation of RGB Rearrangement R of the 3 (R,G, and B) 8-bit images produces new 24-bit color images GBR RGR grayscale color G RRG red blue 20050511 carolina@cb.uu.se 13 B BRG 20050511 carolina@cb.uu.se 14 Safe colors (web palette) A subset of colors that are likely to be reproduced faithfully independent of hardware capabilities. RGB 24-bit color cube (16777216 colors) Coded using hexagonal number system: Each of R, G and B may only have intensity 0, 51, 102, 153, 204 or 255, or 00, 33, 66, 99, CC and FF in hex. RGB safe color cube (216 colors) Thus, black is 000000, red is FF0000, and yellow is FFFF00. 20050511 carolina@cb.uu.se 15 20050511 carolina@cb.uu.se 16 216 colors arranged by hue C [] M Y The CMY(K) color model R [] G B A transform for printing = 1- Ex. red spot on screen (1,0,0) produces pigment mix (1,1,1)-(1,0,0)=(0,1,1), meaning equal parts of magenta and yellow In principal, equal amounts of Cyan (C), Magenta (M), and Yellow (Y) should produce black, but to get a more purelooking black (and to save pigment), a forth color black (K) is often used, referred to as four-color printing. K stands for Key, as the most important color. 20050511 carolina@cb.uu.se 17 HSI (or HLS) color model Hue Saturation Intensity (Hue Lightness Saturation) Hue=dominant wavelength, tone Saturation=purity, dilution by white Intensity=brightness RGB HSI Important aspects: Intensity decoupled from color Related to how humans perceive color 20050511 carolina@cb.uu.se 18
RGB color cube Uses of the HSI color space The intensity description is separated from the color: can do operations on intensity (e.g. histogram equalization) but maintaining color. Similar to our way of describing and classifying color. Hue, Saturation and Intensity of RGB color cube. Note the discontinuity in the Hue, representing the transition from 0 to 360 (displayed as gray levels [0 255]). 20050511 carolina@cb.uu.se 19 Independent of light conditions/shadows. 20050511 carolina@cb.uu.se 20 RGB Hue Make a dark color image lighter 1. RGB HSI 2. histogram equalization on I 3. HSI RGB Saturation Intensity The power of the HIS color model is that it allows for INDEPENDENT control over hue, saturation, and intensity. 20050511 carolina@cb.uu.se 21 20050511 carolina@cb.uu.se 22 (Intensity) (Hue) YIQ color space Y=Lightness I=Inphase = balance red- Q=Quadrature = balance blue-yellow Optimized for transmission (TV broadcast). Compatible with BW monitors (use only Y component) Uses the fact that the human eye is more sensitive to variations in lightness than variations in hue and saturation and more band with (bits) is used for Y. 20050511 carolina@cb.uu.se 23 20050511 carolina@cb.uu.se 24
NCS color description NCS=Natural Color System A psychological more than a physiological description of color. Common for description of paint color among artists, designers, in fashion etc. 2060-R50B= 20% white w 60% black 40 20% color: red with 50% blue c 20050511 carolina@cb.uu.se 25 20 b 60 PSEUDOCOLORING or false coloring The eye can distinguish between only about 30 different shades of gray, but about 350 000 colors. It is often useful to display grayscale images using color to visualize the information better. grayscale image transform color image Types of transforms: intensity slicing each intensity is assigned a color, e.g., different physical properties are assigned different colors. one transform per R, G, B three different kinds of spatial or frequency filters make up the R, G and B band **** it is often important to include the scale in the final image 20050511 carolina@cb.uu.se 26 Example of pseudocoloring in PET intensity slicing: each intensity is assigned a color scale Gray level to color transforms (linear transform) 20050511 carolina@cb.uu.se 27 20050511 carolina@cb.uu.se 28 divide spectra in to different intervals (spectral bands) capture one grayscale image of the intensity in each band Multi-spectral images Multi-spectral image, of Washington D.C., with R, G, B, and IR band. Bottom left shows RGB image, bottom left shows RIGB (where IR is treated as R). Information from multiple bands may be reduced by, e.g., PCA, and the thre strongest components chosen as R, G, and B. * invisible IR or UV bands can be displayed as R, G or B 20050511 carolina@cb.uu.se 29 20050511 carolina@cb.uu.se 30
Color image processing Two different approaches: 1. Process each component image (e.g., R, G, and B) individually and then combine. 2. Work with color pixels (vectors) directly. These two approaches may, or may not produce the same result, depending on processing. 20050511 carolina@cb.uu.se 31 Example 1: smoothing an RGB image is the same as smoothing the R, G and B component independently. Example 2: increasing intensity can be done operating on a single component (I) in HSI space (intensity and color decoupled), instead of operating on three components (R,G,B) in RGB space (but conversion is expensive). 20050511 carolina@cb.uu.se 32 Color Slicing ( magic wand ) Alternative approach for object selection in color images (by Per Holting, MSc thesis at CBA 2004) Extract objects by specifying a position and distance in color space 20050511 carolina@cb.uu.se 33 20050511 carolina@cb.uu.se 34 Tone and color correction Color transformations treating R, G, and B equally will not change the image hue. (increase of contrast, exponential and logarithmic transformation). Adjusting R, G and B, or more commonly C, M and Y, separately will change the hue (or tone) of the image. Color gamuts of screens and output devices may vary! 20050511 carolina@cb.uu.se 35 20050511 carolina@cb.uu.se 36
Problem 6.25 Consider the following 500x500 RGB color image, where the squares are pure red,, and blue. a) Suppose that we convert this image to HIS, blur the H component image with a 25x25 averaging mask, and convert back to RGB. What would the result look like? b) Repeat, blurring only the saturation component this time. blue red (You do not have to deal with the edges of the image.) 20050511 carolina@cb.uu.se 37