Ubuntu 14.04 下安装 OpenCV

参考:

Ubuntu 14.04 下安装 OpenCV

1.安装依赖:

# install dependencies
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libxvidcore-dev libx264-dev libatlas-base-dev gfortran 
# install ffmpeg
sudo add-apt-repository ppa:kirillshkrogalev/ffmpeg-next
sudo apt-get update
sudo apt-get install ffmpeg

2.更新cmake和gcc:

# upgrade cmake
# visit https://cmake.org/download/ and download selected cmake package
tar -zxvf cmake_xxx.tar.gz
cd cmake_xxx/
./bootstarp && make && make install
rm /usr/bin/cmake
rm /usr/bin/ccmake
rm /usr/bin/ctest
rm /usr/bin/cpack
rm /usr/local/bin/cmake
rm /usr/local/bin/ccmake
rm /usr/local/bin/ctest
rm /usr/local/bin/cpack
ln -s path/to/cmake/bin/cmake /usr/bin/cmake
ln -s path/to/cmake/bin/cmake /usr/local/bin/cmake
ln -s path/to/cmake/bin/ccmake /usr/bin/ccmake
ln -s path/to/cmake/bin/ccmake /usr/local/bin/ccmake
ln -s path/to/cmake/bin/ctest /usr/bin/ctest
ln -s path/to/cmake/bin/ctest /usr/local/bin/ctest
ln -s path/to/cmake/bin/cpack /usr/bin/cpack
ln -s path/to/cmake/bin/cpack /usr/local/bin/cpack

# update gcc
wget https://ftp.gnu.org/gnu/gcc/gcc-6.3.0/gcc-6.3.0.tar.bz2
tar jxvf gcc-6.3.0.tar.bz2
cd gcc-6.3.0
./contrib/download_prerequisites
mkdir build && cd build
../configure -v --prefix=$HOME/gcc-6.3.0
make
sudo make install

3.安装opencv:

git clone https://github.com/Itseez/opencv.git
cd opencv/
mkdir build
cd build
cmake -DENABLE_PRECOMPILED_HEADERS=OFF -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
make -j4
sudo make install

2018.5

posted @ 2018-05-05 23:14  Wasdns  阅读(240)  评论(0编辑  收藏  举报