This was tested with Ubuntu 16.04
Make sure we are in our home directory
cd ~
Upgrade any currently installed packages (may take a long time)
sudo apt-get update sudo apt-get upgrade
sudo apt-get install build-essential sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev sudo apt-get install python-dev python-numpy sudo apt-get install -y unzip wget
sudo apt-get install libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
sudo apt-get install libgtk2.0-dev
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt-get install libatlas-base-dev gfortran
wget https://bootstrap.pypa.io/get-pip.py sudo -H python get-pip.py
sudo -H apt-get install python2.7-dev
Numpy is used by Python for Image representation.
sudo pip install numpy
Get OpenCV 3.3 build from GitHub
cd ~ wget https://github.com/opencv/opencv/archive/3.3.0.zip unzip 3.3.0.zip mv opencv-3.3.0/ opencv cd opencv
cd ~/opencv $ mkdir build $ cd build $ sudo cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
make -j7
If you run out of disk space on your VM check out the little guide on extending your Virtual Disk
https://avinton.com/en/academy/extending-virtualbox-virtual-drive/
sudo make install sudo ldconfig
python
import cv2 cv2.__version__
The above should return 3.3.0 (The OpenCV Version you installed)
Exit python interpreter and return to terminal
exit()