Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

67
Computer Graphics Computer Graphics & & Image Processing Image Processing Chapter # 6 Chapter # 6 Color Image Processing Color Image Processing

Transcript of Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Page 1: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Computer Graphics Computer Graphics & &

Image Processing Image Processing

Chapter # 6Chapter # 6

Color Image Processing Color Image Processing

Page 2: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

ALI JAVED Lecturer

SOFTWARE ENGINEERING DEPARTMENT

U.E.T TAXILA

Email:: [email protected]

Office Room #:: 7

Page 3: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

The use of color Image Processing 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

Color Image Processing

Page 4: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Full Color Processing vs Pseudo-Color Processing

In Full Color Processing the image in question typically are acquired with a Full-Color sensor e.g. Color TV camera or Color Scanner

In Pseudo-color Processing the problem is of assigning a color to a particular monochrome intensity or a range of intensities

Page 5: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Color Spectrum

Page 6: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Electromagnetic Spectrum

Page 7: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Physical Background

• Visible light: a narrow band of electromagnetic radiation → 380nm (blue) - 780nm (red)

• Wavelength: Each physically distinct colour corresponds to at least one wavelength in this band.

Page 8: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Color Fundamentals

The colors that humans and some animals perceive in an object are determined by the nature of light reflected from the object

Page 9: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Achromatic vs Chromatic Light

Achromatic (void of color) Light: Its only contribute is its ‘Intensity’ or amount

Chromatic Light: spans the electromagnetic spectrum from approximately 400 to 700nm

Page 10: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Quantities for description of quantity of Chromatic Source of Light

Three basic quantities are used to describe the quantity of a chromatic source of light:

Radiance

Luminance

Brightness

Page 11: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Radiance

The total amount of Energy that flows from a Light Source

It is measured in Watts

Page 12: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Luminance

Luminance gives a measure of amount of energy an observer perceives from a light source (measured in Lumens(lm) )

For example light emitted from a source operating in Infrared region of Spectrum could have significant energy (Radiance) but a human observer will hardly perceive it so luminance is zero.

Page 13: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Brightness

It is a subjective measure

It embodies the achromatic notion of intensity and is one of the key factors in describing color sensation

Page 14: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Human 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 65% of all cones are sensitive to Red Light, 33% are sensitive to Green Light and about 2% are sensitive to Blue Light (most sensitive)

Page 15: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Human Perception Due to these absorption characteristic of Human Eye

colors are seen as variable combinations of the so-called ‘Primary Colors’ Red, Green and Blue

The primary colors can be added to produce secondary colors of Light

Magenta (Red+Blue)Cyan (Green+Blue)Yellow (Red+Green)

Page 16: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Absorption of Light by red, green and blue cones in Human Eye

Mixing the three primaries or a secondary with its opposite primary colors in the right intensities produces white light

Page 17: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Primary Color of Light vs Primary Color of Pigments

Red, Green and Blue Colors are Primary Colors of Light

In Primary Color of Pigments a primary color is defined as the one that subtracts or absorbs a primary color of Light and reflects or transmits the other two

Therefore the Primary Colors of Pigments are Magenta, Cyan and Yellow and secondary colors are Red, Green and Blue

A proper combination of three pigment primaries or a secondary with its opposite primary produces Black

Color Television Reception is an example of the additive nature of Light Colors

Page 18: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.
Page 19: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Tri-Stimulus Values

The amount of Red, Green and Blue needed to form a particular color (denoted by X, Y and Z)

A color is then specified by its “Tri-chromatic Coefficients”

• Thus x+y+z=1

Page 20: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Chromaticity Diagram

Another approach for specifying colors is to use chromaticity diagram

Shows color compositions as a function of x(red) and y(green)

For any x and y the corresponding value of z(blue) can be obtained as

z=1-x-y

Page 21: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Chromaticity Diagram

Page 22: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Chromaticity Diagram

To determine the range of colors that can be obtained from the 3 given colors in the CD, we simply draw connecting lines to each of the three color points.

The result is a triangle and any color inside a triangle is produced by various combinations of the three initial colors.

The triangle shows a typical range of colors (called the color gamut) produced by RGB monitor

Page 23: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Color Models The purpose of a color model (also called Color Space or Color

System) is to facilitate the specification of colors in some 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 )

Page 24: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

RGB Model

