Archive for September, 2010

Color Uniformization

Rarely does a photo reflect the amazing diversity of colors present in the RGB color space. For instance this one has an abundance of green and blue:
Where is the yellow? the red? the pink? Here it is:
In the second picture, I’ve altered the color of each pixel so that the colors are uniformly distributed in the RGB space. I wrote the program in the Perl programming language because I was curious how the adjusted pictures would look.

Every color that can be displayed by your screen is in the image, and that the amount of the colors are all proportional. This applies on all scales. For example with general terms like “red” and “blue”, there is the same amount of red as blue, if red and blue get the same volume in the color cube. On a smaller scale, consider fushcia and radioactive green: These two colors appear in equal quantities, (provide those two colors actually are equally represented in the cube).

Every pixel in the entire image is different from every other. Each pixel color in the image is equally spaced from the nearest pixels to it (by color, not by position).

Of course, there is more than one way to do this. We could have simply replaced the whole image with any preselected one which was color-uniform. We could have even used a simple rainbow picture without any structure.

To make it interesting, the program attempts to make as little change as possible to each pixel. The pixels don’t move, they just adjust their shading. Or sometimes they change a lot, if there is a big shortage of a color.

Sometimes a photo has a good mix of colors to begin with. Then the program’s job is easy. A few small modifications are enough to give each missing color a spot in the frame. More often, there are some pretty big gaps. Most of the pictures I’ve looked at are missing magenta, hot pink and lime green. That means the program has to change some existing pixels to those colors. It will change the ones that are already close to the target color to keep the geometry of the picture as intact as possible.

Once in a while you get a picture that is missing almost everything


Everything the program needs can be found in the picture, although it may be well hidden. Some patches of this muddy water are slightly darker than others. Some have more blue or more green. These slight tendencies can be exaggerated until the color cube is filled in.


Here are a few more examples. This is all generated by a simple-minded program which doesn’t know anything about the picture content. I didn’t do any pre- or post-processing.

Another way to think of it is as follows: Every one of the pictures with a resolution of 1632 x 1224 (which is most of them) uses exactly the same pixels, rearranged in different ways.





Comments (2)