Here’s our third post about the software libraries that are going to be used in our project.
First of all the Python software we’re developing has to include all the functions used by the dice counting. The counting is achieved thanks to an image processing code using the OpenCV and the Numpy libraries. The first one stands for Open Source Computer Vision Library and is widely used for computer vision applications as described here: http://opencv.org/about.html.
The second one is a Python library mostly dedicated to the handling of N-dimensional array objects such as pictures. Other information about it can be found here: http://www.numpy.org/.
The installation of these libraries is a bit tricky. So we decided to follow a complete tutorial to install them on the Raspberry Pi 3: http://www.pyimagesearch.com/2016/04/18/install-guide-raspberry-pi-3-raspbian-jessie-opencv-3/. This tutorial recommends to create a virtual environment dedicated to OpenCV.
Luckily we spared a lot of time by finding a complete code using both libraries and counting dice from a jpg file. This code returns the number of dice, a vector containing the results and the number of erroneous objects. On another hand it also provides the result of the image processing. Our job is to sort and keep the parts of the code that are going to be useful for our application and to implement them properly.
To guarantee a transparent communication we joined the URL providing the original code we didn’t develop: https://www.reddit.com/r/raspberry_pi/comments/28j5v2/counting_dice_with_opencv/. You can also watch the video to learn a bit more about this code.
Then, we have to ensure the communication between the Raspberry Pi and the Arduino. In fact, the Raspberry Pi sends instructions to the Arduino which only contains the code to achieve these instructions. This communication is going to be handled by USB thanks to the Serial library.
For more information you can check Antoine’s video here : Software libraries
See you soon,