Each color is represented in its primary color components Red, Green and Blue

This model is based on Cartesian Coordinate System

Page 25: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

RGB Model

In this model, the primary colors are red, green, and blue. It is an additive model, in which colors are produced by adding components, with white having all colors present and black being the absence of any color.

This is the model used for active displays such as television and computer screens.

The RGB model is usually represented by a unit cube with one corner located at the origin of a three-dimensional color coordinate system, the axes being labeled R, G, B, and having a range of values [0, 1]. The origin (0, 0, 0) is considered black and the diagonally opposite corner (1, 1, 1) is called white. The line joining black to white represents a gray scale and has equal components of R, G, B.

Page 26: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

RGB Color Cube

The total number of colors in a 24 Bit image is

(28)3 =16,777,216 (> 16 million)

Page 27: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Generating RGB image

Page 28: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

CMY and CMYK Color Model Cyan, magenta, and yellow are the secondary colors with respect to the

primary colors of red, green, and blue. However, in this subtractive model, they are the primary colors and red, green, and blue, are the secondaries. In this model, colors are formed by subtraction, where adding different pigments causes various colors not to be reflected and thus not to be seen. Here, 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

C

M

Y

R

G

B

=

1.00

1.00

1.00

-

Page 29: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

CMY and CMYK Color Model

CMY is a Subtractive Color Model

Equal amounts of Pigment primaries (Cyan, Magenta and Yellow) should produce Black

In practice combining these colors for printing produces a “Muddy-Black” color

So in order to produce “True-Black” a fourth color “Black” is added giving rise to CMYK model

Page 30: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

CMY Color Model

Page 31: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

CMY Color Model

Page 32: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

HSI Color 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.

IntensityDistinguishes the gray levels.

Page 33: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

HSI Color 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 .

Page 34: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.
Page 35: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Properties of HSI (HSV)

Hue H is defined by an angle

Saturation S models the purity of the color

I=(R+G+B)/3

Page 36: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Conversion from RGB to HSI Given an image in RGB color format, the H component of each

RGB pixel is obtained using the equation:

Page 37: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Conversion from HSI to RGB

Page 38: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Conversion from HSI to RGB

Page 39: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Pseudo-Color (False Color) Image Processing

Pseudo-color Image Processing consists of assigning colors to gray levels based on specific criterion

Generally, the eye cannot distinguish more than about 50 gray levels in an image. Thus subtle detail can easily be lost in looking at gray scale images. To enhance variations in gray level and make them more obvious, gray scale images are frequently pseudo-colored, where each gray scale (generally at least 256 levels for most displays) are mapped to a color level through a LUT. The eye is extremely sensitive to color and can distinguish thousands of color values in a picture.

Page 40: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Pseudo-Coloring using LUT

CLUT(Color lookup table):: A mapping of a pixel value to a color value shown on a display device.

• For example, in a grayscale image with levels 0, 1, 2, 3, and 4, pseudocoloring is a color lookup table that maps 0 to black, 1 to red, 2 to green, 3 to blue, and 4 to white.

Page 41: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

• The technique of intensity slicing or density slicing or color coding is one of the simplest example of Pseudo-color image processing

Intensity Slicing

Page 42: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

• The Gray Scale [0,L-1] is divided into L levels; where l0 represents Black (f(x,y)=0) and lL-1 represents white (f(x,y)=L-1)

• Suppose that P planes perpendicular to the intensity axis are defined at levels l1,l2…..,lp

• Then assuming that 0<P<L-1 the P planes partition the gray scale into P+1 intervals, V1,V2…….Vp+1

Intensity Slicing

Page 43: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Intensity Slicing

• Gray level to color assignments are made according to the relation:

f(x,y)= ck if f(x,y)€vk

• Where ck is the color associated with the kth intensity interval vk defined by the partition planes at l=k-1 and l=k

Page 44: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

An Alternative View of Intensity Slicing

Page 45: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.
Page 46: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.
Page 47: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Basics of Full Color Image ProcessingBasics of Full Color Image Processing

• Full color image processing fall into 2 categories.

• In 1st category we process each component image individually and then form a composite processed color image from the individually processed component.

• In 2nd category we work with color pixels directly. Because full color images have at least three components, color pixels are really vectors.

• Let c represent an arbitrary vector in RGB color space:

Page 48: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Basics of Full Color Image ProcessingBasics of Full Color Image Processing

