Skip to content

Installing opencv on gorgon

Sameep Tandon edited this page Apr 24, 2014 · 8 revisions
### save this script as install_opencv.sh
### in a directory with more than 8 GB of space, run this script
### this will install to INSTALL_PREFIX
### The implication is that this will not install if you run it 
### from your AFS space (unless you have requested a quota increase)
### One option is to move the script to /scr, run it from there
### This is good for both gorgon and deep machines.
### NOTE: Requires CMake 2.8+

INSTALL_PREFIX=~/scratch/opencv

# installing local libav for libraries
mkdir $INSTALL_PREFIX/libav_build/

# build yasm
wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
tar xzvf yasm-1.2.0.tar.gz
cd yasm-1.2.0
./configure --prefix=$INSTALL_PREFIX/libav_build
make -j8
make install
make distclean
cd ..

# build libav
wget http://libav.org/releases/libav-0.7.7.tar.gz
tar xvf libav-0.7.7.tar.gz
cd libav-0.7.7

export PKG_CONFIG_PATH=$INSTALL_PREFIX/libav_build/lib/pkgconfig:$PKG_CONFIG_PATH
export PATH=$PATH:$INSTALL_PREFIX/libav_build/bin

./configure --prefix=$INSTALL_PREFIX/libav_build --enable-pic --enable-shared
make -j32
make install
cd .. 

# to house the installation
mkdir $INSTALL_PREFIX/opencv/

# python with numpy
wget https://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.9.1.tar.gz --no-check-certificate
tar xvzf virtualenv-1.9.1.tar.gz
python2.6 virtualenv-1.9.1/virtualenv.py --system-site-packages --distribute $INSTALL_PREFIX/opencv/env_opencv_gorgon

source $INSTALL_PREFIX/opencv/env_opencv_gorgon/bin/activate
pip install -U distribute
pip install numpy

# opencv
wget http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.8/opencv-2.4.8.zip\?r\=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fopencvlibrary%2Ffiles%2Fopencv-unix%2F2.4.8%2Fopencv-2.4.8.zip%2Fdownload\&ts\=1395114030\&use_mirror\=softlayer-dal
unzip opencv-2.4.8.zip
cd opencv-2.4.8

mkdir build_dir
cd build_dir
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=$INSTALL_PREFIX/opencv/ -D \
BUILD_NEW_PYTHON_SUPPORT=ON -D PYTHON_EXECUTABLE=$INSTALL_PREFIX/opencv/env_opencv_gorgon/bin/python ..

make -j8
make install
cp $INSTALL_PREFIX/opencv/lib/python2.6/site-packages/* $INSTALL_PREFIX/opencv/env_opencv_gorgon/lib/python2.6/site-packages/
Clone this wiki locally