Pi Camera Board

First of all, we'll have to connect the camera ribbon to the Pi's camera port, refer to the official Raspberry Pi website article explaining how to:

  • Physically connect it
  • Enable it using sudo raspi-config
  • Use the camera via a shell or using python

Activating the Camera

On Raspbian you could use the raspi-config command to activate the camera. If using another distribution (like Minibian you might have to manually edit /boot/config.txt to have the following lines:

> nano /boot/config.txt

/boot/config.txt

gpu_mem=128
start_x=1

The reboot the Pi, and test that the camera is accessible with:

Test capture:

> raspistill -o cam.jpg

PiCamera

There are a couple of python libraries available for the Pi Camera, the applications hereunder are real-life usage samples of the picamera library:

To make picamera available for all users on the system:

> sudo apt-get update
> sudo apt-get install python-picamera
[> sudo apt-get install python3-picamera]

to remove your installation:

> sudo apt-get remove python-picamera
[> sudo apt-get remove python3-picamera]

To install picamera in a Virtualenv:

> sudo apt-get install python-pip python-virtualenv
> virtualenv sandbox
[> virtualenv -p python3 sandbox]
> source sandbox/bin/activate
(sandbox) $ pip install picamera
[(sandbox) $ pip-3.2 install picamera]

More about upgrading, removing picamera from a virtualenv.

Applications