Choose Language Hide Translation Bar
JohnPonte
Staff (Retired)
What color is The Dress? JMP can tell you!

The Internet was abuzz last week over a picture of a blue and black dress. Or was that a white and gold dress? That was the question. What color is that dress? Well, as a guy, my immediate response was, "Who cares?" What I wanted to know is: Is that dress on sale? How much is this viral fashion going to end up costing me? But then, as a software developer who does image analysis, I also thought this phenomenon was really cool. How is it that people see the same dress as very different colors? Can I use JMP to tell me why? Can JMP tell me what the actual colors are?

About a month ago, I wrote a JMP script called Image Analyzer, which you can download from the JMP File Exchange (requires a free SAS profile). You can run the script and select an image. The image will be read into JMP and displayed in a window, and a data table will be generated, where each pixel in the image is represented by a row of data in the table. Each row contains an x and y value, which is the location of the pixel in the image; red, green and blue values representing the color in the RGB color space; an intensity value; and hue, lightness and saturation values representing the color in the HLS color space. The unique thing about this new script over others I have written in the past is that this script will keep a connection between the image and the data table so that selections in one will be reflected in the other. In fact, you can run an analysis in JMP, and the graph, the data table and the image will all show the same corresponding selected data.

So let's try the script out with the dress.

TheDressData

Now that I have read in the image and created a data table, I can do some analysis. My colleague, Craige Hales, was also interested in analyzing the dress, and he started by using Clustering. If I select Analyze->Multivariate Methods->Cluster, I get the following graph:

clusterAll

The Cluster analysis would indicate three distinct clusters, which I have identified with a 1, 2 and 3. Selecting each cluster individually shows the corresponding pixels in the image. I have shown each of the three images also with the same labeling. Notice that cluster 3 does not highlight any pixels in the dress, but rather it identifies areas in the background. That would mean that the dress is actually made up of two fairly distinct colors.

But what are the actual colors? For that, let's look at the actual color values in the data table. Often when working with color, it is beneficial to look at the colors in the HLS color space instead of the RGB color space. So this time, I use Analyze->Distribution and select H, L and S as my distribution columns.

distribution

From the Distribution, the Hue (H) again identifies two very distinct colors. Since the HLS values are in a normalized color space, I can interpret the value of 0.65 to be, in fact, blue. Similarly, I can interpret the value of 0.1 to be gold. So that would explain why people see blue and gold in the dress. But why do people usually see either blue and black or white and gold and not just blue and gold? The answer to that lies in the other two Distributions, lightness (L) and saturation (S).

If we select the bars for the Hue indicating a blue color, we see that the lightness values are mostly above the mid-range, while the saturation values are typically around the 20 percent range, maxing out at about one-third. A low saturation means there is not a lot of color present, but rather it is muted by gray. And a mid- to higher lightness value would indicate that the gray color is closer to white. So someone who focuses on the hue would see blue, whereas someone who is more influenced by the lightness and saturation would see white.

bluewhiteDist

Similarly, we can do the same for the other color. We can select the bars for Hue indicating a gold color. We see a similar pattern for the saturation, indicating the color is muted by gray. But this time, the lightness is predominantly low, indicating that the gray value is closer to black than to white. So someone who focuses on the hue would see gold, whereas someone who is more influenced by the lightness and saturation would see black.

blackgoldDist

What is interesting is that one group of people seem to be influenced by the lightness and saturation. This causes the blue to appear as white and the black to appear as gold. The reverse is true for the other group. They appear to be able to filter out the light and focus more on the hue and correctly see the blue and the black.

I have to admit that I am one of those people who clearly see white and gold even though the manufacturer of the dress has indicated it is really blue and black. What colors do you see? And, more importantly, have you found it on sale (in case my wife asks)?

Article Labels

    There are no labels assigned to this post.

16 Comments