First of all you'll need to install this:
[compiler] sudo apt-get install build-essential
[required] sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
[optional] sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
After this, download the 100MB+ source from GitHub:
cd ~/<my_working _directory>
git clone https://github.com/Itseez/opencv.git
Now enter in directory downloaded (this will be the directory, that you will install)
cd opencv/
mkdir release
cd release/
And compile sources:
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
Enter in source, and... :
make # and go get some coffee :P
sudo make install # another coffee :P