Presentation is loading. Please wait.

Presentation is loading. Please wait.

Digital Image Processing

Similar presentations


Presentation on theme: "Digital Image Processing"— Presentation transcript:

1 Digital Image Processing
Chapter 6: Color Image Processing Prof: Dr. Mongi Abidi

2 Table of content Color Fundamentals Color Models
The RGB Color Model The CMY and CMYK Color Models The HSI Color Model Pseudocolor Image Processing Intensity Slicing Gray Level to Color Transformations Basics of Full-Color Image Processing Color Transformation Formulation Color Complements Color Slicing Tone and Color Corrections Histogram Processing Smoothing and Sharpening Color Image Smoothing Color Image Sharpening Color Segmentation Segmentation in HSI Color Space Segmentation in RGB Vector Space Color Edge Detection Noise in Color Images Color Image Compression

3 Color Fundamentals In 1666, Sir Isaac Newton discovered that when a beam of sunlight passes through a glass prism, the emerging beam of light is a continuous spectrum of colors ranging from violet at one end to red at the other Chromatic Light Chromatic light spans the electromagnetic spectrum from 400 to 700 nm. Human Eye 6 to 7 million cones in the human eye can be divided into three principle sensing 65% sensitive to Red 33% sensitive to Green 2% sensitive to Blue Color spectrum seen by passing white light through a prism The visible light is composed of a relatively narrow band of frequency in the electromagnetic spectrum Absorption to light by the red, green, and blue cones in the human eye as a function of wavelength Wavelengths comprising the visible range of electromagnetic spectrum Achromatic Light Achromatic (void of colors) light attribute is its Intensity, ie seen on a black and white TV.

4 Color Fundamentals Primarily Colors Characteristics
According to the Commission International de l’Eclairage, Red 700 nm Green nm Blue nm No Single color maybe called Red, Green or Blue Generally Used to distinguish one color from another Brightness: Embodies the chromatic notion of intensity. Hue: An Attribute associate with the dominate wavelength in a mixture of light waves Saturation: Relative purity or the amount of white light mixed with the Hue. Secondary Colors Tristimulus Primarily colors can be added to produce secondary colors Magenta (Red plus Blue) Cyan (Green plus Blue) Yellow (Red plus Green) The amount of red, green, and blue needed to form any particular color and are donated, X, Y, and Z, respectively. The color is defined by its trichromatic coefficients: Primarily and secondary colors of light and pigments

5 Color Fundamentals The graph below shows a color composite as a function x (red) and y (green). For any value of x and y, the corresponding value of z (blue) is obtained by z = 1-(x + y) Color Gamut The triangle in the graph below shows a typical range of colors produced by RGB monitors. The irregular region inside the triangle is representative of the color gamut of today’s high quality color printing devices. The boundary is irregular because it is a combination of additive and subtractive color mixing. Chromaticity diagram. Typical color gamut of color monitors (triangle) and color printing devices (irregular region) The chromaticity diagram is useful for color mixing because a straight line segment joining any two points in the diagram defines all the different color variations that can be obtained by combining these two color additively.

6 Color Models The purpose of color model (also called color spaces or color system) is to facilitate the specification of colors in some standard, generally accepted way. Pixel Depth The number of bits used to represent each pixel in RGB space. Full Color For an 8-bit image, an RGB color pixel is said to have 24-bits. (28)3 = 16,777,216 The RGB Color Model Each color appears in its primary spectral components of red, green , and blue. The model is based on a Cartesian coordinate system. RGB 24-bit color cube Schematic of the RGB color cube. Points along the main diagonal have gray values, from black at the origin to white at point (1,1,1) The three hidden surface planes in the color cube The different colors in the model are points on or inside the cube, and are defined by vectors extending from the origin. Images represented in the RGB color model consist of three component images, one of each primary color.

