In the Blockpraktikum “Sketching with hardware”, my teammate Mengbing Guo and I decided to do something interesting. A tricky idea with a polaroid camera came up! It looks like a normal polaroid but when people take pictures, the picture come up with different effect: there are ghosts around you, or your face become a doggy!
1. Connection from the camera to Arduino
The main idea of our concept is presented in the following: when a picture is taken, it would be found in computer immediately by USB connection and modified with an image manipulation program, then be printed with a small photo printer.
But there was a problem with our cheap toy digital camera: when we connected the camera to our computer with a USB cable, the camera went automatically to a “USB mode” and couldn’t let us take pictures at the same time. To solve this problem we decided to hack the USB wire and camera shutter and develop an Arduino program, which makes the camera more intelligent: when we push the camera shutter, it goes to USB mode in 5 seconds and exits the camera USB mode after 20 seconds (the approximate time for our photo manipulation and printing) so we can take the next picture.
There are four wires inside a USB cord which are colored red, black, white and green.Red, as standard color for positive wires, has 5 volts. Black is the ground wire as for negative or ground connections. The other two are translation data wires. We cut the red wire away: one port, which connected to the computer, is use for the power support of our electronic circuit. The other port, which connected to the camera, would be linked to a PNP transistor. With an Arduino program, the camera shutter should be seen as an input to control whether the USB circuit is connected or switched off. The electronic circuit is seen in the picture below.
2. Image manipulation
Photos were manipulated in two different ways:
1) Add a scary creature into the background space of the photo, e.g. a ghost, zombie.
2) Or have the faces covered with random scary face masks. But in the end we added some meme face images (grumpy cat, doge, rage faces) to make the output even more surprising.
We wrote a java program that serves three main functions:
1) Runs a thread which checks if the camera USB storage is connected. If yes, it fetches the latest image to the local folder. Due to the Arduino program’s setting, we have 15 seconds to copy the latest image which is usually more than enough.
2) Analyzes the image content. We used the OpenCV library to detect face position and size. If there is enough space between the faces, the image manipulation program will choose manipulation type 1, otherwise type 2.
3) Gives a print command to the photo printer via Java Print API.
At the beginning of the project we were quite unsure which printer would be the most convenient one to use and we didn’t have much time to decide. First we were thinking of the small thermal printer used at the cash points, but since the thermal printer can only print receipts, we found it really weird to have a “Polaroid” which prints black-white receipts. Luckily, we found a Canon mini photo printer on Amazon which was delivered on the next day. The mini photo printer can even work as a wireless device which makes it much easier to design the Polaroid prototype.
Java offers an API for accessing the print jobs and settings. First we encountered some troubles with the page layout, but we managed to hack the settings in the hash table. We were very happy as the photos were successfully printed via Java print API command.
The prototype is a wooden case with the toy camera and the mini printer inside. We used 9mm MDF for building the case. To maintain stability, the boards were cut to puzzle-like shapes so that it can be easily patched together. The back side of the case was left open for cables and wires. In the end we sprayed the boards with varnish to create the glossy coat of a Polaroid.
We cut a big round hole on the front side and put a round glass plate of the same size into the big hole to make it looks like an old fashioned lens opening. There is a smaller hole on the upper board so that one can click the shutter release through the hole. The case edges are additionally protected by metal foils.
The logo and mascot ghost were also engraved by the laser cutter. Actually, the manipulated photos were supposed to be scary, however a meme Polaroid was built instead. Well, that is why the ghost looks so cute.