OpenStreetMap

Counting faces in SOTM 2011 group photo

Posted by Kachkaev on 22 September 2011 in English. Last updated on 13 October 2017.

Some of us may have already spotted that the next week’s featured image is the group photo made recently on the SOTM conference in Denver:

The first thing that came to my mind when I looked at it was that it would be quite interesting to know the exact number of people standing, sitting and even lying there. So I decided to find that out.

Counting faces manually is quite boring: it is easy to miss someone, calculate twice or even reach nirvana FFFUUU effect after getting mixed up somewhere in the middle of this boring process.

Probably, the most straightforward way nowadays would be in feeding that image to Picasa or any other software with face recognition, but that would not give an accurate result because some people are almost completely hidden behind others. And, by the way, most probably there would be still a need to count people, not in a photo, but in the list of faces found.

So I decided to take another approach: manual recognition with automated counting. I copied the photo into a new flash document, created a red square symbol and placed it over faces in the image:

process of marking faces on the photo

That was very easy and fast to do: I simply dragged and dropped instances of the symbol holding alt key.

result of marking faces on the photo

After that I wrote just 5 lines of code (I used AS2 for simplicity):

In the first frame of the movie:
_root.facecount=0;

In the second frame:
trace(_root.facecount);
stop();

And in the only frame of the red square symbol:
++_root.facecount;
stop();

Finally I pressed Ctrl+Enter and immediately saw the answer in the output window: 179. Update: As Peter Batty was on both sides of the photo, the real answer is 178 − so that’s how many people were there.

The entire process took just 4 minutes. If you want to double-check the result or use the same method for counting people somewhere else, here is the flash file:
fla file SOTM11_denver_facecount.fla (20 MB, the photo itself is quite heavy)

Sorry to anyone who feels uncomfortable seeing a red square on their face.

Update 2: Also counted faces on the SOTM 2011 EU photo. 146 people are there.

Discussion

Comment from maning on 23 September 2011 at 01:24

Note that Peter Batty appeared twice in the photo. :)

Comment from Kachkaev on 23 September 2011 at 09:15

Oh, didn’ spot that ‘magic’. Are you sure the name of that guy is Peter Batty, not David Blaine?

Updated diary entry, thanks!

Log in to leave a comment