How Gunman Works

In the One on One and Multiplayer modes, Gunman uses advanced color detection technology to determine whether you have hit your enemy. At the beggining of the match, you select your opponents shirt so that Gunman can figure out whether you have hit your opponent.

The hardest part of color detection on the iPhone is the thousands of different lighting conditions and shades of color that exist. In order to "train" our algorithm, we took thousands of real-life pictures of people wearing different-colored shirts in different lighting conditions. We then plotted the hsv (hue, saturation,value) elements of the color -- a way to break down color into values that let you better understand how close one color is to another.

Here's a plot of the s-v values. Notice that the colors are scattered all over the place. It's hard to do color detection looking at these two values.

Here's a plot of the h-v values. Notice that the colors are clustered in certain areas of the graph. This is useful, because now the color detection algorithm can assess what color a pixel is by the range of h-v values it falls in.

The plot of h and s values is also useful for color detection. Separating colors into the hsv elements was key in developing accurate color detection.