*stretching*a color representation.

There is an additional type of transformation we will now consider before returning to our real example. Let's consider a typical situation where a file is received that contains the "wrong" color. How the color gets to be "wrong" is not important at this point. What I mean by wrong here is that its red and not blue. Now usually the difference is much more subtle but that's irrelevant here.

On the left is the logo using the "wrong" green. There are several points to notice. First, though the logo is primarily composed of the green indicated by #14 there are other green's present as well (see #15 for example). There are also residual colors like those indicated by #18.

On the right is what we want (and actually did) transform the image on the left into. First, you'll note that #17 indicates the primary color difference. But you'll notice as well that colors similar to #14 are also transformed. While we could have only transformed the single, primary color value the result would have been unacceptable.

So how can we think about this color transform? Obviously its not exactly "stretching" because we need colors other than the primary green to be transformed as well and "stretching" the primary green around is not going to address this.

To address this we need to extend our "model" of transforms from a 1-D one (stretching a single value along a line) to a 3-D. Let's imagine for a moment that our #14 green is an RGB color.

We can imagine that our original green is the point is (x1, y1, z1) and that our new green is (x2, y2, z2). The lines from the origin through each of these points represents the shade of each color (as in moving more "toward" white in this case).

If we imagine a matching colors along the (x1, y1, z1) axis then we can imagine matching shades of the that color as well as a specific color. Alas, not all the colors we are interested in fall along the line described by (x1, y1, z1). So now what?

If we sample the colors in our image we can create a set of data points about our line (x1, y1, z1) that show us "how far" from that line the colors we wish to change are.

So here we see that (x0, y0, z0) is "too far" from our line and hence too far from our original "green" color. On the other hand (x1', y1', z1') is close enough. Now imagine a shape, for example a cone, with the tip at the same origin as the line that encloses our points of interest around (x1, y1, z1). This shape, when applied to our input, captures all the colors "around" the original green we are interested in.

The next step is transforming these colors to new colors. If we visualize another line for the replacement green (along the line defined by the origin and (x2, y2, z2)) we can see that transforming the cone from the original line to the new line is much the same as transforming the scan as I described from the 1-D transformation.

Recall our previous discussions about stretching. In the 3-D case we simply have three dimensional objects which are

*deformed*(we use this topological term instead of stretching). If we weren't changing color then the same properties we discussed for stretching would apply to the cone instead of the scan or graph.

Since we are also changing the color we need to

*translate*our cone from the line defined by (x1, y1, z1) to the line defined by (x2, y2, z2) and then apply the deforming transformations.

The use of a cone is arbitrary here though the choice of a shape is critical to the function of the overall transformation of color. In fact there is no limit on the shapes that can be used nor is it required that the source and target shapes match so long as there is a continuous function mapping from the first shape to the second and

*vice versa*.

## No comments:

## Post a Comment