I attended Rewired State's National Hack The Government from 8th to 9th March 2014. The vibe was awesome and there were lots of other great hackers there, finding vulns in *.gov.uk sites for example! My contribution included a system of detecting MPs faces (on ID cards) using a photoresistor I had in my bag.

Why?

Hardware hacks are my thing, I had brought along every resistor I owned and had thought of this idea quickly beforehand. I set out in a team but it quickly became apparent that I'd be tackling this challenge on my own; that's what I did.

What is it?

Using a bunch of images of UK Members of Parliament (sorry TheyWorkForYou for the repeated API usage!) converted to monochrome I built a system that would detect which MP was displayed on the phot based on the light coming into the sensor.

How does it work?

At the time I didn't know, I was tired and it was 3:30am when it finally worked successfully.

The basic principle is that the black parts of the image wouldn't allow light to pass through (or not enough to be detected), so calculating the amount of black in the image and then getting the percentage light level when the image was placed on the sensor compared to a plain white light would detect the MP.

I just match up the two percentages and if they're the same (I had a +-0.4% accuracy) then it would be the MP!

Keep in mind that this was created in less than 24 hours so the code isn't meant to be pretty.

You can contact me at will@will3942.com or @Will3942.

Feel free to join in the discussion on Hacker News here.