7 Color Model Example: Color Monitor Displaying an RGB Image
The purest red is (255,0,0) The purest green is (0,255,0) The purest blue is (0,0,255) 0xFF / 0x33 = 5 => + zero position = 6 (6)3 = 216 colors Taking a cross sectional plane through the center of the cube and parallel to the GB plane. The plane is (127,G,B) where G,B = 0,1,2,…,255. The image is viewed by simply feeding the three individual component images into a color monitor. The 216 safe RGB colors Generating the RGB image of the cross-sectional color plane (127,R,G) All the grays in the 256-color RGB system (grays that are part of the safe color group are shown underlined Safe Colors Many systems are limited to 256 colors. Numerous application does not need more that 256 colors By varying each of R, G, and B from 0 to 0xFF in 0x33 increment, we come up with 216 colors The RGB safe-color cube Valid values of each RGB component in a safe color

8 Color Model The CMY and CMYK Color Models Intensity
Cyan, Magenta, and Yellow are the secondary colors of light or, alternatively, the primary of pigments. Printing devices and copiers require CMY as input. CMY can be calculated as follow Taking the colored cube and stand it on black (0,0,0) vertex, and the white vertex (1,1,1) is directly above it. This will form the gray level (the line from white directly to black) or intensity axis. We can measure the intensity of any color by dropping a perpendicular line from it to the intensity axis. Equal amount of Cyan, Magenta, and Yellow, produces muddy black. Therefore, a fourth color black was introduced to CMY to become CMYK Conceptual relation between the RGB and HSI color models HSI Color Model It stands for Hue, Saturation, and Intensity. It decouples the intensity components from the color carrying information (hue and saturation) in a color image. HSI is an ideal tool for developing images processing algorithms based on color description that are natural and intuitive to human Hue A hue can be determined from a given RGB. Above graph shows a plane with three point (black, white, and cyan) contains the intensity axis.

9 Color Model Hue continued
All points contained in the plane segment defined by the intensity axis and the boundary of the cube By rotating the shaded plane about the vertical intensity axis, we would obtain different hues Hue and Saturation in the HSI color model. The dot is an arbitrary color point. The angle from the red axis gives the hue, and the length of the vector is the saturation Example: HSI Model of a Color Triangle and Circle The primarily colors falls 120o from each other, and secondary colors are 60o from the primarily colors Determining the Hue and Saturation The HSI model based on a triangular and circle color plane. The triangles and the circles are perpendicular to the intensity axis The following examples show an arbitrary point (shown as a dot). The hue of a point is determined by calculating the angle from some reference point (usually (but not always) an angle of 0o from the red axis designate 0 hue. The saturation is the length of the vector from the origin to the point

10 Color Model Converting Colors from RGB to HSI BR sector Green as G
Blue as B Red as R Hue as H The angle Saturation as S Intensity as I The example below shows the hue, saturation, and intensity for the 24bit color cube. At a point on the color cube, going around the cube increases the hue from 0o to 360o. The saturation turns dark as the color approaches white. The Intensity image shown is the average of the RGB values at the corresponding pixel. Converting Colors from HSI to RGB RG sector Blue as B Red as R Green as G HSI components of the 24bit color cube GB sector Red as R Green as G Blue as B Hue Saturation Intensity

11 Color Model Figure (a) below was obtained by changing to 0 the pixels corresponding to the blue and green region in the hue image. In figure (b), the saturation was reduced the saturation of the cyan region. In figure (c), the intensity was reduced by half of the central white region. Image (d) is the result of converting the finale HSI image back to RGB Manipulating HSI Component Images The following example shows an image of the primarily and secondary RGB. Also, it shows images of the hue, intensity, and the saturation of the primarily and secondary RGB. Note the black in the red region in the hue image Note the black in the white region in the saturation image Figure a Figure b Image with primarily and secondary RGB Hue Figure c Figure d Intensity Saturation

12 Pseudocolor Image Processing
The technique can be summarized as follow: Let [0,L-1] represent a gray scale Let l0 represent black [f(x,y) = 0] Let lL-1 represent white [f(x,y) = L-1] Suppose P planes perpendicular to the intensity axis are defined at levels l1,l2,…,lp Assuming that 0 < P < L-1, the P planes partition the gray scale into P + 1 intervals, V1, V2, …, Vp+1 Gray level to color assignments are made according to the relation Pseudocolor Also called false color Assigning colors to gray values based on specific criterion. The principle use of pseudocolor is for human visualization and interpretation of gray scale events in an image Intensity (Density) Slicing If an image is interpreted as a 3-D function, the method can be viewed as one of placing planes parallel to the coordinate plane of the image Each plane then slices the function in the area of intersection. if Where ck is the color associated with the kth intensity interval Vk defined by the partitioning planes at l=k-1 and l=k Geometric interpretation of intensity slicing technique using plane at f(x,y) = li An alternative representation of the intensity slicing technique

13 Pseudocolor Image Processing
Cracks and porosities Examples of intensity slicing In the following example, the gray scale was divided into intervals and a different color was assigned to each region, without any regard for the meaning of the gray levels in the image Result of color coding Monochrome X-ray image The next example is converting a gray image of the rainfall level using a known color slicing Gray scale image in which intensity correspond to average monthly rainfall Colors assigned to intensity values Monochrome image of the Picker Thyroid Phantom Result of density slicing into eight colors Zoom of the South American region Intensity slicing assumes a meaningful and useful role when subdivision of the gray scale is based on physical characteristics of the image The following example shows an X-ray image of a weld containing several crakes and porosities It is known when there is a porosity in a weld, the full strength of the X-ray going through the object saturate the sensor Color coded image

14 Pseudocolor Image Processing
This luggage contains ordinary items This luggage contains the same articles, as well as a block of simulated plastic explosive. Gray Level to Color Transformation The ideas is perform three independent transformations on the gray level of any input pixel. The three results are then fed separately into red, green, and blue channels of a color television monitor. This method produces a composite image whose color content is modulated by the nature of the transformation function Explosive Transformation function Functional block diagram for pseudocolor image processing. fr, fg, and fb are fed into the corresponding red, green, and blue input of an RGB color monitor. Example: Highlighting Explosive in a luggage The purpose of the example is to illustrate the use of gray level transformation to obtain various degrees of enhancement

15 Pseudocolor Image Processing
Satalite images of Washington, DC, including part of the Potomac river Example Multispectral image processing Image in Visible red Image in Visible green Producing different sensors produces individual monochrome images, each in a different spectral band. By combining the images with additional processing to generate an image based on the knowledge about the response characteristic if the sensor Image in visible blue Image in near infrared A psuedocolor coding approach used when several monochrome images are available psuedocolor rendition of Jupiter Moon Io A Close-up Combining the red, green, and blue images Combining the near infrared, green, and blue images

16 Basics of Full Color Image processing
Full-Color images processing approaches falls into two major categories: We process each component image individually and then from a composite processed color image from the individually processed components. We work with color pixels directly, because color pixels are vectors. Let c represent an arbitrary vector in RGB color Space In order fir per-color-component and vector based processing to be equivalent, two conditions have to be satisfied: The process has to be applicable to both vectors and scalars. The operation on each component of a vector must be independent of the other components This equation indicate that the components of c are simply the RGB components of a color image. C a function of coordinate (x,y) Spatial masks for gray-scale and RGB images For an Iimage of size M X N, there are MN such vectors, c(x,y), for x =0,1,2,…,M-1;y=0,1,2,000,N-1

17 Color Transformation Example: Color Image and its Various Components
Color Transformations deal with processing the components of color image within the context of a single color model The image below shows a high resolution color image of a bowl of strawberries and a cup of coffee that was digitized from a large format (4” X 5”) color negative. Follows component of the initial CMYK scan. Black represent 0 and white represent 1 Formulation As with the gray-level transformation, we model color transformations using the expression g(x,y) = T[f(x,y)] Where f(x,y) is the color image, g(x,y) is the transformed or processed color output image, and T is an operator on f over a spatial neighborhood of (x,y) The pixel value are triplets or quartets from the color space chosen to represent the images. We will restrict our attention to color transformations of the form Si = Ti(r1,r2,…,n) i=1,2,…,n Si and ri are variables denoting the color components of f(x,y) and g(x,y) at any point (x,y). n is the number of color components {T1,T2,…,Tn) is a set of transformation or color mapping functions that operate on ri to produce Si Cyan Full color image Magenta Note the strawberries are composed of a large amount of magenta and yellow because the image corresponding to these two CMYK components are the brightest. Yellow

18 Color Transformation Example: Color Image and its Various Components
Computing the HSI component, the strawberries are relatively pure in color; they poses the highest saturation or least least dilution by white light of any of the hues in the image. Black is used sparingly and is generally confined to the coffee and shadows within the bowl of strawberries. Black Converting the CMYK to RGB component image. The strawberries contains a large amount of red and very little green and blue. The stem of the strawberries shows some green. Hue Saturation Intensity We note some difficulties in interpreting the hue component There is a discontinuity in the HSI model where 0o and 360o HUE is undefined for a saturation of 0. The discontinuity of the model is most apparent around the strawberries, which are depict in gray level values near the both black (0) and white (1). The result is an unexpected mixture of highly contrasting gray level to represent a single color – red. Red Green Green

19 Color Transformation Example: Modify intensity of the same image
It s important to note that each transformation depends only on one component within its color space. Using g(x,y) = kf(x,y) Where 0<k<1. In the HSI color space s3 = kr3 Where s1 = r1 and s2 = r2 Only HSI intensity component r3 is modified, in the RGB space, three components must be modified si = kri The CMYK space requires a similar set of linear transformation si = kri + (1-k) i = 1,2,3. Using k = 0.7 The required RGB transformation function The required CMY transformation function The required HSI transformation function Original picture Result of decreasing its intensity by 30% (k=0.7)

20 Color Transformation Color Complement
Complement transformation functions Original Image The hues directly opposite one another on the color circle are called complements. Color complements are useful for enhancing detail that is embedded in dark region of a color image. Complement on the color circle Example of Color Complements Color complement using the complement color circle Color complement using approximation of the SHI transformation The following example takes a color image and finds its color complement using Color circle complement HSI Transformation

21 Color Transformation Color Slicing
If a sphere is used to specify the colors of interest, then Highlighting a specific range of colors in an image is useful for separating objects from their surroundings. The basic idea is either to Display the colors of interest so that they stand out from the background Use the region defined by the colors as a mask for further processing One of the simplest way to slice a color image is to map the colors outside some range of interest to a nonpermanent natural color If the colors of interest are enclosed by a cube (or hypercube for n>3) of width and centered at an average color with components (a1,a2,…,an), the necessary set of transformation: i=1,2,…,n Here, R0 is the radius of the enclosing sphere (or hypersphere for n>3) Color slicing transformation that detects red within an RGB cube of width W = centered at (06863,0.1608, ) Pixel outside the sphere and cube were replaced by (0.5,0.5,0.5) i=1,2,…,n Color slicing transformation that detects red within an RGB sphere of radius centered at the same point. These transformations highlight the colors around the prototype by forcing all other colors to the midpoint of the reference color space

22 Color Transformation Tone and Color Correction
The principle benefit of calibrated imaging system is that they allow tonal and color imbalances to be corrected interactively and independently. The tonal range of an image, also called key type, refers to its general distribution of color intensities. (high key at high intensities, low key at lo intensities, and middle key lies in between) Color transformation can be performed on most desktop computers. In conjunction to digital cameras, flatbed scanners, and inkjet printers, they turn a PC into a digital darkroom. The success of this approach is a function of the quality of the color profile used to map devices to the model and the model itself. The model of choice for many color management systems (CMS) is the CIE L*a*b* model, also called CIELAB. The L*a*b* color components are given by the following equations: Example: Tonal Transformation The idea is to adjust experimentally the image’s brightness and contrast to provide maximum detail over a suitable range of intensities. This means mapping all three (or four) components with the same same transformation function. In the HSI color space, only the intensity component is modified. Where XW, YW, and ZW are reference white tristimulus values- a typically the white of a perfectly reflecting diffuser under CIE standard D65 illumination. Corrected image and its transformation function Flat image

23 Color Transformation Example: Tonal Transformation
Original corrected image Example: Tonal Transformation Light image Corrected image and its transformation function Dark image Example: Color Balancing The following example is color balancing for the CMYK color images

24 Color Transformation Histogram Processing
Original image Image HSI components Histogram equalization automatically determines a transformation that seeks to produce an image with a uniform histogram of intensity values. Since color images are composed of multiple components, however, consideration must be given to adapting the gray scale technique to more than one component and/or histogram. It is generally unwise to histogram equalize the components of a color image independently. A more logical approach is to spread the color intensities uniformly, leaving the hues (colors) unchanged. Example: Histogram Equalization in the HSI Color Space The following example shows a color image of a caster stand containing cruets and shakers whose intensity component spans the entire (normalized) ranged of possible values [0,1]. The image intensity before processing contains a large number of dark colors that reduces the median intensity to 0.36. Histogram equalize the intensity component without altering the hue and saturation. The image is significantly brighter and several grain of the wooden table are now visible Correcting by partially increasing the image’s saturation. Note the color of oil and vinegar before and after the saturation change.

25 Smoothing and sharpening
The following example shows a color image with its RGB component and its HSI component. Applying a 5 X 5 smoothing filters to the RGB component independently In the HSI components, we only smooth the intensity component leaving the hue and saturation components unchanged. Color Image Smoothing With reference to gray scale spatial mask, smoothing can be viewed as a spatial filter operating in which the coefficients of the filtering mask are all 1’s. As the mask is slid across the image to be smoothed, each pixel is replaced by the average of the pixels in the neighborhood defined by the mask. In color images, we must deal with component vectors. Let Sxy denote the set of coordinates defining a neighborhood centered at (x,y) in an RGB color image. The average of the RGB component vectors in this neighborhood is RGB image Red components Blue components Green components Hue Saturation Intensity Difference between both corrections Example: Color Image Smoothing by neighborhood averaging RGB corrected HSI corrected

26 Smoothing and sharpening
Color Image Sharpening We consider sharpening an image using Laplacian. Laplacian of a vector is defined as a vector whose components are equal to the Laplacian of the individual scalar components of the input vector. In an RGB color system, the Laplacian of vector c is RGB image Red components Blue components Green components Example: Sharpening with the Laplacian The following example takes an RGB color image and apply the Laplacian to its RGB components. It shows a sharpened image based on its HSI components by combining the Laplacian of the intensity component with the unchanged hue and saturation components Hue Saturation Intensity Difference between both corrections RGB sharpened HSI sharpened

27 Color Segmentation Segmentation of the reddish color Segmentation is a process that partition an image into regions. Original image of Jupiter moon Io hue Segmentation in HSI Color Space Typically, Saturation is used as a masking image I order to isolate further region of interest in the hue image. The intensity image is used less frequently for segmentation of color images because it carries no color information Saturation Intensity Example: Segmentation in HSI Space Binary saturation mask (black=0) Product of the mask and hue. Given the following image, suppose that it is of interest to segment the reddish region in the lower left of the image. The image was generated by pseudocolor method; however, this image can be processed (segmented) as a full-color image without the loss of generality Showing the image HSI components. Showing a binary mask generated by thresholding the saturation image with 10% threshold of the maximum value in the saturation image. Histograming the product image Segmentation of the red component in the original image

28 Color Segmentation Segmentation in RGB Vector Space
Three approaches for enclosing data regions for RGB vector segmentation Segmentation in RGB Vector Space Although working the HSII space is more intuitive, segmentation is one area in which better results generally are obtained by using RGB color vectors. Suppose that the object is to segment objects of a specified color range in an RGB image. Given a set of sample color points representative of the color of interest, we obtain an estimate of the “average” color that we wish to segment. Let the average denoted by RGB vector a. Let z denote an arbitrary point in RGB space. We say z is similar to a if the distance between them is less than the threshold Do The Euclidean distance between a and z is given by Points contained within or on the surface of the sphere satisfy the specified color criterion: points outside do not. Coding these two sets of points in the image with black and white produces a binary segmented image. The equation become: Where C is the covariance matrix of the samples of the color we wish to segmented. The locus of D(z,a)<=Do is a solid 3-D elliptical body,(shown above). When C=I, 3 X 3 identity matrix, the equation above reduces to its original form (shown on left) An other approach is to center a box on a, and its dimension along each of the color axes is chosen proportional to the standard deviation of the samples along each of the axes (shown above) Where the subscript R,G, and B, denote the RGB components of vectors a and z. The locus of D(z,a)<=Do is a solid sphere radius of Do As illustrated in the following figure

29 Color Segmentation Example: Color Image Segmentation in RGB Space
Color Edge Detection The following color image contains a rectangle (lower left) to sample the reddish color out of the image. The approach was to compute the mean vector a using the color points contained within the rectangle. Then compute the standard deviation of the red, green, and blue values of those samples. A box was centered at a, and its demission were selected as 1.25 times the standard deviation. Consider the two M X M color images (M odd) in figure (d) and (h),composed of three components images (a), (b), and (c) for image (d), and (e), (f), and (g) for image (h). If we compute the gradient image of the two corresponding RGB gradient images, the value of the gradient at point [(M+1)/2,(M+1)/2] would be the same in both cases. We expect the gradient to be stronger for image (d) because the edges are in the same direction as opposed to (h) We see that processing the three individual planes to form a composite gradient image can yield erroneous results a b c d Original image of Jupiter moon Io, with the color of interest shown enclosed by a rectangle Result of segmentation in RGB vector space e f g h

30 Color Segmentation Di Zenzo Method
Example: Edge Detection in Vector Space Let r, g, and b be units vectors along the R,G, and B axis of the RGB color space, and define the vectors Given the following color image. We obtain a gradient image from the Di Zenzo method. We also obtain an image by computing the gradient of each RGB component image and forming a composite gradient image by adding the corresponding values of the three component images at each (x,y) coordinates. Let the quantities of gxx, gyy, and gxy be defined in terms of the dot product of these vectors, as follow: RGB image Gradient computed in RGB color vector Gradient computed on pre-image basis and then added Difference between both gradient It can be shown that the direction of maximum rate of change of c(x,y) is given by an angle And the value of the rate of change at (x,y), in the direction of theta, is given by Red component Green component Blue component

31 Noise in Color Images Red component Green component Usually, the noise content if a color image has the same characteristics in each color channel, but it is possible for each color channel to be affected differently by noise. However, different noise level are more likely to be caused by difference in the relative strength illumination available to each of the color channels. Blue component RGB image Example: Illumination of the Effects of Converting Noisy RGB Images to HSI. In this example, we look at noise in color images and how noise carries over when converting from one color model to another. The following shows a three color component of an RGB image corrupted by Gaussian noise Note the fine grain such as this tends to be less visually noticeable in a color image than it is in a monochrome image. Then, the result of converting the RGB image to HSI. hue Saturation Intensity The following is an RGB image whose green image is corrupted by salt and pepper noise. The HSI component images show clearly how the noise spread from the green RGB channel to all the HSI images. RGB image hue Saturation Intensity

32 Color Image Compression
Original RGB image Since the number of bits required to represent color is typically three to four times greater than the number employed in the representation of gray levels. Data compression plays a central role in the storage and transmission of color images. With respect to the RGB, CMY(K), and HSI images, the data that are the object of any compression are the component of each color pixel. Compression is the process of reducing or eliminating redundant and/or irrelevant data. Example: A color Image Compression The following 24-bit color image is an original color image. Follows by an image that was compressed, and then decompressed . The compressed image (not shown) contains only 1 data bit (and thus 1 storage bit) for every 230 bits of data in the original image. JPEG 2000 compression algorithm used to generate the decompressed image. Result of compression and decompression original image

33 Summary This material is an introduction to color image processing
Techniques of manipulating color images. Color vector spaces is a departure from gray scale methods. Highlighting important difference between gray scale and color images. Color vector processing includes processes such as median and other order filters, adaptive and morphological filters, image restoration, image compression, and many others. Treatment of noise in color images also points out that the vector nature of the problem, along with the fact color images are routinely transformed from one color space to the other.


Download ppt "Digital Image Processing"

Similar presentations


Ads by Google