People from another time: Ever-changing faces from historical NZ portraits

Other Faces

This post details a small project I created over Waitangi Weekend using the DigitalNZ API . You can play with the end result here.

In late 2011, I attended the New Zealand National Digital Forum. It was a great conference full of inspirational people. I was particularly taken by Tim Sherratt's presentation on the Invisible Australians project and Mitchell Whitelaw's thoughtful discussion of generous interfaces.

These talks left me thinking about the relationships between serendipity, emotional reactions to imagery and finding interesting stuff. I was left wanted to create something akin to the experience of walking through an unfamiliar museum. Wandering through dusty corridors - in my mind's eye, good museums are always dusty - not knowing where they will lead. Around every corner is something strange, delightful and totally unexpected. Enigmatic windows into unknowable times. Distant yet familiar faces, forever frozen in a moment.

People from another time is an ever-changing gallery of faces from historical New Zealand portraits and my attempt to make something based on these ideas. It draws from Auckland Libraries' incredibly rich Heritage Images Collection of no known copyright images. This is how I made it.

Harvesting the images

I wrote a small Python harvester to download metadata about Auckland Libraries Heritage Images using the DigitalNZ API. The harvester iterates through pages of JSON results for an API search query on all images from Auckland Libraries with the keyword "portrait" that are available for modification. Here's what the DigitalNZ query looks like:

For each image, I logged the DigitalNZ ID, the image title, and the URL for its large thumbnail. I then wrote a second harvester to loop across all the DigitalNZ metadata results and download the large thumbnail from the Auckland Libraries website. I set a one second delay between each query to make sure that I didn't cause problems on the Auckland Council servers.

Detecting and extracting faces

I downloaded Tim Sherratt's experimental face detection Python scripts for working with OpenCV from GitHub using a Haarcascade frontal face classifier. I modified Tim's script slightly to make it fit my workflow and reduce the size of the buffer around each face. I launched a new terminal, ran the script, and soon I a directory full of cropped images.

Tim's script performs a double-pass across each face it finds in a given image. First it looks for faces within the raw image. For each candidate face it finds, it performs a second check on just that region of the image. This gives a pretty amazing result, but it does find a few false positives. I cleaned up the mis-classifications with a visual inspection of the images.

Building the website

This was a small weekend project. I didn't want to set up a fully fledged web application for dealing with the static data. I uploaded the cropped images to a webserver and packaged the metadata up in a single JSON file. The gallery is constructed on the fly with some custom jQuery. Feel free to view the source, poke around, and take what you need.

Faces