Install procedure
1) go the the home directory and clone the repository by
cd /home/pi/
git clone --recurse-submodules https://github.com/aa4cc/flying-ball-in-hoop.git
Shutdown button service
Copy the service checking whether the shutdown button is pressed to the system directory with other services
sudo cp ~/flying-ball-in-hoop/scripts/pi_shutdown.service /lib/systemd/system/
Enable the service to automatically start when raspberry pi boots
sudo systemctl enable pi_shutdown.service
Run the service so you don not have to reboot the raspberry pi
sudo systemctl start pi_shutdown.service
Now you can check the status of the service by running
sudo systemctl status pi_shutdown.service
Install OpenCV
This guide vaguely follows a guide written here but this one is altered and valid for Raspbian Stretch.
-
Log in and change password.
-
Connect to the Internet.
-
Skip Step #1 in the above-mentioned guide and go to Step #2 - with Raspbian Stretch there is no need to expand the filesystem.
- Update packages:
sudo apt-get update
- Upgrade packages:
sudo apt-get upgrade
- Install CMake:
sudo apt-get install build-essential cmake pkg-config
- Get image file formats support:
sudo apt-get install libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev
- Get video file formats support:
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev sudo apt-get install libxvidcore-dev libx264-dev
- Install GTK development library:
sudo apt-get install libgtk2.0-dev
- Install other useful dependencies:
sudo apt-get install libatlas-base-dev gfortran
- Install Python:
sudo apt-get install python2.7-dev python3-dev
- Get OpenCV archive:
cd ~ (or cd /home/pi) wget -O opencv.zip https://github.com/Itseez/opencv/archive/3.4.3.zip unzip opencv.zip
- Install pip:
sudo apt-get install python3-pip
- Install NumPy:
pip3 install numpy
- Setup build via CMake:
cd ~/opencv-3.4.3/ mkdir build cd build cmake -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=/usr/local \ -D INSTALL_PYTHON_EXAMPLES=ON \ -D ENABLE_PRECOMPILED_HEADERS=OFF \ -D BUILD_EXAMPLES=ON ..
- Compile OpenCV:
make -j4
- Install OpenCV:
sudo make install sudo ldconfig