Categories
Vision

Installing OpenCV on RPi

I followed these instructions:

Install OpenCV 4 on Raspberry Pi 4 and Raspbian Buster

sudo apt-get -y update && sudo apt-get -y upgrade

sudo apt-get -y install build-essential cmake pkg-config

sudo apt-get -y install libjpeg-dev libtiff5-dev libjasper-dev libpng-dev

sudo apt-get -y install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev

sudo apt-get -y install libxvidcore-dev libx264-dev

sudo apt-get -y install libfontconfig1-dev libcairo2-dev

sudo apt-get -y install libgdk-pixbuf2.0-dev libpango1.0-dev

sudo apt-get -y install libgtk2.0-dev libgtk-3-dev

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

sudo apt-get -y install libhdf5-dev libhdf5-serial-dev libhdf5-103

sudo apt-get -y install libqtgui4 libqtwebkit4 libqt4-test python3-pyqt5

sudo apt-get -y install python3-dev

but then needed two more libs installed, which I found here:

https://github.com/EdjeElectronics/TensorFlow-Object-Detection-on-the-Raspberry-Pi/issues/18

sudo apt install libilmbase23
sudo apt install libopenexr-dev

According to the PyImageSearch guy, opencv will be faster if we build from source, for RPi, but that takes an extra 2 hours. So no.

So the remaining parts were:

sudo wget https://bootstrap.pypa.io/get-pip.py  sudo python get-pip.py
sudo python3 get-pip.py
sudo rm -rf ~/.cache/pip
sudo pip install virtualenv virtualenvwrapper 

Add these to ~/.bashrc

export WORKON_HOME=$HOME/.virtualenvsexport VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3source /usr/local/bin/virtualenvwrapper.sh

Then

source ~/.bashrc
mkvirtualenv cv -p python3
pip install "picamera[array]"
pip install opencv-contrib-python 

This gave this error: Could not find OpenSSL

ok so

sudo apt-get install libssl-dev