Previous posts

Post 1 - Introduction

 

PyGaze (the open-source eye tracking software this project will be based on) requires OpenCV for python. Installing OpenCV 3 is a multi-step (and even time consuming) process requiring you to install many dependencies and pre-requisites. The remainder of this post talks about this process

Install dependencies

The first thing to do is update and upgrade any existing packages, followed by updating the Raspberry Pi firmware.

$ sudo apt-get update
 $ sudo apt-get upgrade
 $ sudo rpi-update

 

You’ll need to reboot your Raspberry Pi after the firmware update:

$ sudo reboot

Now we need to install a few developer tools:

$ sudo apt-get install build-essential git cmake pkg-config

Now we can move on to installing image I/O packages which allow us to load image file formats such as JPEG, PNG, TIFF, etc.:

$ sudo apt-get install libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev

Just like we need image I/O packages, we also need video I/O packages. These packages allow us to load various video file formats as well as work with video streams:

$ sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
$ sudo apt-get install libxvidcore-dev libx264-dev

 

We need to install the GTK development library so we can compile the highgui sub-module of OpenCV, which allows us to display images to our screen and build simple GUI interfaces:

 

$ sudo apt-get install libgtk2.0-dev

 

Various operations inside of OpenCV (such as matrix operations) can be optimized using added dependencies:

$ sudo apt-get install libatlas-base-dev gfortran

Lastly, we’ll need to install the Python 2.7 and Python 3 header files so we can compile our OpenCV + Python bindings:

$ sudo apt-get install python2.7-dev python3-dev