Digital Image Processing PDF - Color Image Processing
Document Details
Uploaded by EloquentRetinalite9493
NIT Hamirpur
Dr. Ram Prakash Sharma
Tags
Summary
These notes provide a summary of digital image processing focusing on color image processing. The document explains color fundamentals, models, and their applications. It also details how colors are perceived.
Full Transcript
12-04-2024 Digital Image Processing Introduction Color Image Processing Color fundamentals...
12-04-2024 Digital Image Processing Introduction Color Image Processing Color fundamentals Color models Dr. Ram Prakash Sharma NIT Hamirpur Reference: R. Gonzalez and R. Woods. Digital Image Processing, Prentice Hall, 2008. RPS 1 RPS 2 1 2 Introduction: Color Image Processing Color Fundamentals In 1666 Sir Isaac Newton discovered that when a beam of sunlight passes through a glass prism, the emerging beam is split into a spectrum of colors RPS 3 RPS 4 3 4 1 12-04-2024 Color Fundamentals (cont…) Color Fundamentals (cont…) The colors that humans and most animals perceive in an object Chromatic light spans the electromagnetic spectrum from are determined by the nature of the light reflected from the approximately 400 to 700 nm. object Human color vision is achieved through 6 to 7 million cones in each For example, green eye. objects reflect light with wave lengths primarily in the range of 500 – 570 nm while Colors Absorbed absorbing most of the energy at other wavelengths. RPS 5 RPS 6 5 6 Color Fundamentals (cont…) Color Fundamentals (cont…) 3 basic quantities are used to describe the quality of a chromatic light source: Three principal sensing groups: Radiance: the total amount of energy that flows from the light 66% of these cones are sensitive to red light source (measured in watts) 33% to green light Luminance: the amount of energy an observer perceives from 2% to blue light. the light source (measured in lumens) Note we can have high radiance, but low luminance Absorption curves for the different cones have been determined Brightness: a subjective (practically unmeasurable) notion experimentally. that embodies the achromatic notion of intensity of light Strangely these do not match the CIE standards for red (700nm), green (546.1nm) and blue (435.8nm) light as the standards were developed before the experiments! RPS 7 RPS 8 7 8 2 12-04-2024 Color Fundamentals (cont…) Color Fundamentals (cont…) Notice that the curves centered The primary colors can be at G and R are very close added to produce the secondary colors. Mixing the three primaries produces white. Mixing a secondary with its opposite primary produces white (e.g. red+cyan). RPS 9 RPS 10 9 10 Color Fundamentals (cont…) Color Fundamentals (cont…) Important difference: Distinguishing one color from another: Primary colors of light (red, green, blue) Brightness: the achromatic notion of intensity. Primary colors of pigments (colorants) Hue: the dominant wavelength in a mixture of light A color that subtracts or absorbs a primary color of light and waves (the dominant color perceived by an observer, e.g. reflects the other two. when we call an object red or orange we refer to its hue). These are cyan, magenta and yellow (CMY). Saturation: the amount of white light mixed with a hue. A proper combination of pigment primaries produces black. Pure colors are fully saturated. Pink (red+white) is less saturated. RPS 11 RPS 12 11 12 3 12-04-2024 Color Fundamentals (cont…) Color Fundamentals (cont…) Hue and saturation are called chromaticity. A color is then specified by its trichromatic Therefore, any color is characterized by its brightness and coefficients: chromaticity. X Y Z x , y , z The amounts of red, green and blue needed to form a X Y Z X Y Z X Y Z particular color are called tristimulus values and are denoted by X, Y, Z. x y z 1 RPS 13 RPS 14 13 14 CIE Chromaticity Diagram CIE Chromacity Diagram (cont…) Specifying colors systematically can be achieved using Point marked “Green” the CIE chromaticity diagram. 62% green, 25% red and 13% blue. On this diagram the x-axis represents the proportion of red and the y-axis represents the proportion of green used to produce a specific color. Point marked “Red” The proportion of blue used in a color is calculated as: 32% green, 67% red and z = 1 – (x + y) 1% blue. The diagram is usefull for color mixing. RPS 15 RPS 16 15 16 4 12-04-2024 CIE Chromacity Diagram (cont…) CIE Chromacity Diagram (cont…) Any color located on Any straight line joining the boundary of the two points in the diagram chromaticity chart is defines all the different fully saturated (Pure colors that can be colors). obtained by combining The point of equal these two colors energy (PEE) has equal additively. amounts of red, green A line drawn from the PEE and blue. to any point on the It is the CIE standard for boundary defines all the pure white. shades of that particular color. RPS 17 RPS 18 17 18 CIE Chromacity Diagram (cont…) CIE Chromacity Diagram (cont…) By combining any three A triangle with vertices given colors we may at any three fixed pure obtain the colors colors cannot enclose enclosed in the triangle the entire color region. defined by the three initial colors. RPS 19 RPS 20 19 20 5 12-04-2024 CIE Chromacity Diagram (cont…) CIE Chromacity Diagram (cont…) The triangle shows the The boundary of the typical color gamut printing gamut is irregular produced by RGB because printing is a monitors. combination of additive The entire color range and subtractive color cannot be displayed mixing. based on any three This is a more difficult colors. process to control than The irregular shape is the that of displaying colors. gamut achieved by high quality color printers. RPS 21 RPS 22 21 22 Color Models RGB In the RGB model each color appears in its primary From the previous discussion it should be obvious that there are spectral components of red, green and blue. different ways to model color. The model is based on a Cartesian coordinate system. We will consider two very popular models used in color image processing: RGB (Red Green Blue) CMY CMYK HSI (Hue Saturation Intensity) RPS 23 RPS 24 23 24 6 12-04-2024 RGB RGB (cont…) RGB values are at 3 corners. Cyan magenta and yellow are Images represented in the RGB color model consist of three at three other corners. component images – one for each primary color. Black is at the origin. When fed into a monitor these images are combined to create a White is the corner furthest composite color image. from the origin. The number of bits used to represent each pixel is referred to as the Different colors are points on color depth. or inside the cube A 24-bit image is often referred to as a full-color image as it allows represented by RGB vectors. = 16,777,216 colors. 28 3 RPS 25 RPS 26 25 26 RGB (cont…) RGB (cont…) Safe RGB colors (or all-system safe color, safe web color): a subset of colors that are likely to be reproduced faithfully reasonably independently of viewers hardware capability. 216 colors = 6×6×6 6 levels in R, G, and B: in decimal: 0, 51, 102, 153, 204, or 255 In hex: 00, 33, 66, 99, CC, FF RPS 27 RPS 28 27 28 7 12-04-2024 CMY Model CMYK Model Secondary color of light/ Primary color of pigments Equal amounts of the pigment primaries, cyan, magenta, When a surface coated with cyan pigment is illuminated with white and yellow should produce black. light, no red light is reflected from the surface. In practice, combining these colors for printing produces a muddy- RGB -> CMY conversion is performed using the simple operation. looking black. So, in order to produce true black (which is the predominant color in printing), a fourth color, black, is added, giving rise to the CMYK color model. Thus, when publishers talk about “four-color printing,” they are referring to the three colors of the CMY color model plus black RPS 29 RPS 30 29 30 The HSI Color Model The HSI Color Model (cont…) RGB is useful for hardware implementations and is serendipitously Reminder: related to the way in which the human visual system works. Hue: A color attribute that describes a pure color (pure yellow, orange or red). However, RGB is not a particularly intuitive way in which to describe Saturation: Gives a measure of how much a pure color is diluted with white colors. light. Intensity: Brightness is nearly impossible to measure because it is so Rather when people describe colors they tend to use hue, saturation subjective. Instead we use intensity. Intensity is the same achromatic notion and brightness. that we have seen in grey level images. RGB is great for color generation, but HSI is great for color description. RPS 31 RPS 32 31 32 8 12-04-2024 HSI, Intensity & RGB HSI, Intensity & RGB (cont…) Intensity can be extracted from RGB images. The intensity component However, human perception of color does not refer to percentages of of any color can be RGB. determined by passing a plane perpendicular to Remember the diagonal on the RGB color cube that we saw the intenisty axis and previously ran from black to white. containing the color Now consider if we stand this cube on the black vertex and position point. the white vertex directly above it. The intersection of the plane with the intensity axis gives us the intensity component of the color. RPS 33 RPS 34 33 34 HSI, Intensity & RGB (cont…) HSI, Hue & RGB The saturation of a color (percentage of white missing In a similar way we can extract the hue from the RGB color cube. from the color) increases as a Consider a plane defined by function of distance from the the three points cyan, black intensity axis. and white. All points contained in this plane must have the same hue (cyan) as black and white cannot contribute hue information to a color. RPS 35 RPS 36 35 36 9 12-04-2024 HSI, Hue & RGB The HSI Color Model By rotating the shaded plane If we look straight down at the RGB cube as it was around the intensity axis we arranged previously obtain different hues. we would see a hexagonal Conclusion: shape with each primary The HSI values can be obtained color separated by 120° from the RGB values. and secondary colors We have to work the at 60°from the primaries. geometric formulas. The HSI model is composed of a vertical intensity axis and the locus of color points that lie on planes perpendicular to that axis. RPS 37 RPS 38 37 38 The HSI Color Model (cont…) The HSI Color Model (cont…) Hexagonal shape at an arbitrary As the only important things are the angle and the color point length of the saturation vector this plane is also The hue is determined by an often represented as a circle or a triangle. angle from a reference point, usually red. The saturation is the distance from the origin to the point. The intensity is determined by how far up the vertical intensity axis this hexagonal plane sits (not apparent from this diagram). RPS 39 RPS 40 39 40 10 12-04-2024 HSI Model Examples HSI Model Examples RPS 41 RPS 42 41 42 Converting From RGB To HSI Converting From HSI To RGB Given a color as R, G, and B its H, S, and I values are calculated as follows: Given a color as H, S, and I it’s R, G, and B values are calculated as follows: if B G RG sector (0 RGB (cont…) Hue Saturation Intensity RGB Image RPS 49 RPS 50 49 50 RPS 51 RPS 52 51 52 13