ASCII Photo Booth

It’s been a little while since the last blog entry, but it’s given a little time to considering the next experiments in Pi cookery.

Image conversion with jp2a - click for larger if you dare!

Webcam capture converted with jp2a

I’ve been giving some thoughts for what I could bring to the next Exeter Raspberry Jam (7th June 2014 – 10am). One thing that might be popular is to combine a few tools, a webcam and a printer and create an ASCII photo booth. It would make an interesting flip-side to the high-end megapixel cameras and could also possibly be thought of as art.

So how to do it?

Experiments so far:

I’ve had success with the tool “motion” taking regular images from a USB webcam and saving them to SD cards. I’ve had success with making these visible as JPEGs (Even using Motion’s built-in webserver). I thought I would try some other commands to take just one image from the webcam and process that on demand. What a disaster!

I’ve tried “uvccapture” and also “fswebcam” – ┬áboth of which seem to give me a headache. One reports an ioctl error and the other produces images that are too dark. I’ve tried a couple hours of fiddling and didn’t see an improvement.

  • Currently, what seems to work is to capture images every 2 seconds using motion. I don’t need it to do much else, although the webserver might be handy for viewing full colour previews in future.
  • I can then use “jp2a” to show an ASCII version of the jpeg image
  • I can use “jp2a –background=light” to create a file that would use black characters on a white background.
  • I can use “cups” and the “lpr” command to send the image to a printer.
  • I’ll connect a big fruit-machine type button on a GPIO input for triggering the shutter and printing.
  • I’ll join it all together with Python, perhaps using “figlet” to generate on-screen instructions.

Other interesting things I’ve discovered: We have a Windows 7 laptop with the printer connected – and shared. For some reason, it seemed more straightforward to connect the Raspberry Pi to the shared printer using CUPS over the network than it was to connect a Vista laptop. I don’t know why this might be – perhaps I’m too short-sighted technically here – but surely the same family of operating systems should be easier? Ho hum…

I’ll post the results of my experiments here later, but that’s another story yet to come!