Image Processing for Mechatronics Engineering For senior undergraduate students Academic Year 2017/2018, Winter Semester Lecture 8: Color Image Processing 04.11.2017 Dr. Mohammed Abdel-Megeed Salem Media Engineering Technology, German University in Cairo
Course Info - Contents 1. Introduction 2. Elementary Image Information and Operations 3. Fundamentals of Signal and Image Processing 1. Definition, 2. Important Signals 3. Signal & Image Processing 4. Sampling and Quantization 4. Image Acqusition and Digitization 5. Sensing and Perception (HVS) 6. Color Image Processing 7. Image Operations 1. Point Image Operations 2. Local Image Operations and Filters 3. Global Image Operation and Transforms Salem, Image Processing for Mechatronics Engineering, Winter Semester 2017 Lecture 8 2
Color Color is an essential element of multimedia, used in vector graphics, bitmapped images, video, animation and text. Color science attempts to relate the subjective sensation of color to measurable and reproducible physical phenomena. Salem, Image Processing for Mechatronics Engineering, Winter Semester 2017 Lecture 8 3
Spectral Power Distribution A spectral power distribution (SPD) is a description of how the intensity of light varies with its wavelength. The wavelength of visible light lies roughly between 400 nm and 700 nm Salem, Image Processing for Mechatronics Engineering, Winter Semester 2017 Lecture 8 4
Color and Electromagnetic Spectrum Salem, Image Processing for Mechatronics Engineering, Winter Semester 2017 Lecture 8 5
Color and Electromagnetic Visible light: a narrow band of electromagnetic radiation Spectrum Wavelength: Each physically distinct color corresponds to at least one wavelength in this band. 380nm (blue) 780nm (red) Pure Colors: Pure or monochromatic colors do not exist in nature. Salem, Image Processing for Mechatronics Engineering, Winter Semester 2017 Lecture 8 6
Color Perception The use of color in Image Processing and Graphics is motivated by two principal factors: Color is a powerful descriptor Humans can distinguish between thousands of color shades and intensities compared to about only two dozen shades of gray The tristimulus theory of color implies that any color can be produced by mixing suitable amounts of three additive primary colors. Salem, Image Processing for Mechatronics Engineering, Winter Semester 2017 Lecture 8 7
Rods and Cones Rods are responsible for vision at low light levels. They do not do color vision, and have a low spatial acuity. Cones are active at higher light levels, are capable of color vision and are responsible for high spatial acuity. Salem, Image Processing for Mechatronics Engineering, Winter Semester 2017 Lecture 8 8
Color Perception Detailed experimental evidences has established that the 6 to 7 million cones in the human eye can be divided into three principal sensing categories, corresponding roughly to red, green and blue. Approximately 62% of all cones are sensitive to Red Light, 31% are sensitive to Green Light and about 7% are sensitive to Blue Light (most sensitive) For this reason, red, green, and blue are referred to as the primary colors of human vision. Salem, Image Processing for Mechatronics Engineering, Winter Semester 2017 Lecture 8 9
Rods and Cones
Rods and Cones The number of S-cones was set to 7%. The L-cone : M-cone ratio was set to 1.5. Throughout the whole retina the ratio of L- and M- cones to S- cones is about 100:1. Salem, Image Processing for Mechatronics Engineering, Winter Semester 2017 Lecture 8 11
Color Models Color model, also called Color Space or Color System, facilitate the specification of colors in standard way A color model is a specification of a coordinate system and a subspace within that system where each color is represented by a single point Color Models RGB (Red, Green, Blue) CMY (Cyan, Magenta, Yellow) HSI (Hue, Saturation, Intensity) YIQ (Luminance,In phase, Quadrature) YUV (Y stands for the luma component (the brightness) and U and V are the chrominance (color) components ) Salem, Image Processing for Mechatronics Engineering, Winter Semester 2017 Lecture 8 12
RGB-Color Model In RGB colour, the three primaries are standard shades of red, green and blue. Any colour is specified as three values (R, G, B ) giving the relative proportions of the three primaries. This is often written as a 6-digit hexadecimal number, with R, G and B each being between 0 and 255, so a color value occupies 24 bits. The number of bits used to store a color value the color depth determines how many different colors can be represented. The use of lower color depths leads to posterization and loss of image detail, but reduces file size. Salem, Image Processing for Mechatronics Engineering, Winter Semester 2017 Lecture 8 13
RGB-Color Model It is not possible to represent every visible colour as a combination of red, green and blue components. However, the RGB model provides a useful, simple and efficient way of representing colours (R, G, B), are the amounts of red, green and blue light making up the colour. By amount, we mean the proportion of pure ( saturated ) light of that primary. Any value of the form (x, x, x) represents a grey: the higher the value of x, the lighter the grey. RGB colour gamut and all the visible colours, Salem, Image Processing for Mechatronics Engineering, Winter Semester 2017 Lecture 8 14 1
RGB Model Each color is represented in its primary color components Red, Green and Blue Based on Cartesian Coordinate System Salem, Image Processing for Mechatronics Engineering, Winter Semester 2017 Lecture 8 15
Colour Depth The number of bits used to hold a colour value is often referred to as the colour depth: when three bytes are used, the colour depth is 24, referred as 24-bit colour. Other possibilities, is 1-bit (bi-level) colour. A single bit allows us to distinguish two different colours. A colour depth of 4 bits allows 16 different colours. Salem, Image Processing for Mechatronics Engineering, Winter Semester 2017 Lecture 8 16 1
Colour Depth A photograph in 24, 8 (top), 4 and 1 (bottom) bit colour Salem, Image Processing for Mechatronics Engineering, Winter Semester 2017 Lecture 8 17 1
Colour Depth 24-bit (left) and 8-bit (right) colour Salem, Image Processing for Mechatronics Engineering, Winter Semester 2017 Lecture 8 18 1
Indexed Image In indexed colour, for each pixel, we use an x-bit value which serves as an index into a colour table. The colour table contains the palette of colours used in the image. Some colours from the original image may be missing from the palette. 1
Indexed Image Salem, Image Processing for Mechatronics Engineering, Winter Semester 2017 Lecture 8 20 2
Indexed Image The result of exchanging the entire colour tables between these two images. Salem, Image Processing for Mechatronics Engineering, Winter Semester 2017 Lecture 8 21 2
Dithering When posterization is unacceptable, areas of a single colour are replaced by a pattern of dots of several different colours, optical mixing in the eye will produce the effect of a colour which is not really present For example, to replace an area of pale pink, we colour some of the pixels by red and some white. This process is called dithering. It is 2
Dithering is an extension of half-toning: used to print greyscale images on presses that can only produce dots of pure black or white. At low resolutions, it may produce poor results, so it is better suited to high-resolution work. Salem, Image Processing for Mechatronics Engineering, Winter Semester 2017 Lecture 8 23 2
Dithering Half toning is usually acceptable for printing, where resolutions exceeds 600 dpi, but not when images are being displayed on 72 dpi monitors. 2 Salem, Image Processing for Mechatronics Engineering, Winter Semester 2017 Lecture 8 24
Dithering Illustration of the effect of dithering on a colour image. The original image at the left; in the middle is a version reduced to indexed colour using an adaptive palette of 256 colours, with dithering applied. On the right, the same palette is used, but without dithering. Salem, Image Processing for Mechatronics Engineering, Winter Semester 2017 Lecture 8 25 2
Alpha Channel Alpha channel is an additional channel used to store transparency information about the pixel. A value of 0 means fully transparent (no color contribution). A value of 1 means fully opaque. A value between 0 and 1 means semi-transparent. The combination of an RGB color with an alpha channel is sometimes referred to as RGBA color space. PNG image format uses RGBA color space as one of its color options. Salem, Image Processing for Mechatronics Engineering, Winter Semester 2017 Lecture 8 26
Alpha Channel Alpha channels can be treated as additional color channels Alpha channel is treated as a mask that can isolate an object from a picture https://helpx.adobe.com/after-effects/using/alpha-channels-masks-mattes.html Salem, Image Processing for Mechatronics Engineering, Winter Semester 2017 Lecture 8 27
RGB-Color Model The primary colors can be added to produce secondary colors of Light Magenta (Red+Blue) Cyan (Green+Blue) Yellow (Red+Green) Salem, Image Processing for Mechatronics Engineering, Winter Semester 2017 Lecture 8 28
CMY Model Cyan, magenta, and yellow are the secondary colors In this model, colors are formed by subtraction. White is the absence of colors, and black is the sum of all of them. This is generally the model used for printing. Most devices that deposit color pigments on paper (such as Color Printers and Copiers) requires CMY data input or perform RGB to CMY conversion internally Salem, Image Processing for Mechatronics Engineering, Winter Semester 2017 Lecture 8 29
CMY Model Salem, Image Processing for Mechatronics Engineering, Winter Semester 2017 Lecture 8 30
CMY Model Salem, Image Processing for Mechatronics Engineering, Winter Semester 2017 Lecture 8 31
CMY Model Salem, Image Processing for Mechatronics Engineering, Winter Semester 2017 Lecture 8 32
Additive vs Subtractive Color Systems Additive Color System involves light emitted directly from a source mixes various amounts of red, green and blue light to produce other colors. Combining one of these additive primary colors with another produces the additive secondary colors cyan, magenta, yellow. Combining all three primary colors produces white. Subtractive Color System Subtractive color starts with an object that reflects light and uses colorants to subtract portions of the white light illuminating an object to produce other colors. If an object reflects all the white light back to the viewer, it appears white. If an object absorbs (subtracts) all the light illuminating it, it appears black. Salem, Image Processing for Mechatronics Engineering, Winter Semester 2017 Lecture 8 33
HSI Model Hue (dominant colour seen) Wavelength of the pure colour observed in the signal. Distinguishes red, yellow, green, etc. More the 400 hues can be seen by the human eye. Saturation (degree of dilution) Inverse of the quantity of white present in the signal. A pure colour has 100% saturation, the white and grey have 0% saturation. Distinguishes red from pink, marine blue from royal blue, etc. About 20 saturation levels are visible per hue. Intensity Distinguishes the gray levels. Salem, Image Processing for Mechatronics Engineering, Winter Semester 2017 Lecture 8 34
HSI Model Separates out intensity I from the coding Two values (Hue & Saturation) encode chromaticity Intensity encode monochrome part. Hue and saturation of colors respond closely to the way humans perceive color, and thus this model is suited for interactive manipulation of color images. Salem, Image Processing for Mechatronics Engineering, Winter Semester 2017 Lecture 8 35
HSI Model Salem, Image Processing for Mechatronics Engineering, Winter Semester 2017 Lecture 8 36
HSI Model RGB in HSI Salem, Image Processing for Mechatronics Engineering, Winter Semester 2017 Lecture 8 37
Report Illustrate the CMY color model on the 3D Cartesian Coordinates. Find graphical representation of HSI Find formula to convert from RGB to HSI and via versa. Salem, Image Processing for Mechatronics Engineering, Winter Semester 2017 Lecture 8 38
Color Processing Pseudo-color image processing Assign color to monochrome images Intensity slicing Gray level to color transformation Full-color image processing Color image enhancement and restoration Salem, Image Processing for Mechatronics Engineering, Winter Semester 2017 Lecture 8 42
Intensity Slicing c2 c1 0 Ii L Salem, Image Processing for Mechatronics Engineering, Winter Semester 2017 Lecture 8 43
Gray level to color transformation spatial domain Perform three independent transformations on the gray level of any input pixel. The three results can then serve as the red, green, and blue components of a color image Salem, Image Processing for Mechatronics Engineering, Winter Semester 2017 Lecture 8 44
Gray level to color transformation spatial domain Salem, Image Processing for Mechatronics Engineering, Winter Semester 2017 Lecture 8 45
Contacts Image Processing for Mechatronics Engineering, for senior students, Winter Semester 2017 Dr. Mohammed Abdel-Megeed M. Salem Media Engineering Technology, German University in Cairo Office: C7.311 Ext. 3580 Tel.: +2 011 1727 1050 Email: mohammed.salem@guc.edu.eg Salem, Image Processing for Mechatronics Engineering, Winter Semester 2017 Lecture 8 46