Things you will need:
1- Putty(SSH Client)
2- Internet connectivity on your pi
1- Update and install all the essential files needed for the build
sudo apt-get update
---wait for the update to finish
sudo apt-get update
sudo raspi-config
sudo reboot
sudo apt-get update
sudo apt-get install build-essential cmake pkg-config python-dev libgtk2.0-dev libgtk2.0 zlib1g-dev libpng-dev libjpeg-dev libtiff-dev libjasper-dev libavcodec-dev swig unzip
sudo apt-get install libopencv-dev python-opencv python-dev
wget http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.9/opencv-2.4.9.zip
unzip opencv-2.4.9.zip
---unzips the compressed filecd opencv-2.4.9
cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_PERF_TESTS=OFF -DBUILD_opencv_gpu=OFF -DBUILD_opencv_ocl=OFF
make
sudo make install
pkg-config --modversion opencv