Monday, October 22, 2007

Exploring Space

Abstract: The point of this post is looking at user interfaces as a means of exploring n-dimensional spaces.

One of the most popular means of converting a color photo to a black and white photo is via an adjustment filter known as Channel Mixer. The user interface (Photoshop below) allows one to specify weights for each of the color channels to produce grey values that are linear combinations of red, green and blue.

I've found this approach problematic for a long time for a few reasons.

First, there are four controls but essentially three degrees of freedom; i.e., if grey = weight_constant * (weight_red * red + weight_green * green + weight_blue * blue), it's clear the same effect could be achieved by widening range of the weights associated with each color and dropping the weight_constant term.

Generally, it seems, the weights associated with the color channels are first adjusted and then the overall brightness is corrected once a suitable combination of colors has been selected.

When you present a user with a set of controls such as the sliders in Channel Mixer, in many respects, you're offering an opportunity to explore space. The space can be any number of dimensions depending on how many controls exist. With three sliders for red, green and blue, it's a three-dimensional space.

In the case of Channel Mixer, the addition of a constant percentage doesn't really add another dimension to the space--it simply expands the size of the search space, because it amounts to moving along a vector in 3-space defined by the red, green and blue weights.

When we frame the problem as one involving space exploration in 3-space, interesting questions come to mind. For example, consider the dimensionality of our input devices. For searching, the mouse is a useful input device, but it's 2D at best; and sliders are essentially 1D controls, because they involve movement along a line (hence, you need three sliders to navigate a 3D space).

What is the best possible way to map the 3D search space to inputs from the user?

Hmmm...

One question we can ask is whether or not there's a region in the search space that's of greatest interest to the user. If you'd like to learn more about such questions and how to deal with them, you may want to investigate Principal Component Analysis, which is one approach to reducing the dimensionality of a space while retaining as much salient information as possible. Using such a technique, we might be able to effectively reduce the dimensionality of the search space by throwing away dimensions that aren't interesting to the user.

If we want to give our user the freedom to explore the entire space, we have a couple of options. We can provide three 1-D controls (e.g., Channel Mixer sliders) for space exploration. The problem with this approach is it's really tedious to explore space this way. It's like trying to work on of those skill cranes at an arcade.

Alternatively, we might map our search space into the combination of a 1-D input and a 2-D input--for example, a slider and, say, a rectangle with a little draggable dot. Unfortunately, we can't accept 3D input from our user without providing a 3D device such as a Wiimote or something similar.

Given the prospect of searching a 3D space with a set of controls, another important question ponders the best way to slice it. For example, if we search the Channel Mixer space using a combination of a 2D input and a 1D input, we might use the 2D control to navigate weighting possibilities for red and green and use the 1D control to determine the weighting for blue, but we should ask if this the most useful mapping for the user?

Alternatively, we can slice the 3D search space with a plane from any conceivable direction and then use a 2D control to navigate the plane and a 1D control to move along the surfance normal directions perpendicular to the plane.

In some respects, black and white conversion using Channel Mixer is similar to making lemonade. How can that be? Consider the problem of trying to make the perfect lemonade. It's a liquid created from three ingredients: water, sugar and lemon juice.

Let's say we're going to use from 0 to 2 cups of each ingredient, so we're searching in a 3D space for perfect lemonade, and the space is bounded by 0 to 2 cups in each dimension. If you think about it a bit, you'll realize perfect lemonade won't be a point in this space, it'll be a line.

Huh?

Just for the sake of making thing simple, let's say we find the best lemonade at the point where we have 2 cups of each ingredient. How will this lemonade differ in taste from a lemonade made with one cup of each ingredient?

Answer: It won't.

The 2 cups case is nothing more than a double batch of the 1 cup case. Everything falling along the line going from (0,0,0) to (2,2,2) will be perfect lemonade, and the only thing the distance from the origin determines is how much lemonade you've made.

If you're looking for the perfect lemonade, all of the interesting questions fall in a two dimensional subspace, because what matters are the relative proportions of each component: what % water, what % lemon juice, what % sugar?

On first glance three percentages might not sound like a plane, but there's an important constraint requiring everything to add up to 100%; i.e., if you have 30% water and 30% lemon juice, you have no choice but to have 40% sugar (100% - 30% - 30% = 40%), so even though you have three percentages, you only have two degrees of freedom.

Reconsidering our original lemonade space which merely consisted of three dimensions of varying quantities, we can see that a more useful interpretation of the space is one in which factor the space into a 2D subspace of all possible lemonade recipes and a 1D subspace of lemonade quantity.

The lemonade example demonstrates the sort of considerations one might make in mapping a 3D search space to a set of controls. In the case of Channel Mixer, we can ask ourselves if weights for red, green and blue constitute the best possible factoring of the space defining the color conversion.

What if, like the lemonade recipe, we mapped all possible recipes of red, green and blue to a 2D control and then controlled the overall brightness with a 1D control? This would reduce the problem from four controls down to two*. Such perspectives and questions led to the latest B&W conversion filter in PSP.

Hopefully, some of the thoughts here will inspire new insights, questions and perpectives in others.

fin

*Note: Channel Mixer does have other functions and it allows negative percentages, but these features generally aren't very useful for B&W conversion.