Tuesday, May 20, 2008

Colour Image Processing

(6)b) Figure 6.5 with Red and Blue color channels exchanged:

In Gimp, Colors - Components - Channel Mixer; Red Output Channel: 0 0 100; Blue Output Channel: 100 0 0. My transformed image appears to have a white centre, using this function, rather than Filters - Decompose/Compose?

(1)




x values are Red, y values are Green, z values are Blue; x, y, z E [0, 1]. The first plot shows wavelength against R/G. The second plot shows wavelength against G. The third plot shows wavelength against B/G. Each (x, y) in a Chromaticity diagram represents the combination of visible wavelengths of light. The shark fin represents colours that can be viewed by humans with normal vision. The diagram takes the shark fin shape because the primary colours (RGB) are visible at different wavelengths. The peak of the second graph illustrates that Green is visible at a wavelength of 520nm...the top bound of the shark fin. The combinations of visible wavelengths of light are contained within bounds illustrated in the first and third graphs, which show the ratio of R/G and B/G, and form a shark fin when plotted along with wavelength vs. G.


(2) Note: vector quantity in BOLD/ITALIC
c1 = (x1, y1)
c2 = (x2, y2)

c1c2 = (x2 - x1, y2 - y1)

MAGc1c2 = SQRT[(x2 - x1)^2 + (y2 - y1)^2]; this is the magnitude (length of the vector)

colour = c = (cx, cy)

%c1 = MAGc1c/MAGc1c2
%c2 = MAGcc2/MAGc1c2

Using Matricies:
Since (cx, cy) = a(x1, y1) + b(x2, y2), and a + b = 1, solve for a & b in terms of the other variables c1=(x1, y1), c2=(x2, y2), c=(cx, cy).
  • a + b = 1
  • cx = ax1 + bx2
  • cy = ay1 + by2

(3) Picture a triangle with verticies c1, c2, c3, and a colour c(cx, cy) that lies within the triangle.

- draw a line from c1 through c; label the point p1(cx1, cy1) where it intersects vector c2c3

- draw a line from c2 through c; label the point p2(cx2, cy2) where it intersects vector c1c3

- draw a line from c3 through c; label the point p3(cx3, cy3) where it intersects vector c1c2


%c1 = avg[MAGc1p2/MAGc1c3 + MAGc1p3/MAGc1c2]
%c2 = avg[MAGc2p3/MAGc2c1 + MAGc2p1/MAGc2c3]
%c3 = avg[MAGc3p2/MAGc3c1 + MAGc3p1/MAGc3c2]

Using Matricies:
Since (cx, cy) = a(x1, y1) + b(x2, y2) + d(x3, y3), and a + b + d = 1, solve for a, b & d in terms of the other variables c1 = (x1, y1), c2 = (x2, y2), c3 = (x3, y3), c = (cx, cy).

  • a + b + d = 1
  • cx = ax1 + bx2 + dx3
  • cy = ay1 + by2 + dx3

(4) a) The RGB, and corresponding CMY, components of Fig. 6.6 (in order left to right) are:

BLACK: RGB = (0 0 0), CMY = (1 1 1)
RED: RGB = ( 1 0 0), CMY = (0 1 1)
YELLOW: RGB = (1 1 0), CMY = (0 0 1)
GREEN: RGB = (0 1 0), CMY = (1 0 1)
BLUE: RGB = (0 0 1), CMY = (1 1 0)
B/G: RGB = (.5 0 1), CMY = (.5 0 0)
Pink/R: RGB = (1 0 .5), CMY = (0 1 .5)
White: RGB = (1 1 1), CMY = (0 0 0)
with a grey border around all 8 colours.

b) The resulting image if the above CMY components were fed through a RGB colour monitor can be described as follows:

White, Cyan, Blue, Magenta, Yellow, Light red, Green-Blue, Black, with a Grey border.


(5) In MatLab to invert colour move control point (0, 0) to (0, 1) and control point (1, 1) to (1, 0). z = interplq([0 255]', [0 255]', [0:255]'); that is, z = [0 1 2 ...255]' is a one-to-one mapping connecting control points (o, o) and (255, 255). The invert transformation, in MatLab, is z = interplq([o 255]', [255 0]', [0:255]'). The is the transformation of a full colour image to its colour complement; and all the combinations in between.

1. Red->Cyan: (255 0 0) -> (0 255 255)
2. Green->Magenta: (0 255 0) -> (255 0 255)
3. Blue->Yellow: (0 0 255) -> (255 255 0)

The effect that this transformation has on the HSI coordinates is described by calculating (theta, S, I) for each primary colour and its colour complement:

Red: (0, 1, 1/3); Cyan: (180, 1, 2/3)
Green: (180, 1, 1/3); Magenta: (360, 1, 2/3)
Blue: (180, 1, 1/3); Yellow: (0, 1, 2/3).
The transformed colors (the color complements) have theta values = theta(RGB) + 180 degrees. Saturation values do not change because min(R, G, B) = 0 for CMY components also, and S = 1 - 0; perhaps S will vary for R, G, B greater than 0, less than 1. Intensity values for the transformed colors are given by I = 1 - I(RGB).

(6)a) Red -> Blue; theta from 0 -> 180, no change in SI
Blue -> Red; theta from 180 -> 0, no change in SI
Cyan -> Yellow; theta from 180 -> 0, no change in SI
Yellow -> Cyan; theta from 0 -> 180, no change in SI
These new theta values correspond to a "flip" of the color about the diameter (line joining Green-Magenta) of the color wheel (aka HSI circular color plane).

Also, no change in HSI coordinates for Green and Magenta.

b) Figure 6.5, with Red and Blue colour channels exchanged, is at the top of this blog, as I could not adjust the image properties to have it show down here.

No comments: