Install g++
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install g++-4.9
cd /usr/bin
sudo rm gcc g++ cpp
sudo ln -s gcc-4.9 gcc
sudo ln -s g++-4.9 g++
sudo ln -s cpp-4.9 cpp
Install CMake
sudo apt-get install build-essential cmake
Install Git
sudo apt-get install git
Install FFmpeg
sudo apt-get install ffmpeg
Install OpenCV
sudo apt-get install libjpeg62-dev libtiff4-dev libjasper-dev
sudo apt-get install libgtk2.0-dev
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
git clone https://github.com/Itseez/opencv.git
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
make
sudo make install