How many sesame seeds are there on a burger bun?


Somebody posted a quiz question on a prominent social network that asked how many sesame seeds there are on a burger bun.

My, first reaction was "I'm definitely not gonna count them" but then I thought I'd love to make a computer count them for me. And so I decided to try it.

First thing, take a photo of the bun. My experiments showed that it's best to use the flash, because overhead lighting minimizes the lightness variations due to ridges of the bread.

burger bun

Then fire The Gimp and make sure the seeds stand out more.

burger bun

color inverted burger bun after threshold filter

burger bun after some erodes and dilates

burger bun with seeds circled by the computer

This is the final result. The computer counted 284 seeds. I can count (by eyeball) around 30 seeds that went undetected but there are a few false positives (you might want to crop more tightly than I did, or use the Gimp's eraser tool to remove the cheddar) and a few seeds on the side of the bun that are not visible in the photo so I believe the count is fairly accurate.

So now you know that there are around 300 sesame seeds on a burger bun.