OpenCV Linux Cluster Installation

OpenCV (Open source Computer Vision) is a library of algorithms and code for computer vision with extensive documentation and books.

Installation is delightfully simple albeit a little unusual; download the source into somewhere sensible (/usr/local/src/OPENCV) and extract (tar xvjf OpenCV-2.4.3.tar.bz2). Create a build directory outside the source directory, mkdir /usr/local/src/OPENCV/cmake_binary_dir, and create a directory when the files will finally be stored (e.g., mkdir -p /usr/local/opencv/2.4.3).

Load the relevant environment modules for this installation (e.g., module load gcc/4.7.2 cmake jasper ffmpeg). Change to the build directory and run cmake, make, and make install on the source directory. i.e.,


cd /usr/local/src/OPENCV/cmake_binary_dir
cmake ../2.4.3
make
make install

Copy the contents of the build directory to a the install directory (cp * -r /usr/local/opencv/2.4.3) and create a base environment module (mkdir -p /usr/local/Modules/modulefiles/opencv, vi /usr/local/Modules/modulefiles/opencv/.base), and create a symbolic link to the specific version from the base (cd /usr/local/Modules/modulefiles/opencv, ln -s .base 2.4.3), and create .desc and .version numbers in that directory. The .base file should look like the following:


#%Module1.0#####################################################################
##
## $name modulefile
##
set ver [lrange [split [ module-info name ] / ] 1 1 ]
set name [lrange [split [ module-info name ] / ] 0 0 ]
set loading [module-info mode load]
set desc [join [read [ open "/usr/local/Modules/modulefiles/$name/.desc" ] ] ]
proc ModulesHelp { } {
puts stderr "\tThis module sets the envinronment for $name v$ver"
}
module-whatis "$desc (v$ver)"
if { $loading && ![ is-loaded gcc/4.7.2 ] } {
module load gcc/4.7.2
}
prepend-path LD_LIBRARY_PATH /usr/local/$name/$ver/lib
prepend-path MANPATH /usr/local/$name/$ver/man
prepend-path PATH /usr/local/$name/$ver/bin

After installation login to the cluster as a normal user, load the opencv module, and run the core tests (opencv_test_core).