-
-
Save mitmul/9253702 to your computer and use it in GitHub Desktop.
#! /bin/bash | |
sudo yum install -y gcc g++ gtk+-devel libjpeg-devel libtiff-devel jasper-devel libpng-devel zlib-devel cmake unzip | |
sudo yum install -y yum-priorities | |
wget http://ftp-srv2.kddilabs.jp/Linux/distributions/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm | |
sudo rpm -ivh epel-release-6-8.noarch.rpm | |
sudo yum install -y eigen3-devel —enablerepo=epel | |
pip install numpy | |
wget http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.8/opencv-2.4.8.zip | |
unzip opencv-2.4.8 | |
cd opencv-2.4.8 | |
mkdir build | |
cd build | |
export PYTHON_EXECUTABLE=$(readlink -e $(which python)) | |
export PYTHON_INCLUDE_PATH=${PYTHON_EXECUTABLE%/*/*}/include | |
export PYTHON_LIBRARY=${PYTHON_EXECUTABLE%/*/*}/lib/libpython2.7.a | |
export PYTHON_NUMPY_INCLUDE_DIR=${PYTHON_EXECUTABLE%/*/*}/lib/python2.7/site-packages/numpy/core/include/numpy | |
export PYTHON_PACKAGES_PATH=${PYTHON_EXECUTABLE%/*/*}/lib/python2.7/site-packages | |
cmake \ | |
-DBUILD_DOCS=OFF \ | |
-DBUILD_EXAMPLES=OFF \ | |
-DBUILD_JPEG=OFF \ | |
-DBUILD_OPENEXR=OFF \ | |
-DBUILD_PACKAGE=OFF \ | |
-DBUILD_PERF_TESTS=OFF \ | |
-DBUILD_PNG=OFF \ | |
-DBUILD_SHARED_LIBS=OFF \ | |
-DBUILD_TBB=OFF \ | |
-DBUILD_TESTS=OFF \ | |
-DBUILD_TIFF=OFF \ | |
-DBUILD_WITH_DEBUG_INFO=OFF \ | |
-DBUILD_ZLIB=OFF \ | |
-DWITH_1394=ON \ | |
-DWITH_EIGEN=ON \ | |
-DWITH_FFMPEG=ON \ | |
-DWITH_GIGEAPI=ON \ | |
-DWITH_GSTREAMER=ON \ | |
-DWITH_GTK=ON \ | |
-DWITH_IPP=OFF \ | |
-DWITH_JASPER=ON \ | |
-DWITH_JPEG=ON \ | |
-DWITH_LIBV4L=ON \ | |
-DWITH_OPENCL=OFF \ | |
-DWITH_OPENCLAMDBLAS=OFF \ | |
-DWITH_OPENCLAMDFFT=OFF \ | |
-DWITH_OPENEXR=OFF \ | |
-DWITH_OPENGL=OFF \ | |
-DWITH_OPENMP=OFF \ | |
-DWITH_OPENNI=OFF \ | |
-DWITH_PNG=ON \ | |
-DWITH_PVAPI=OFF \ | |
-DWITH_QT=OFF \ | |
-DWITH_TBB=OFF \ | |
-DWITH_TIFF=ON \ | |
-DWITH_UNICAP=OFF \ | |
-DWITH_V4L=OFF \ | |
-DWITH_XIMEA=OFF \ | |
-DWITH_XINE=OFF \ | |
-DPYTHON_EXECUTABLE=$PYTHON_EXECUTABLE \ | |
-DPYTHON_INCLUDE_PATH=$PYTHON_INCLUDE_PATH \ | |
-DPYTHON_LIBRARY=$PYTHON_LIBRARY \ | |
-DPYTHON_NUMPY_INCLUDE_DIR=$PYTHON_NUMPY_INCLUDE_DIR \ | |
-DPYTHON_PACKAGES_PATH=$PYTHON_PACKAGES_PATH \ | |
-Wno-dev ../ | |
make | |
sudo make install |
@solak1984 I have the same problem , how did you resolve it ?
2.4.8 is no longer available, please use
http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.9/opencv-2.4.9.zip
Help me please!
I have error:
Linking CXX shared library ../../lib/cv2.so
/usr/bin/ld: /usr/local/lib/libpython2.7.a(abstract.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libpython2.7.a: could not read symbols: Bad value
@solak1984 --> follow this steps step 1) cd /opencv-2.4.9/build step 2) vi ../cmake/cl2cpp.cmake step 3) Comment out string(MD5 hash "${lines}") on line 50 and Other options (including updating cmake) can be found at ( http://answers.opencv.org/question/24095/building-opencv-247-on-centos-6/ )
Thanks for the script. I ran it but my make ended with 2 errors....
make[2]: *** [modules/python/CMakeFiles/opencv_python.dir/src2/cv2.cpp.o] Error 1
make[1]: *** [modules/python/CMakeFiles/opencv_python.dir/all] Error 2
make: *** [all] Error 2