Tuesday, July 2, 2013

Install opencv without root permission


1. Download old versions of OpenCV
- If gcc on my system is outdated, I may need to install an old-version of opencv.
- In my system (Fedora release 10 (Cambridge)), the OpenCV-2.4.1 or before seems to work.

2. Installation ([2][3])
- Run the following.

>> tar -xvf  OpenCV-2.4.0.tar.bz2
>> cd  ~/OpenCV-2.4.0/
>> mkdir release
>> cd release
>> cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/home/gunhee/lib/opencv2.4 -D BUILD_PYTHON_SUPPORT=ON -D PYTHON_EXECUTABLE=/home/gunhee/lib/python-2.7.3/bin/python -D PYTHONINTERP_FOUND=1 ..
(Assume that the python interpreter is at 'PYTHON_EXECUTABLE=/home/gunhee/lib/python-2.7.3/bin/python'.)
>> make
>> make install

- Add the following to the .bashrc file [3].
# opencv
export LD_LIBRARY_PATH=/home/gunhee/opencvlib/lib:$LD_LIBRARY_PATH
export PKG_CONFIG_PATH=/home/gunhee/opencvlib/lib/pkgconfig/:$PKG_CONFIG_PATH

- Test as follows to make sure whether the installation is successful [2].
>> cd ~/OpenCV-2.4.1/samples/c
>> sh  build_all.sh
>> ./facedetect  lena.jpg

- Test as follows to make sure whether the installation (for python) is successful [1].


>> cp ~/OpenCV-2.4.1/release/lib/cv2.so ~/lib/python-2.7.3/lib/python2.7/site-packages/
>> cd ~/OpenCV-2.4.1/samples/python
>> python delaunay.py


Reference
- [3] Install OpenCV without root: http://www.mesimian.com/installing-opencv/