560 likes | 696 Views
The Science of Digital Media. Course Book Details. Title: The Science of Digital Media Author: Jennifer Burg Publisher: Pearson International Edition Publication Year: 2009. The Science of Digital Media. General Course Contents.
E N D
The Science of Digital Media Course Book Details Title: The Science of Digital Media Author: Jennifer Burg Publisher: Pearson International Edition Publication Year: 2009 Metropolia University of Applied Sciences, Digital Media, Erkki Rämö, Principal Lecturer
The Science of Digital Media General Course Contents • Chapter 1: Digital Data Representation and Communication • Chapter 2: Digital Image Representation • Chapter 3: Digital Image Processing Metropolia University of Applied Sciences, Digital Media, Erkki Rämö, Principal Lecturer
The Science of Digital Media General Course Contents • Chapter 2: Digital Image Representation • Bitmaps • Frequency in Digital Images • The Discrete Cosine Transform • Aliasing • Color • Vector Graphics • Algorithmic art and Procedural Modeling Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color Color Perception and Representation Color is both physical and psychological phenomenon Physically, color is composed of electromagnetic waves For humans, the wavelength of visible colors fall between approximately 370 and 780 nanometers (nm), i.e., 1nm = 10-9 meters These waves fall upon the color receptors of the eyes, and in a way not completely understood, the human brain translates the interaction between the waves and the eyes as color perception Metropolia University of Applied Sciences, Digital Media, Erkki Rämö, Principal Lecturer
2.6 - Color Color Perception – Spectral Density (1) It is possible to create pure color composed of a single wavelength, e.g., by means of a laser But most colors we see around us are almost always produced by a combination of wavelengths Green cover of a book may look pure green to you, but a spectrograph will break it up into its components wavelengths, producing a spectral density function P(λ) A spectral density function shows the contribution of the wavelengths λ to a given perceived color as λ varies across the visible spectrum Metropolia University of Applied Sciences, Digital Media, Erkki Rämö, Principal Lecturer
2.6 - Color Color Perception – Spectral Density (2) Spectral density functions are one mathematical way to represent colors, but not very convenient way for computers One problem is that, more than one spectral density curve can represent two colors that look the same It is possible to represent a color by means of a simpler spectral density graph (Hue Saturation Value –HSV and Hue Lightness Saturation - HLS color modes uses this color representation) Metropolia University of Applied Sciences, Digital Media, Erkki Rämö, Principal Lecturer
2.6 - Color Color Perception – Spectral Density (3) • Each color in the spectrum can be characterised by a unique graph that has a simple shape • The graph for each color gives the color’s dominant wavelength, equivalent to the hue; its saturation (i.e., color purity) and its luminance. • The dominant wavelength is the wavelength at the spike in the graph • The area beneath the curve indicates the luminance L • Saturation S is the ratio of the area of the spike to the total area. Metropolia University of Applied Sciences, Digital Media, Erkki Rämö, Principal Lecturer
2.6 - Color Color Perception – Spectral Density (4) Figure 2.43 Spectral density graph showing hue, saturation and lightness More precisely with regard to Figure 2.43 Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color Color Perception – Spectral Density (5) • The dimensions of hue, saturation and brightness do not correspond very well to the computer monitors • Cathode Ray Tube (CRT) monitors – display colored light through a combination of red, green and blue phosphors, which light up at varying intensities when excited by electron bean • Liquid Crystal Display (LCD) panels – display color with neighboring pixels of red, green and blue that are either lit up or masked by the liquid crystals Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color Color Perception – Spectral Density (6) So, what is the best way to model color for the computer? There is no simple answer since different models have advantages in different situations. Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color RGB Color Model (1) • Varying combinations of three primary colors can create a wide range of colors • Three colors are primary with respect to one another if no one of them can be created as a combination of the other two • Red, Gree and Blue are good choices as primary colors because the cones of the eyes (color receptors) are especially sensitive to these hues Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color RGB Color Model (2) • C = rR + gG + bB where r, g and b indicate the relative amounts of red, green and blue energy respectively. Also referred to as the values of the RGB color components or (color channels in application programs) R, G and B are constant values base on the wavelengths chosen for the red, green and blue components Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color RGB Color Model (3) The color space for the RGB color model is easy to depict graphically Let R, G and B correspond to three axes in 3D space The relative amount of red, green and blue are normalized to vary between 0 and 1 The origin (0,0,0) of the RGB cube correspond to black and white is the value (1,1,1). The remaining corners correspond to red, green and blue and their complementary colors i.e., cyan, magenta and yellow respectively Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color RGB Color Model (4) Figure 2.44: RGB Color Cube Other colors are created at values between 0 and 1 for each of the components. For example (1, 0.65, 0.15) is light orange etc Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color RGB Color Model (5) • Shades of gray have equal proportions of red, green and blue and lie along the line between (0,0,0) and (1,1,1). • All grayscale values have equal amount of R, G and B • Standard equation is used to convert RGB to grayscale • Let an RGB color pixel be given by (R, G, B), where R, G and B are red, green and blue color components respectively. The corresponding gray value is given by (L, L, L), whereL = 0.30R + 0.59G + 0.11B Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color RGB Color Model (6) Since all three color components are equal in gray pixel, only one of the three values needs to be stored. Thus a 24-bit RGB pixel can be stored as an 8-bit grayscale pixel Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color CMY Color Model (1) Like the RGB color model, the CMY color model divides a color into three primaries, but using a subtractive rather than additive color creation process The CMY color model can be depicted in a unit cube similar to the RGB model The difference is that the origin of the cube is white rather than black The value of each component indicates how much red, green and blue are subtracted out , effectively combining the color components cyan, magenta and yellow their respective components Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color CMY Color Model (2) • Assuming that each of the three RGB (or CMY) components is a value between 0 and 1, the corresponding CMY components can be computed as follows: • For a pixel represented in RGB color, the red, green and blue color components are respectively, R, G, and B. Then the equivalent C, M and Y color components are given by: C = 1- R M = 1 - G Y = 1 - B Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color CMY Color Model (3) • Similarly, RGB values cab be computed from CMY values R = 1- C G= 1 - M B = 1 - Y • The values can be given in the range of [0 255] or [0 1] • The CMY model used in professional four-color printed process, indicates how much cyan, magenta and yellow ink should combine to create color Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color CMY Color Model (4) Theoretically, the maximum amount of cyan, magenta and yellow ink should combine to produce black, but practically they produce dark muddy brown In four-color professional printing a fourth component is added, a pure black ink for greater clarity and contrast Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color CMY Color Model (5) • The amount of “K” or black, can be taken as the smallest of the C, M and Y components in the original CMY model. Thus the CMY model is define as follows: • For a pixel represented in the CMY color model, the cyan, magenta and yellow color components are respectively, C, M and Y. Let K be the minimum of C, M and Y. Then the equivalent color components in the CMYK model, Cnew, Mnew, Ynew and K are given by K = min(C, M, Y) Cnew = C - K Mnew = M - K Ynew = Y - K Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color HSV and HLS Color Models (1) • Instead of representing color by three primary color components, it is possible to speak of color in terms of: • its hue (i.e., the essential color), • its lightness (or value of luminance) and • its saturation (i.e., the purity of the color) • Both the HSV color model (also called HSB) and the HLS model represent color in this manner • Geometrically, the HSV color space is a distortion of the RGB space into a kind of three-dimensional diamond called a hexacone Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color HSV and HLS Color Models (2) Figure 2.46: RGB color cube ollapsed to 2D Figure 2.45: RGB color cube viewed from the top See Figure 2.45, 2.46, 2.46 and 2.47 for the series of distortions Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color HSV and HLS Color Models (3) Figure 2.47: HSV color space, a hexacone Figure 2.48: HLS Color Space Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color HSV and HLS Color Models (4) The distortion of the RGB color space to either HSV or HLS is a non-linear transformation In other words to translate from RGB to HSV, you can’t simply multiply each of the R, G and B components by some coefficient Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color HSV and HLS Color Models (5) Algorithm 2.3 shows how to translate RGB to HSV Algorithm 2.4 translates from RGB to HLS Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color Luminance and Chrominance Color Models (1) • Another way to specify a color is to capture all the luminance information in one value and put the color (i.e., chrominance) information in the other two values. • The YIQ model is one example that takes this approach • The YIQ is a simple translation of the RGB model, separating out the information in a way that is more efficient for television broadcasting • In the early days of color televisions, both black and white and color signals had to be transmitted because not all consumers had color television sets Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color Luminance and Chrominance Color Models (2) • A linear transformation of the values makes this possible. • For a pixel represented in RGB color, le the red, green and blue color components be respectively R, G and B. Then the equivalent Y, I and Q color components in the YIQ color model are given by • The values in the transformation matrix depend upon the particular choice of primaries for the RGB model • Y is the luminance component, I and Q are chrominance Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color Luminance and Chrominance Color Models (3) The coefficients in the matrix are based on primary colors of red, green and blue that are appropriate for the standard National Television System Committee (NTSC) RGB phosphor One more advantage of isolating luminance is that human vision is more sensitive to differences in luminance that differences in color Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color Luminance and Chrominance Color Models (4) In practical terms, this means that we don’t need as many bits and therefore as much bandwidth for the transmission of the I and Q components relative to the Y component The inverse of the matrix (previous slide) is used to convert from YIQ to RGB The YUV color model, originally used in the Europian PAL analog video standard, is also based on luminance and chrominance Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color Luminance and Chrominance Color Models (5) The YCbCr model is closely related to the YUV with its chrominance values scaled and shifted The YCbCr is used in JPEG and MPEG compression Using YCbCr compression technique some chrominance is can be sacrificed during compression without visible loss of quality in photographic images i.e., chroma sampling Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color CIE XYZ and Color Gamuts Disadvantage of RGB is that there exists visible colors that cannot be represented with positive values for each of the red, green and blue components There are 256 evenly-spaced increments of varying color intensities for red, green and blue component (i.e., 256 x 256 x 256 = 16, 777, 216 colors), but this is wrong! There exists colors outside the range of those we can create in RGB, colors that we cannot capture with any combination of red, green and blue We can know these colors by an experiment called color matching Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color CIE XYZ and Color Gamuts – Color Matching (1) Human subjects are asked to compare pure colors projected onto one side of the screen to composite colors projected beside them The pure colors are created by single wavelength light The composite colors are created by a combination of red, green and blue light, and the amount of the three components are called the tristimulus values There are pure pure colors in the visible spectrum that cannot be reproduced by positive amounts of red, green and blue light Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color CIE XYZ and Color Gamuts - Color Matching (2) In some cases it is necessary to “subtract out” some of the red, green or blue in the combined beam to match the pure color The implication of this experiment is that no computer that bases its color display on combinations of red, green and blue light can display all visible colors The range of colors that a given monitor can display is called color gamuts Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color CIE XYZ and Color Gamuts - Color Matching (3) Computer monitors may vary in their choices of basic R, G and B primaries, then two monitors can have different gamuts By similar reasoning, the gamut of CMYK model will vary from one based on on RGB Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color CIE XYZ and Color Gamuts - Color Matching (4) In practical terms, there are colors that you can represent on the computer monitor but cannot print, and vice versa CIE XYZ was the first color model that represents all visible colors, was devised in 1931 by the Commission Internationale de I’Eclairage. Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color CIE XYZ and Color Gamuts - Color Matching (5) • r(λ), g(λ) and b(λ) are the light energy needto create the perceived pure spectral red at wavelength λ • Let C(λ) be the color the average observer perceives at wavelength λ, then C(λ) = r(λ)R + g(λ)G + b(λ)B • R, G and B are pure spectral at a fixed wavelength Figure 2.49:Color matching functions • Note that in some cases , red has to be “subtracted” from the composite light (i.e., added to the pure sample) in order to achieve a match Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color CIE XYZ and Color Gamuts - Color Matching (6) There are no three visible primary colors that can be combined in positive amounts to create all colors in the visible spectrum The CIE model based on observation uses three “virtual” primaries called X, Y and Z to do so X, Y and Z are purely theoretical primaries rather than physical entities While they do not correspond to wavelengths of visible light, they provide a mathematical way to describe colors that exist in the visible spectrum Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color CIE XYZ and Color Gamuts - Color Matching (7) The equation to represent all visible colors becomes: C(λ) = x(λ)X + y(λ)Y + z(λ)Z Figure 2.50: XYZ color matching functions • Expressing the color matching function in terms of X, Y and Z produces the graph in Figure 2.50 • X, Y and Z are chosen so that all three functions remain positive over the wavelengths of the visible spectrum Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color CIE XYZ and Color Gamuts - Color Matching (8) CIE color model makes it possible to graphically compare the color gamuts To simplify things further, it is convenient to normalize the values of x(λ), y(λ) and z(λ) so that they sum to 1 That is, the three colors combine to unit energy Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color Chromaticity Values The normalized values show each component’s fractional contribution to the color’s overall energy In this way any two of the color components give us the third one. For example,x’(λ), y’(λ) and z’(λ) are called the Chromaticity values Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color Chromaticity Values Space Figure 2.51:X + Y + Z = 1 plane Solid triangle represents positiveoctant (unit energy), the curves on the plane shows the values of s’(λ), i.e., pure spectral colors in the visible spectrum Figure 2.51 shows where the chromaticity values fall within the CIE three-dimensional space. Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color Visible Color into X + Y + Z = 1 Plane Figure 2.52: Visible color spectrum projected onto the X + Y + Z = 1 plane s(λ)is the finely dotted line, X+Y+Z=1 plane is a triangle drawn with solid lines and the projection of s(λ) is s’(λ) the horse-shaped coarsely dotted line The dotted line in Figure 2.52 graphs the values of x, y and z for all perceived colors C(λ) as λ varies across the visible spectrum Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color CIE Visible Color Space Figure 2.53: Visible colors in CIE color space Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer The horseshoe-shaped coarsely dotted line, form the perimeter of the cone seen in Figure 2.53
2.6 - Color CIE Chromaticity Diagram Figure 2.54: CIE chromaticity diagram Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer The 2D projection on the XY plane (Figure 2.54) is called the CIE Chromaticity Diagram In this 2D diagram we have a space to compare the gamuts of varying color models Color is a 3D phenomenon, therefore requires three values for its specification, the dropped information in this 2D projection is Energy.
2.6 - Color RGB versus CMYK Gamuts • The gamut for RGB color is larger than the CMYK gamut • However, neither color space is entirely contained within the other • Therefore, there are colors that you can display on the computer screen that cannot be printed, and vice versa Figure 2.55: RGB vs. CMYK gamuts CIE diagram is helpful in illustrating color concepts and relationships Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color CIE XYZ to RGB Linear Transformation Conversion from RGB to CIE-XYZ usesthe inverse of the matrix • Also CIE Chromaticity Diagram gives us a way to standardize color representation • The conversion from CIE-XYZ to RGB is a simple linear transformation • For a pixel represented in XYZ color, let the values for the three color components be X, Y and Z. Then the equivalent R, G and B color components in the RGB color model are given by: Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color CIE XYZ and Color Gamuts • Summary advantages of CIE XYZ model • It is device-independent • It provides a way to present all colors visible to humans • And the representation is based upon spectrophotometric measurements of colors • Disadvantages of the RGB and CMYK models • They are not device-independent i.e., different computer monitors and printers can use different values for R, G and B, gamuts are not identical • They are not comprehensive, some visible colors to human will exist which cannot be presented Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color CIE L*a*b*, CIE L*U*V*, and Perceptual Uniformity (1) • One disadvantage of CIE XYZ model is that • It is not perceptually uniform • In a perceptually uniform color space, the distance between two points is directly proportional to the perceived difference between the two colors • It is possible for a color model to be perceptually uniform in one dimension but not perceptually uniform in its three dimensions taken together Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer
2.6 - Color CIE L*a*b*, CIE L*U*V*, and Perceptual Uniformity (2) • In 1976 the Commission Internationale de I’Eclairage refined its color models and produced CIE L*a*b* and CIE L*U*V* modeles • The CIE L*a*b* is a subtractive color model in which L* axis gives brightness values varying from 0 to 100, the a axis moves from red(positive values) to green(negative values) and the b axis moves from yellow(positive values) to blue(negative values) • The CIE L*U*V* is additive color model that was similarly constructed to achieve perceptual uniformity, but that was less convenient in practical usage Metropolia University of Applied Sciences, Digital Media, ErkkiRämö, Principal Lecturer