• Color components are the function of co-ordinates(x,y) so we can write it as:

• For an image of size MxN there are MN such vectors, c(x,y), for x=0,1,2,…,M-1; y=0,1,2,…,N-1

Page 49: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Basics of Full Color Image ProcessingBasics of Full Color Image Processing

Page 50: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Color TransformationsColor Transformations

• Color transformation can be represented by the expression ::

g(x,y)=T[f(x,y)]

f(x,y): input imageg(x,y): processed (output) imageT[*]: an operator on f defined over neighborhood of (x,y).

The pixel values here are triplets or quartets (i.e group of 3 or 4 values)

Page 51: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Color TransformationsColor Transformations

• Si=Ti(r1,r2,…,rn) i=1,2,3,….n

ri and Si are variables denoting the color components of f(x,y) and g(x,y) at any point (x,y).

n is the no of color components

{T1,T2,…..,Tn} is a set of transformation or color mapping functions.

• Note that n transformations combine to produce a single transformation T

Page 52: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Color TransformationsColor Transformations

• The color space chosen determine the value of n.

• If RGB color space is selected then n=3 & r1,r2,r3 denotes the red, blue and green components of the image.

• If CMYK color space is selected then n=4 & r1,r2,r3,r4 denotes the cyan, hue, magenta and black components of the image.

• Suppose we want to modify the intensity of the given image using g(x,y)=k*f(x,y) where 0<k<1

Page 53: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Color TransformationsColor Transformations

• In HSI color space this can be done with the simple transformations3=k*r3

where s1=r1 and s2=r2Only intensity component r3 is modified.

• In RGB color space 3 components must be transformed:si=k*ri i=1,2,3.

• Using k=0.7 the intensity of an image is decreased by 30%

Page 54: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Color TransformationsColor Transformations

Page 55: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Color ComplementsColor Complements

• The hues opposite to one another on the Color Circle are called Complements.

• Color Complement transformation is equivalent to image negative in Grayscale images

Page 56: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Color ComplementsColor Complements

Page 57: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Color SlicingColor Slicing

•Highlighting a specific range of colors in an image is useful for separating objects from their surroundings.

•Display the colors of interest so that they are distinguished from background.

•One way to slice a color image is to map the color outside some range of interest to a non prominent neutral color.

Page 58: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Histogram ProcessingHistogram Processing

•Color images are composed of multiple components, however it is not suitable to process each plane independently in case of histogram equalization. This results in erroneous color.

•A more logical approach is to spread the color intensities uniformly, leaving the colors themselves( hue, saturation) unchanged.

•HSI approach is ideally suited to this type of approach.

Page 59: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Color Image SmoothingColor Image Smoothing

•Color images can be smoothed in the same way as gray scale images, the difference is that instead of scalar gray level values we must deal with component vectors of the following form:

•The average of the RGB component vector in this neighborhood is:

Page 60: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Color Image SmoothingColor Image Smoothing

•We recognize the components of this vector as the scalar images that would be obtained by independently smoothing each plane of the starting RGB image using conventional gray scale neighborhood processing.

•Thus we conclude that smoothing by neighborhood averaging can be carried out on a per color plane basis.

Page 61: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Color Image SmoothingColor Image Smoothing

Page 62: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Color Image SmoothingColor Image Smoothing

Page 63: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Color Image SharpeningColor Image Sharpening

Page 64: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Noise in Color ImagesNoise in Color Images

•Noise in color images can be removed through various noise models which we use in Image Restoration in case the noise content of a color image has the same characteristics in each color channel.

•But it is possible for color channels to be affected differently by noise so in this case noise are removed from the image by independently processing each plane

•Remove noise by applying smoothing filters (e.g gaussian, average, median) to each plane individually and then combine the result.

Page 65: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Noise in Color ImagesNoise in Color Images

Page 66: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Color Image CompressionColor Image Compression

• Compression is the process of reducing or eliminating redundant and/or irrelevant information

• A compressed image is not directly displayable it must be decompressed before input to a color monitor.

•In case if in a compressed image 1 bit of data represents 230 bits of data in the original image, then compressed image could be transmitted over internet in 1 minute as compared to original image which will take 4 hours to transmit.

Page 67: Computer Graphics & Image Processing Chapter # 6 Color Image Processing.

Any question