Raspberry Pi Camera - An interview with Dave Jones

In February 2014 I had the chance to attend the second Raspberry Jamboree. The Jamboree is an annual event where hundreds of Raspberry Pi enthusiasts meet to discuss and show their latest Pi powered project.

I was lucky enough to meet and interview a number of makers and hackers and the majority of these interviews were featured in Linux Format magazine, but for those not featured in the magazine I have obtained permission from the editor to post them to this blog.

In the first of these interviews I spoke with Dave Jones, whose work on the PiCamera Python library has enabled thousands of projects to use a robust and well supported framework to the great Raspberry Pi camera.

So here in full is the interview with Dave Jones, along with a few pics taken from my Flickr album.


alt Dave Jones smiles for the camera

Les Pounder: Hi Dave, please can you tell me more about your project?

Dave Jones: Hi, well PiCamera is a library for Python to enable easy access to the official Raspberry Pi camera module.

LP: But we already have the “raspivid” and “raspistill” commands in Bash. How does your project differ?

DJ: Both “raspistill” and “raspivid” are still the easiest ways to interact with the camera. With the commands to use them being issued from the terminal. But what I wanted to create was a way to use the camera more effectively with Python. I developed the PiCamera library to “scratch an itch” with the itch being my interest in microscopy which was difficult to pursue with the standard Raspberry pi camera software.


LP: You can use the filesystem with Python, via importing the os library and then call “raspivid” and “raspistill”?

DJ: Yes that's true, but it is not an elegant solution and I wanted to make it as easy as possible to use the camera with Python. It should be simple enough for a relative newcomer to Python and the Pi to use and not have to complicate matters by learning how to call an external program in Python.

Don't get me wrong, raspivid and raspistill are both great tools and I often use them to check that everything is working. They are also a constant source of inspiration as each new version brings new functionality and ideas.

LP: What projects are already using your camera library?

DJ: So many projects right now! One of the first projects was a stop motion animation system built entirely in Python. This was a beautiful project. Another project was for a panoramic camera that would take exceptionally high quality and expansive shots. The Raspberry Pi and camera would be mounted on a motorised base that would slowly turn and take a series of pictures which would then be stitched together for one final picture. The camera can also be used for motion detection projects. Using another Python library called NumPy you can take a picture with the camera and then convert it into numbers then compare this picture with a series of pictures and “detect” where there are differences. This will generally indicate that there has been movement.


LP: What functionality does PiCamera bring?

DJ: Well, not a lot more than raspistill and raspivid. In fact in some areas, namely OpenGL they exceed the abilities of my library. With the library you can alter the brightness, colour and contrast of an image, also flip the image across both axis. The main difference between the library and using raspistill and raspivid is that rather than shutting down a process and then tweaking a setting, we can keep the camera running and tweak settings while the camera is still in use. This is best illustrated by writing a small loop that will increase the brightness of the preview image. Actually we do offer one feature that is not currently available elsewhere. PiCamera can record video and take a photo at the same time, much like top end smartphones. This is a great feature for security cameras, where motion detection can triggerthe recording of a video.

LP: The Raspberry Pi camera is really the camera from a mobile phone, but the use case for a mobile and a Pi is radically different.

DJ: Very true. Pi users are hackers and makers and they are using the camera in many creative ways, and it turn it has exposed many interesting bugs. Such as if you didn't have
the preview running the pictures would gradually get darker and darker. This was due to the auto exposure algorithm, as with a mobile, when would you take a picture without the preview running? You need the preview to see what you are taking a picture of.

Many thanks to Dave for taking the time to talk about his project.

Dave also recorded a video of his PiCamera project at the Manchester Raspberry Jam in November 2013.