Our idea for the machine learning project was to take a picture of a handwritten digit from the Raspberry Pi camera and let a machine learning guess the digit. Therefore we need 2 things. A camera and software to take and process pictures.
We used the Raspberry Pi “NoIR” camera board, that we installed according to the instructions from the official Raspberry Pi documentation page. In a nutshell, you have to connect the camera correctly, and then…
… select “Enable camera”, then hit Enter.
Because we’re operating with the farmer user, we’ll have to add
farmer to a group named
sudo usermod -a -G video farmer
Then restart the Pi.
With the camera connected, enabled and the right privileges you should be able to run this:
raspistill -o ~/cam.jpg
(it can take several seconds)
After you should see an image (or at least an image file) in your home directory named “cam.jpg”.
For the software, we’re going to need two things:
python-picamera: A library that enables us to control the camera board.
scikit-image: A library to process the images we record.
In order to take pictures we’re going to use the “python-picamera” package.
sudo apt-get update sudo apt-get install python-picamera
sudo apt-get update sudo apt-get install python-matplotlib python-numpy python-pil python-scipy sudo apt-get install build-essential cython pip3 install -U scikit-image