Image processing workshop is composed of three parts. First part prepares the development environment that can be accessed using Jupyter lab a web interface. The image processing pipeline for real-time image processing will be setup in the second part. And then in the third part we will integrate the track detection routine in the image processing pipeline.
Before installing python packages we must first change the system locale. For that, ssh into your raspberry pi board and open the configuration tool using the following command: sudo raspi-config. Next, select the menu item 4 Localization Options and the I1 Change Locale. Scroll the list using the arrow down key until you find the en_GB.UTF-8 entry, which we unmark using the space bar, to then we mark the en_US.UTF-8 entry. Press OK and then select again en_US.UTF-8 in the second screen. Wait for the process to complete and then exit the program.
After having set the correct locale we can start installing the needed packages. Raspbian uses a package manager called apt which we will use to install and update programs. In the script below, lines 3 and 4 check for existing updates for all the installed packages. Line 8, installs the virtual environment software which allows us to create python virtual environments. These environments are isolated from each other and can be used to test the code with different versions of the python packages without messing up the raspberry pi python interpreter. Line 10 creates a virtual environment called "raceon" which uses python 3 as the default python interpreter. Line 14 activate the raceon environment. After this line, all packages installed with pip will be installed in the raceon environment. Pip is a python package manager, similar to apt but only for python. Note, some python packages can also be installed with apt, however, the preferred way is pip as apt will not always have the latest version. Line 17, installs the python web interface for development, jupyter, image processing libraries, and picamera, the python library to interface the raspberry pi camera. Line 20 starts jupyter server which would listen for connections on all interfaces. When starting, jupyter will output to the console a link to its web interface.
The two jupyter notebooks describing image acquisition and processing can be downloaded from here: https://github.com/valeriu-balaban/raceon/
Part 2, Camera Interface: https://github.com/valeriu-balaban/raceon/blob/master/CameraInterface.ipynb
Part 3, Track Detection: https://github.com/valeriu-balaban/raceon/blob/master/TrackDetection.ipynb