Thursday, April 14th, 2011...3:32 pm

Sugar-coated CoM&Mander-in-Chief

Jump to Comments

Let’s play with some food and create mosaics with pieces of candy. We need to place the treats so the resulting image will visually approximate an underlying picture. In this post, you’ll have the opportunity to create mosaics with a variety of candies. For now, we’ll use M&Ms. Fortunately, they melt in your mouth and not in your hand, giving us ample time to create our tiling. Our palette will be the colors from a standard bag of the M&Ms as seen below.

The image we want to approximate with a tiling will be called our target image. Let’s use the poster from the 2008 presidential election that depicted a stylized image of Barack Obama and became synonymous with the campaign.

Our tiles will replace square regions of our target image. For example, the image to the right is such a square region from the image above. This region is a collection of color pixels. Each pixel is represented as a coordinate triplet (r, g, b), where r is the amount of red, g is the amount of green and b is the amount of blue. For each square region, the average “color” is computed by averaging the red, blue and green intensities of each pixel in the region.

The color of M&Ms could be found in a similar way. Instead, we’ll take the color of an M&M to equal the color of a pixel within an image of an M&M with the same color.

Which M&M replaces a given square? The M&M with the “closest” color to the square of interest. For example, suppose the average color of a square region is (120.75, 40.25, 103.25). Let’s take the color of a blue and red M&M to be (0, 48, 106) and (202, 18, 44), respectively.

The distance between the average color and the blue M&M would be

 sqrt{(120.75 - 0)^2 + (40.25 - 48)^2 + (103.25 - 106)^2} = 121.02.

The distance between the average color and a red M&M would be

 sqrt{(120.75 - 202)^2 + (40.25 - 18)^2 + (103.25 - 44)^2} = 102.99.

So, between a blue and red M&M, we choose the red M&M.

How does such a method do in constructing a mosaic? Recognize the mosaic below?

What if we use more or less M&Ms? What if we try a different target image? What happens with other types of candy?

What if we use more or less M&Ms? What if we try a different target image? What happens with other types of candy? Click the image below to visit a webpage that contains an applet to let you explore such questions!

Once you’ve created an image you like, go and buy a bag (maybe several) of M&Ms, Jelly Bellies, Kisses, Peeps or Gummy Bears and make your mosaic by hand!

The best part is taking it apart!



33 Comments

Trackbacks/Pingbacks

  1. Math Monday: Candy Images | LED World
  2. Products & Tech News » Math Monday: Candy Images
  3. Math Monday: Candy Images | House of Mods
  4. Candy Images

Leave a Reply


Warning: Undefined variable $user_ID in /home/timchart/mathmovement.timchartier.com/wp-content/themes/pressrow/comments.php on line 91