Color Transformations: I R R R T S R R R F (M, N), Whereas S S S

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

Color Transformations

• It is useful to think of a color image as a vector valued image, where


each pixel has associated with it, as vector of three values.

• Each components of this vector corresponds to a different aspect of


color, depending on the color model being used. For example, in an
RGB model, the three values in the vector respectively denote the red,
green, and blue components of the color of that pixel. In an HSI
model, the three values in the vector denote the hue, saturation, and
intensity of the color of that pixel.

• We can think of color transformations as a transformation of vectors.

si = Ti (r1, r2 , r3 ), i = 1,2,3.
• Here (r1, r2 , r3 ) represent the color components of the input image
f(m,n), whereas ( s1, s2 , s3 ) represent the color components of the
output image g(m,n).

• In theory, any color transformation can be performed in any color


space model. However, in practice, some transformations are better
suited to specific models.

• Moreover, the cost of conversion between the models must be a factor


in implementation of a particular transformation.
Example: Modifying intensity
• Consider a simple transformation involving intensity scaling:

g (m, n) = kf (m, n)

where 0 < k < 1 is a scaling factor.


• In HSI space, this can be implemented as

s1 = r1 , s2 = r2 , and s3 = kr3

• In RGB space, this can be implemented as

s1 = kr1 , s2 = kr2 , and s3 = kr3

• In CMY space, this can be implemented as

s1 = kr1 + 1 − k , s2 = kr2 + 1 − k , and s3 = kr + 1 − k3

• Although the fewest operations are involved in the HSI space, the
computations involved in conversion back and forth from RGB space
more than offsets any savings in computation in HSI space.
Color Complement

• Hues opposite one another in a color circle are called complements.

• This is analogous to gray-scale negatives.

• As in the grayscale case, this transformation is useful in enhancing


details embedded in dark portions of a color image.

• Complementation can be easily implemented in the RGB space.


However, there is no simple equivalent of this in the HIS space. An
approximation is possible.
Example

• Color slicing is similar to intensity slicing --- se section 6.5.3.

• We will skip section 6.5.4 --- Tone and color correction.


Example: Color Histogram Equalization

RGB Image
RGB Image f H (m, n) g (m, n)
f (m, n) RGB-to-HSV HSV-to-RGB
(rgb2hsv); f S (m, n) (hsv2rgb);

Histogram Eq.
(histeq);
f V (m, n)

Original
Image

Histogram
Equalized
Example: Histogram equalization
Smoothing of Color Images

• Just like the case of grayscale images, smoothing of color images can
be performed to remove abrupt transitions of gray values.

• This can be done either in the RGB domain or the HSI domain.

• In the RGB domain, all the three color components are individually
transformed by an appropriate smoothing mask, say a 3× 3 mask:
 


1 1 1
1

1 1 1
9

 

1 1 1

• In the HSI domain, only the I component is transformed by means of


a spatial smoothing mask, leaving the H and S components
unchanged.

• In general, the final result in the two cases would be different.


Because the average of two colors is a color intermediate between the
two, the former approach has the potential of introducing colors not
present in the original image. The latter approach does not have this
problem, since the Hue and Saturation components are preserved.
Example
Color Image Sharpening

• Sharpening of color images can be performed in a manner analogous


to smoothing, using appropriate masks, say the Laplacian mask
   


0 1 0 
1 1 1



1 − 4 1 or 1 − 8 1


   

0 1 0 1 1 1

Example
Noise in color images

• The previously discussed noise models are applicable to color images


as well.

• Typically, noise affects all the three color components.

• Usually, across the three color channels, the noise is independent and
its statistical characteristic are identical.

• However, due to different illumination conditions or selective


malfunction of camera hardware in a particular channel, this may not
be the case.

• Noise filtering by means of a simple averaging can be accomplished


by performing the operation independently on the R, G, and B
channels and combining the results.

• However, more complicated filters like the median filter are not as
straight-forward to formulate in the color domain and will not be
pursued here.

• We will also skip the short discussion in text about color image
segmentation and compression (Section 6.7 and 6.9).

You might also like