Install opencv3.2 on centos7
1.Download
http://opencv.org/opencv-3-2.html
The latest version can be downloaded from SourceForge and GitHub:
https://sourceforge.net/projects/opencvlibrary/files/opencv-unix/3.2.0/
20170802
[hen@localhost 下載]$ ll
總計 80112
-rw-rw-r--. 1 hen hen 82033498 8月 2 12:15 opencv-3.2.0.zip
[hen@localhost 下載]$ md5sum opencv-3.2.0.zip
bfc6a261eb069b709bcfe7e363ef5899 opencv-3.2.0.zip
2. Require
yum install cmake gcc gtk2-devel numpy pkconfig
yum install gcc-c++
yum install epel-release
yum install libdc1394-devel
yum install libv4l-devel
yum install gstreamer-plugins-base-devel
3. Make
unzip opencv-3.2.0.zip
cd opencv-3.2.0/
# pwd
/root/opencv/opencv-3.2.0
mkdir build
cd build/
cmake -D CMAKE_BUILD_TYPE=DEBUG -D CMAKE_INSTALL_PREFIX=/usr/local ..
make
make install
4.Config
root:
echo '/usr/local/lib/' >> /etc/ld.so.conf.d/opencv.conf
執行 ldconfig 將 /etc/ld.so.conf 的資料讀入快取當中
將動態函式庫載入快取記憶體當中
user:
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig/
env:
PKG_CONFIG_PATH=:/usr/local/lib/pkgconfig/
5.Test
wget https://raw.githubusercontent.com/kyshel/template/master/src/hello_cv.cpp
wget https://raw.githubusercontent.com/kyshel/template/master/file/lena.jpg
g++ -o hello_cv hellocv.cpp `pkg-config opencv --cflags --libs`
./hello_cv lena.jpg lena_gray.jpg
[root@localhost ~]# rpm -qa|grep cmake
cmake-2.8.12.2-2.el7.x86_64
Ref:http://www.linuxfromscratch.org/blfs/view/cvs/general/opencv.html
沒有留言:
張貼留言