Let your raspberry PI see this wonderful world!

At Mikamai we’re always testing with new technologies and we’ve already expressed our love for the Raspberry PI.

Lately we finally got our hands on a Pi Camera and started using it. Well, the Picamera has been around for a while, but the wait was fruitful since just recently a Python library has been released in the wild!

Raspbian comes with a toolset of useful CLI programs to start grabbing pictures and videos right after unboxing, but a pure Python interface is just perfect for writing Raspberry applications.
Enter Picamera

The setup is really easy:

sudo apt-get install python-picamera

From grabbing a single picture

#simple grab
import picamera

with picamera.PiCamera() as camera:
    camera.start_preview()
    camera.capture('image.jpg')
    camera.stop_preview()

to setting up a time lapse, the effort is nil.

#simple time lapse
import time
import picamera

with picamera.PiCamera() as camera:
    camera.start_preview()
    for filename in camera.capture_continuous('img{counter:03d}.jpg'):
        time.sleep(60) # wait 1 minute

And if we use the GPIO to add an infrared proximity sensor (like we did for Arduino), we can build our cheap alarm camera system!

So procure yourself a camera and then head to the Picamera documentation and show your Raspberry some pictures.

Leave a Reply

wpDiscuz